/* ==========================================================
   MONTAREZZI — Design System
   Dark + grid background + neon
   ========================================================== */

:root {
  /* Base */
  --bg-void: #05060a;
  --bg-deep: #080a12;
  --bg-panel: #0c0f1a;
  --bg-elev: #111524;
  --bg-hover: #161b2e;
  --bg-input: #0a0d18;

  /* Grid — os quadradinhos do fundo */
  --grid-line: rgba(125, 150, 255, 0.10);
  --grid-glow: rgba(0, 240, 255, 0.05);
  --grid-size: 32px;

  /* Neon — usado na interface (texto, brilho, bordas) */
  --neon-cyan: #00f0ff;
  --neon-purple: #a855f7;
  --neon-pink: #ff2d9b;
  --neon-lime: #39ff88;
  --neon-amber: #ffb020;
  --neon-red: #ff3b5c;
  --neon-blue: #4d7cff;

  /* Series de dados — NAO usar os neon acima nos graficos.
     Validadas contra daltonismo: ΔE 44.9 (deutan), banda L 0.48–0.67,
     contraste >= 3:1. Rodar scripts/validate_palette.js antes de trocar. */
  --series-1: #0ea5b7; /* recebidas */
  --series-2: #a855f7; /* enviadas  */

  /* Texto */
  --text: #e8ecff;
  --text-dim: #9aa3c4;
  --text-mute: #5d6685;

  /* Bordas */
  --border: rgba(140, 160, 255, 0.10);
  --border-str: rgba(140, 160, 255, 0.22);

  /* Glow */
  --glow-cyan: 0 0 12px rgba(0, 240, 255, 0.5), 0 0 34px rgba(0, 240, 255, 0.16);
  --glow-purple: 0 0 12px rgba(168, 85, 247, 0.5), 0 0 34px rgba(168, 85, 247, 0.16);
  --glow-lime: 0 0 10px rgba(57, 255, 136, 0.55);
  --glow-pink: 0 0 12px rgba(255, 45, 155, 0.5);

  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --sidebar-w: 250px;
  --list-w: 340px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-void);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-size: 14px;
}

/* ---------- Fundo: quadradinhos + brilho ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  /* Vinheta suave nas bordas, mas o miolo do grid fica visivel */
  mask-image: radial-gradient(ellipse 100% 85% at 50% 45%, #000 60%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 100% 85% at 50% 45%, #000 60%, transparent 100%);
}

/* Quadradinhos maiores por cima, dando profundidade ao fundo */
.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-glow) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-glow) 1px, transparent 1px);
  background-size: calc(var(--grid-size) * 4) calc(var(--grid-size) * 4);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 12% 8%, rgba(0, 240, 255, 0.10), transparent 55%),
    radial-gradient(700px circle at 88% 92%, rgba(168, 85, 247, 0.10), transparent 55%),
    radial-gradient(500px circle at 60% 40%, rgba(255, 45, 155, 0.05), transparent 60%);
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-18px, 14px, 0) scale(1.04); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 160, 255, 0.16);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, 0.35); }

/* ==========================================================
   LOGIN
   ========================================================== */
.login-wrap {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(160deg, rgba(17, 21, 36, 0.92), rgba(8, 10, 18, 0.96));
  border: 1px solid var(--border-str);
  border-radius: 20px;
  padding: 40px 34px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Fio de neon correndo no topo do card */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-purple), var(--neon-pink), transparent);
  animation: sweep 3.5s linear infinite;
  background-size: 200% 100%;
}

@keyframes sweep {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo .mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.16), rgba(168, 85, 247, 0.16));
  border: 1px solid var(--border-str);
  box-shadow: var(--glow-cyan);
  font-size: 22px;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple) 60%, var(--neon-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-sub {
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  margin-bottom: 30px;
}

/* ==========================================================
   FORM
   ========================================================== */
.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  /* text-mute dava 3.12:1 sobre o card — abaixo do minimo legivel (4.5:1). */
  color: var(--text-dim);
  margin-bottom: 8px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
}

.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12), var(--glow-cyan);
  background: #0d1120;
}

/* #7d87a8 = 5.45:1 sobre o campo; o text-mute dava 3.42:1. */
.input::placeholder, .textarea::placeholder { color: #7d87a8; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235d6685' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.select option { background: var(--bg-elev); color: var(--text); }

/* ---------- Slider ---------- */
.range {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  appearance: none;
  outline: none;
  cursor: pointer;
  margin: 6px 0 2px;
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border: 2px solid var(--bg-void);
  box-shadow: var(--glow-cyan);
  cursor: pointer;
  transition: transform 0.15s;
}
.range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--neon-cyan);
  border: 2px solid var(--bg-void);
  box-shadow: var(--glow-cyan);
  cursor: pointer;
}

.field label .mono {
  float: right;
  color: var(--neon-cyan);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Botoes ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-str);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
  /* Os CTA da landing sao <a>: sem isto o navegador risca o texto do botao. */
  text-decoration: none;
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-str); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }

/* Varredura de luz atravessa o botao no hover */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.13) 50%, transparent 80%);
  transform: translateX(-100%);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.btn:hover:not(:disabled)::after { transform: translateX(100%); }

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(168, 85, 247, 0.24));
  border-color: rgba(0, 240, 255, 0.45);
  color: #eafcff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.1); border-color: var(--neon-cyan); }

.btn-danger { border-color: rgba(255, 59, 92, 0.4); color: #ffd6dd; background: rgba(255, 59, 92, 0.1); }
.btn-danger:hover:not(:disabled) { box-shadow: 0 0 12px rgba(255, 59, 92, 0.4); border-color: var(--neon-red); }

.btn-success { border-color: rgba(57, 255, 136, 0.4); color: #d7ffe8; background: rgba(57, 255, 136, 0.1); }
.btn-success:hover:not(:disabled) { box-shadow: var(--glow-lime); border-color: var(--neon-lime); }

/* Botao da Meta: azul do Facebook, distinto do neon do resto */
.btn-meta {
  background: linear-gradient(135deg, rgba(77, 124, 255, 0.22), rgba(24, 119, 242, 0.3));
  border-color: rgba(77, 124, 255, 0.5);
  color: #dce6ff;
}
.btn-meta:hover:not(:disabled) {
  box-shadow: 0 0 12px rgba(77, 124, 255, 0.55), 0 0 30px rgba(77, 124, 255, 0.2);
  border-color: var(--neon-blue);
}

/* Numero vindo da API oficial: borda azul o diferencia dos do WhatsApp Web */
.num-cloud { border-color: rgba(77, 124, 255, 0.28); }
.num-cloud:hover { border-color: rgba(77, 124, 255, 0.5); }

/* Comparacao dos dois caminhos da Meta */
.path-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
}

.path-card.path-ok {
  border-color: rgba(57, 255, 136, 0.28);
  background: rgba(57, 255, 136, 0.03);
}

.path-head { margin-bottom: 10px; }
.path-card .req-item { margin-bottom: 6px; padding: 9px 10px; }
.req-n.ok { color: var(--neon-lime); background: rgba(57, 255, 136, 0.12); border-color: rgba(57, 255, 136, 0.35); }

/* Lista de pre-requisitos da Meta */
.req-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.req-n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--neon-amber);
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.35);
}

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-icon { padding: 9px; border-radius: 9px; }

/* Icone de traco dentro de botao: herda a cor do texto do botao */
.btn .i {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-icon .i { width: 16px; height: 16px; }

/* Icone dentro do campo de busca */
.search-box .ico svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* ---------- Alerta ---------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
  display: none;
}
.alert.show { display: block; animation: rise 0.25s ease; }
.alert-error { background: rgba(255, 59, 92, 0.1); border-color: rgba(255, 59, 92, 0.4); color: #ffb3c0; }
.alert-ok { background: rgba(57, 255, 136, 0.1); border-color: rgba(57, 255, 136, 0.4); color: #a8ffcf; }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, rgba(13, 17, 30, 0.97), rgba(7, 9, 16, 0.99));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
  position: relative;
}

/* Fio de luz na borda da sidebar */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(0, 240, 255, 0.28) 18%, rgba(168, 85, 247, 0.28) 55%, transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.brand .mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(168, 85, 247, 0.22));
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: var(--glow-cyan), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: 17px;
  flex-shrink: 0;
  animation: breathe 4s ease-in-out infinite;
}

/* A marca respira de leve — sinal de que o sistema esta vivo */
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.35), 0 0 26px rgba(0, 240, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
  50%      { box-shadow: 0 0 16px rgba(0, 240, 255, 0.6), 0 0 40px rgba(168, 85, 247, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag { font-size: 10px; color: var(--text-mute); letter-spacing: 0.5px; }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-mute);
  padding: 12px 10px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s, color 0.16s, box-shadow 0.2s;
  position: relative;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(168, 85, 247, 0.06));
  color: #fff;
  border-color: rgba(0, 240, 255, 0.24);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -1px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.nav-item .ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.nav-item .ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: filter 0.2s;
}

.nav-item.active .ico { color: var(--neon-cyan); }
.nav-item.active .ico svg { filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.7)); }

.nav-item .badge {
  margin-left: auto;
  background: var(--neon-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  box-shadow: var(--glow-pink);
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
  color: #05060a;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

/* ---------- Main ---------- */
.main { overflow: hidden; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(8, 10, 18, 0.7);
  backdrop-filter: blur(14px);
  flex-shrink: 0;
  gap: 16px;
}

.page-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.page-sub { font-size: 11.5px; color: var(--text-mute); }

.view { flex: 1; overflow-y: auto; padding: 22px; }
.view.no-pad { padding: 0; overflow: hidden; }
.view[hidden] { display: none; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(160deg, rgba(19, 24, 42, 0.72), rgba(10, 13, 23, 0.88));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  position: relative;
  /* Luz sutil na aresta superior: da volume sem pesar */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 4px 20px rgba(0, 0, 0, 0.28);
  transition: border-color 0.25s;
}

.card:hover { border-color: rgba(140, 160, 255, 0.17); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neon-cyan); box-shadow: var(--glow-cyan); }
.card-desc { font-size: 12px; color: var(--text-mute); margin-top: 3px; }

.grid { display: grid; gap: 16px; }
/* align-items:start impede que um card curto estique para acompanhar o vizinho */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- Stat tiles ---------- */
.stat {
  background: linear-gradient(160deg, rgba(19, 24, 42, 0.85), rgba(10, 13, 23, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s, box-shadow 0.25s;
}

.stat:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent, var(--neon-cyan)) 45%, transparent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

/* Fio de neon no topo */
.stat::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--neon-cyan)), transparent);
  box-shadow: 0 0 12px var(--accent, var(--neon-cyan));
}

/* Halo difuso no canto, reforca a cor do card sem competir com o numero */
.stat::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: var(--accent, var(--neon-cyan));
  opacity: 0.1;
  filter: blur(34px);
  transition: opacity 0.25s;
  pointer-events: none;
}
.stat:hover::before { opacity: 0.2; }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-mute);
  font-weight: 700;
}

.stat-ico {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent, var(--neon-cyan));
  background: color-mix(in srgb, var(--accent, var(--neon-cyan)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, var(--neon-cyan)) 28%, transparent);
}

.stat-ico svg {
  width: 15px; height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1.2px;
  font-family: var(--mono);
  color: var(--accent, var(--neon-cyan));
  text-shadow: 0 0 26px color-mix(in srgb, var(--accent, var(--neon-cyan)) 55%, transparent);
  line-height: 1;
  position: relative;
}

.stat-foot {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 9px;
  position: relative;
}

/* ---------- Status pill ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill .led { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on  { color: var(--neon-lime); border-color: rgba(57, 255, 136, 0.35); background: rgba(57, 255, 136, 0.08); }
.pill.on .led { box-shadow: var(--glow-lime); animation: pulse 2s ease-in-out infinite; }
.pill.off { color: var(--text-mute); border-color: var(--border); background: rgba(255, 255, 255, 0.02); }
.pill.wait{ color: var(--neon-amber); border-color: rgba(255, 176, 32, 0.35); background: rgba(255, 176, 32, 0.08); }
.pill.wait .led { animation: pulse 1s ease-in-out infinite; }
.pill.err { color: var(--neon-red); border-color: rgba(255, 59, 92, 0.35); background: rgba(255, 59, 92, 0.08); }

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

/* ---------- Toggle ---------- */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  border-radius: 99px;
  background: var(--bg-input);
  border: 1px solid var(--border-str);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s;
}

.toggle.on {
  background: rgba(57, 255, 136, 0.16);
  border-color: var(--neon-lime);
  box-shadow: var(--glow-lime);
}
.toggle.on::after { transform: translateX(20px); background: var(--neon-lime); }

.row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.row-toggle:last-child { border-bottom: none; }
.row-toggle .rt-title { font-size: 13.5px; font-weight: 600; }
.row-toggle .rt-desc { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

/* ==========================================================
   CONVERSAS
   ========================================================== */
.chat-layout {
  display: grid;
  grid-template-columns: var(--list-w) 1fr;
  height: 100%;
  overflow: hidden;
}

.conv-list {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  /* Solido de proposito: com fundo translucido os quadradinhos do grid
     vazavam por baixo da lista e sujavam o espaco vazio. */
  background: var(--bg-panel);
  overflow: hidden;
}

.conv-search { padding: 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }

.search-box { position: relative; }
.search-box .ico {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-mute);
  font-size: 13px;
  pointer-events: none;
}
.search-box .input { padding-left: 34px; }

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

.conv-item {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-left: 2px solid transparent;
}

.conv-item:hover { background: var(--bg-hover); }
.conv-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), transparent);
  border-left-color: var(--neon-cyan);
}

.conv-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #05060a;
  flex-shrink: 0;
}

.conv-body { flex: 1; min-width: 0; }

.conv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.conv-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time { font-size: 10.5px; color: var(--text-mute); flex-shrink: 0; font-family: var(--mono); }

.conv-preview {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; }

.tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid;
}
.tag-ai { color: var(--neon-cyan); border-color: rgba(0, 240, 255, 0.3); background: rgba(0, 240, 255, 0.08); }
.tag-cloud { color: var(--neon-blue); border-color: rgba(77, 124, 255, 0.35); background: rgba(77, 124, 255, 0.1); }
.tag-web { color: var(--neon-lime); border-color: rgba(57, 255, 136, 0.3); background: rgba(57, 255, 136, 0.08); }
.tag-manual { color: var(--neon-amber); border-color: rgba(255, 176, 32, 0.3); background: rgba(255, 176, 32, 0.08); }
.tag-group { color: var(--neon-purple); border-color: rgba(168, 85, 247, 0.3); background: rgba(168, 85, 247, 0.08); }

.unread {
  margin-left: auto;
  background: var(--neon-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  box-shadow: var(--glow-pink);
}

/* ---------- Painel do chat ---------- */
.chat-panel { display: flex; flex-direction: column; overflow: hidden; }

.chat-head {
  height: 62px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
  background: var(--bg-panel);
}

.chat-peer { display: flex; align-items: center; gap: 11px; min-width: 0; }
.chat-peer-name { font-size: 14.5px; font-weight: 700; }
.chat-peer-jid { font-size: 11px; color: var(--text-mute); font-family: var(--mono); }
.chat-actions { display: flex; align-items: center; gap: 8px; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 3px; /* mensagens seguidas ficam agrupadas, como num app de mensagem */
  background-image:
    linear-gradient(rgba(120, 140, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 140, 255, 0.028) 1px, transparent 1px);
  background-size: 26px 26px;
}

.bubble {
  max-width: min(62%, 560px);
  padding: 8px 12px 6px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  /* pre-wrap fica no .bubble-text, nunca aqui: na bolha ele renderizaria a
     indentacao do HTML gerado como linhas em branco. */
  white-space: normal;
  animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  width: fit-content;
  /* Empilha: anexo em cima, texto no meio, horario embaixo. Sem isto o chip de
     midia fica na mesma linha do texto. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Preserva as quebras de linha que o contato realmente digitou. */
.bubble-text { white-space: pre-wrap; }

@keyframes pop {
  from { opacity: 0; transform: translateY(7px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble.them {
  align-self: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}

.bubble.me {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.13), rgba(168, 85, 247, 0.17));
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-bottom-right-radius: 5px;
}

.bubble.ai { border-color: rgba(168, 85, 247, 0.4); }

/* Respiro so na troca de lado: o bloco de quem fala fica visualmente unido */
.bubble.them + .bubble.me,
.bubble.me + .bubble.them { margin-top: 11px; }

.bubble-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 9.5px;
  color: var(--text-mute);
  font-family: var(--mono);
  justify-content: flex-end;
  line-height: 1;
  width: 100%; /* o horario acompanha a borda da bolha, nao o texto */
}

.bubble.them .bubble-foot { justify-content: flex-start; }

.ai-mark {
  font-size: 9px;
  font-weight: 800;
  color: var(--neon-purple);
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.bubble img, .bubble video {
  max-width: 100%;
  border-radius: 9px;
  display: block;
  margin-bottom: 6px;
}

.bubble audio { width: 260px; margin-bottom: 4px; }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 4px;
  text-decoration: none;
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 12px;
  width: fit-content; /* sem isto o chip estica a bolha inteira */
}

.file-chip .i {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  color: var(--neon-cyan);
}

.chat-compose {
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-panel);
  flex-shrink: 0;
}

.compose-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  resize: none;
  max-height: 130px;
  min-height: 42px;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.compose-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

/* ---------- Empty state ---------- */
.empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  color: var(--text-mute);
}
.empty .big { font-size: 46px; margin-bottom: 14px; opacity: 0.4; }
.empty .t { font-size: 15px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.empty .d { font-size: 12.5px; max-width: 320px; line-height: 1.6; }

/* ==========================================================
   NUMEROS / QR
   ========================================================== */
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

.num-card {
  /* Solido: o grid do fundo atravessava o card e sujava a leitura. */
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.num-card:hover {
  border-color: var(--border-str);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

/* Faixa superior colorida pelo estado — da para ler o card de longe. */
.num-card::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--text-mute);
}
.num-card.st-connected::before {
  background: linear-gradient(90deg, var(--neon-lime), var(--neon-cyan));
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.45);
}
.num-card.st-qr::before,
.num-card.st-pairing::before,
.num-card.st-connecting::before { background: linear-gradient(90deg, var(--neon-amber), var(--neon-pink)); }
.num-card.st-disconnected::before { background: rgba(140, 160, 255, 0.2); }
.num-cloud.st-connected::before { background: linear-gradient(90deg, var(--neon-blue), var(--neon-cyan)); }

.num-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
}
.num-id { min-width: 0; flex: 1; }
.num-name {
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.num-phone { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; white-space: nowrap; }

/* Marca da via (WhatsApp Web ou Meta) */
.num-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(57, 255, 136, 0.1);
  border: 1px solid rgba(57, 255, 136, 0.22);
}
.num-mark svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: var(--neon-lime);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.num-cloud .num-mark { background: rgba(77, 124, 255, 0.1); border-color: rgba(77, 124, 255, 0.28); }
.num-cloud .num-mark svg { stroke: var(--neon-blue); }

.num-tags {
  padding: 0 16px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}
.num-ids {
  padding: 10px 16px 0;
  font-size: 10px;
  color: var(--text-mute);
  line-height: 1.6;
  word-break: break-all;
}

/* Uso real do numero */
.num-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 14px 0 0;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.num-stat {
  background: var(--bg-panel);
  padding: 11px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ns-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ns-k { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.05em; }

.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  place-items: center;
  margin: 14px 16px;
  box-shadow: var(--glow-cyan);
  animation: rise 0.3s ease;
}
.qr-box img { width: 100%; max-width: 220px; display: block; border-radius: 4px; }

.qr-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  margin: 0 16px 12px;
}

.num-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px 16px;
  margin-top: auto;
}
.num-actions .btn { flex: 1; justify-content: center; min-width: 0; }

/* ==========================================================
   GRAFICO
   Barras agrupadas. Cores validadas para daltonismo
   (ΔE 44.9 deutan) — ver --series-1 / --series-2.
   ========================================================== */
.chart-wrap { display: grid; grid-template-columns: auto 1fr; gap: 10px; }

/* Eixo Y */
.chart-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 200px;
  padding-bottom: 20px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-mute);
  text-align: right;
  min-width: 26px;
}

.chart-plot { position: relative; height: 200px; }

/* Linhas de grade recessivas, atras das barras */
.chart-grid {
  position: absolute;
  inset: 0 0 20px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.chart-grid span { border-top: 1px solid rgba(140, 160, 255, 0.07); }

.chart {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
}

.bar-col {
  flex: 1 1 0;
  /* Trava a largura: com poucos dias as barras nao viram blocos gigantes. */
  max-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  border-radius: 6px;
  transition: background 0.15s;
}

.bar-col:hover { background: rgba(140, 160, 255, 0.05); }

/* Barras lado a lado: comparar dentro do dia e entre dias */
.bar-group {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px; /* espacador de superficie entre marcas adjacentes */
  height: calc(100% - 20px);
  width: 100%;
  padding: 0 3px;
}

.bar {
  flex: 1;
  max-width: 17px;
  border-radius: 5px 5px 0 0; /* extremidade de dado arredondada, ancorada na base */
  animation: grow 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: bottom;
  transition: filter 0.15s;
}

/* Dia sem movimento: reserva o espaco da barra sem desenhar marca */
.bar-void { flex: 1; max-width: 17px; }

.bar-col:hover .bar { filter: brightness(1.25); }

.bar-in  { background: linear-gradient(180deg, var(--series-1), color-mix(in oklab, var(--series-1) 55%, transparent)); }
.bar-out { background: linear-gradient(180deg, var(--series-2), color-mix(in oklab, var(--series-2) 55%, transparent)); }

@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.bar-label {
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--mono);
  height: 20px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: color 0.15s;
}

.bar-col:hover .bar-label { color: var(--neon-cyan); }

/* Hoje: so o rotulo em neon. Um bloco de fundo aqui vira mancha sobre o grafico. */
.bar-col.today .bar-label {
  color: var(--neon-cyan);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

/* Tooltip no hover da coluna */
.bar-tip {
  position: absolute;
  bottom: calc(100% - 14px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(6, 8, 16, 0.97);
  border: 1px solid var(--border-str);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
}

.bar-col:hover .bar-tip { opacity: 1; transform: translateX(-50%) translateY(0); }

.bar-tip-day { font-weight: 700; margin-bottom: 5px; color: var(--text); }
.bar-tip-row { display: flex; align-items: center; gap: 7px; color: var(--text-dim); }
.bar-tip-row b { color: var(--text); font-family: var(--mono); margin-left: auto; }
.bar-tip-sw { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

.legend { display: flex; gap: 18px; justify-content: center; margin-top: 16px; font-size: 11.5px; color: var(--text-dim); }
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Linhas do painel ---------- */
.num-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--border);
  transition: background 0.16s, border-color 0.16s;
}
.num-row:hover { background: var(--bg-hover); border-color: var(--border-str); }

.num-row-av {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #05060a;
  flex-shrink: 0;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 7px;
  transition: background 0.16s;
}
.log-row:hover { background: var(--bg-hover); }

.log-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.log-time { color: var(--text-mute); font-size: 10px; flex-shrink: 0; min-width: 38px; }
.log-msg {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ==========================================================
   TABELA
   ========================================================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-mute);
  font-weight: 700;
  border-bottom: 1px solid var(--border-str);
  white-space: nowrap;
}

td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }

/* ==========================================================
   MODAL
   ========================================================== */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 4, 8, 0.82);
  backdrop-filter: blur(7px);
  display: none;
  place-items: center;
  padding: 20px;
}
.modal-bg.show { display: grid; animation: fade 0.2s ease; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(160deg, rgba(17, 21, 36, 0.98), rgba(8, 10, 18, 0.99));
  border: 1px solid var(--border-str);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8);
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 88vh;
  overflow-y: auto;
}

/* ---------- Abas ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-mute);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.tab:hover { color: var(--text-dim); }

.tab.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(168, 85, 247, 0.1));
  border-color: rgba(0, 240, 255, 0.32);
  color: #eafcff;
}

/* ---------- Passo a passo recolhivel ---------- */
.howto {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
}

.howto summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--neon-cyan);
  user-select: none;
}

.howto[open] summary { margin-bottom: 10px; }

.howto ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}
.howto li { margin-bottom: 7px; }

.alert-ok { background: rgba(57, 255, 136, 0.08); border-color: rgba(57, 255, 136, 0.35); color: #a8ffcf; }

.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.modal-desc { font-size: 12.5px; color: var(--text-mute); margin-bottom: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ==========================================================
   TOAST
   ========================================================== */
.toasts {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(17, 21, 36, 0.97);
  border: 1px solid var(--border-str);
  border-left: 3px solid var(--neon-cyan);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  min-width: 240px;
  max-width: 360px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
  animation: slide-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(12px);
}

.toast.ok  { border-left-color: var(--neon-lime); }
.toast.err { border-left-color: var(--neon-red); }
.toast.out { animation: slide-out 0.25s ease forwards; }

@keyframes slide-in  { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(100%); } }

/* ==========================================================
   UTIL
   ========================================================== */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { font-size: 11.5px; color: var(--text-mute); margin-top: 7px; line-height: 1.55; }
.mono { font-family: var(--mono); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ==========================================================
   RESPONSIVO
   ========================================================== */
@media (max-width: 1080px) {
  :root { --list-w: 280px; --sidebar-w: 72px; }
  .brand-text, .nav-item span:not(.ico):not(.badge), .user-info { display: none; }
  .nav-item { justify-content: center; }
  .brand { justify-content: center; padding: 20px 8px; }
  .user-chip { justify-content: center; }
}

@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .conv-list { display: none; }
  .conv-list.mobile-show { display: flex; }
  .chat-panel.mobile-hide { display: none; }
  .view { padding: 14px; }
  .bubble { max-width: 84%; }
}

/* ---------- Faixa de suporte (superadmin vendo outro cliente) ---------- */
.imp-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12.5px;
  color: #1a1200;
  background: linear-gradient(90deg, var(--neon-amber), #ffd166);
  box-shadow: 0 2px 14px rgba(255, 176, 32, 0.4);
}
.imp-bar .btn { padding: 4px 10px; font-size: 11px; background: rgba(0, 0, 0, 0.82); color: #fff; border-color: transparent; }

/* ---------- Raio da marca ---------- */
/* Substitui o emoji ⚡: o sistema operacional o pintava de amarelo,
   brigando com o neon ciano de todo o resto. */
.mark .bolt {
  width: 58%;
  height: 58%;
  display: block;
  filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.85));
}

.login-logo .mark .bolt { width: 54%; height: 54%; }

/* ---------- Modal de confirmacao ---------- */
.ask-ic {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--neon-red);
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.32);
}

.ask-ic svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Pergunta sem risco (sair do painel) não precisa gritar em vermelho */
.ask-ic.calm {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.32);
}

#modal-ask .modal-desc { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }

/* ==========================================================
   FUNIL
   ========================================================== */
.fn-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.fn-item:hover { background: var(--bg-hover); }
.fn-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), transparent);
  border-color: rgba(0, 240, 255, 0.34);
}
.fn-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cada passo da sequencia */
.fn-step {
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  position: relative;
}

/* Fio ligando um passo ao outro: mostra que e uma sequencia, nao uma lista solta */
.fn-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 26px;
  bottom: -10px;
  width: 2px;
  height: 10px;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.5), rgba(0, 240, 255, 0.1));
}

.fn-step-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }

.fn-step-n {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.32);
  flex-shrink: 0;
}

.fn-delay { display: flex; align-items: center; gap: 6px; }
.fn-delay .input { width: 74px; padding: 5px 8px; font-size: 12px; text-align: center; }

.fn-audio { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fn-audio audio { height: 34px; max-width: 260px; }

.fn-step .textarea { min-height: 58px; font-size: 13px; }

@media (max-width: 1080px) {
  #view-funnel .grid { grid-template-columns: 1fr !important; }
}

/* ---------- Visualizador de JSON ---------- */
.json-view {
  background: #06090f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--neon-lime);
  max-height: 380px;
  overflow: auto;
  white-space: pre;
  margin: 0;
}

/* ---------- Codigo de pareamento (alternativa ao QR) ---------- */
.pair-box {
  background: linear-gradient(160deg, rgba(0, 240, 255, 0.08), rgba(168, 85, 247, 0.06));
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 14px;
  margin: 14px 16px;
  padding: 20px;
  text-align: center;
  margin: 14px 0;
  box-shadow: var(--glow-cyan);
}

.pair-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 12px;
}

/* O codigo e para ser lido e digitado no celular: espaco entre as letras ajuda */
.pair-code {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--neon-cyan);
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.6);
  margin-bottom: 14px;
  user-select: all;
}

/* ---------- Foto do contato ---------- */
.conv-avatar img, .chat-peer .conv-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* Selo de conta comercial, como no proprio WhatsApp */
.biz-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--neon-lime);
  border: 2px solid var(--bg-panel);
  display: grid;
  place-items: center;
}
.conv-avatar { position: relative; }

/* ---------- Dados do contato ---------- */
.info-top { text-align: center; }

.info-top .conv-avatar,
.avatar-lg {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 800;
  color: #05060a;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.info-name { font-size: 18px; font-weight: 700; }
.info-phone { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-mute); min-width: 84px; flex-shrink: 0; font-size: 12px; }
.info-row .v { color: var(--text); word-break: break-word; }

/* ==========================================================
   PAINEL DE 3 COLUNAS — lista | conversa | dados do contato
   ========================================================== */
:root { --contact-w: 300px; }

.chat-layout.with-contact {
  grid-template-columns: var(--list-w) 1fr var(--contact-w);
}

.contact-panel {
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cp-scroll {
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cp-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.cp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cp-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* Presenca so aparece quando o contato deixa ver — nunca inventamos. */
.cp-presence {
  font-size: 10px;
  color: var(--neon-lime);
  display: flex;
  align-items: center;
  gap: 5px;
}
.cp-presence::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--neon-lime);
  box-shadow: 0 0 8px var(--neon-lime);
}

.cp-identity { text-align: center; }
.cp-name {
  font-size: 15px;
  font-weight: 700;
  margin-top: 10px;
  word-break: break-word;
}
.cp-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.cp-badges { justify-content: center; margin-top: 10px; flex-wrap: wrap; }

.cp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cp-stat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.cp-stat-k {
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cp-stat-v {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.cp-stat-v.sm { font-size: 12px; font-weight: 600; color: var(--text-dim); }

.cp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.cp-row:last-of-type { border-bottom: 0; }
.cp-row-txt { min-width: 0; }
.cp-row-t { font-size: 12px; font-weight: 600; }
.cp-row-d { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* ---------- Abas da lista ---------- */
.conv-tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.conv-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: color 0.15s, background 0.15s;
}
.conv-tab:hover { color: var(--text-dim); }
.conv-tab.active {
  background: var(--bg-hover);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-str);
}
.ct-n {
  font-size: 9px;
  background: rgba(140, 160, 255, 0.14);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 1px 5px;
  font-variant-numeric: tabular-nums;
}
.conv-tab.active .ct-n { background: rgba(0, 240, 255, 0.18); color: var(--neon-cyan); }

/* ---------- Barra de status ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 11px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.sb-left { display: flex; gap: 6px; flex-wrap: wrap; }
.sb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}
.sb-item svg {
  width: 11px; height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  opacity: 0.7;
}
.sb-item.on { color: var(--text-dim); }
.sb-item.on svg { color: var(--neon-lime); opacity: 1; }
.sb-item.off svg { color: var(--neon-red); opacity: 1; }
.sb-item.unset { color: var(--text-mute); }

.sb-item .led {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
}
.sb-item.on .led { background: var(--neon-lime); box-shadow: 0 0 7px var(--neon-lime); }
.sb-item.on { color: var(--text-dim); }
.sb-item.off .led { background: var(--neon-red); }

@media (max-width: 1400px) {
  :root { --contact-w: 260px; }
}
@media (max-width: 1150px) {
  /* Sem espaco para 3 colunas: os dados do contato voltam a ser sobreposicao. */
  .chat-layout.with-contact { grid-template-columns: var(--list-w) 1fr; }
  .contact-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 300px;
    z-index: 40;
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.5);
  }
  .chat-layout { position: relative; }
}

/* "Não lidas" nao cabe em uma linha na coluna de 340px: encolhe o texto. */
.conv-tab { font-size: 10.5px; white-space: nowrap; padding: 6px 3px; }
.conv-tab .ct-n { padding: 1px 4px; }

/* O avatar da coluna de contato e menor que o do modal antigo. */
#cp-avatar .avatar-lg { width: 76px; height: 76px; font-size: 26px; margin-bottom: 0; }

/* ==========================================================
   SANFONA (accordion)
   Anima com grid-template-rows 0fr -> 1fr: nao precisa medir
   altura no JS e funciona com conteudo de tamanho variavel.
   ========================================================== */
.acc-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1080px;
}

.acc {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.acc[open] { border-color: var(--border-str); }

.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.acc-head:hover { background: var(--bg-hover); }

.acc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  flex-shrink: 0;
}
.acc-txt { flex: 1; min-width: 0; }
.acc-t { display: block; font-size: 14px; font-weight: 700; }
.acc-d { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

/* Resumo do que esta valendo — evita ter que abrir para conferir. */
.acc-sum {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  flex-shrink: 0;
}
.acc-sum:empty { display: none; }

.acc-chev {
  width: 17px; height: 17px;
  fill: none;
  stroke: var(--text-mute);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform 0.28s ease, stroke 0.2s;
}
.acc[open] > .acc-head .acc-chev { transform: rotate(180deg); stroke: var(--neon-cyan); }

.acc-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.acc[open] > .acc-body { grid-template-rows: 1fr; }
/* min-height:0 e obrigatorio: sem ele o grid nao encolhe abaixo do conteudo. */
.acc-in { overflow: hidden; min-height: 0; }
.acc-pad { padding: 4px 18px 18px; border-top: 1px solid var(--border); padding-top: 16px; }

/* Sanfona dentro de sanfona */
.acc-sub {
  background: var(--bg-input);
  margin-top: 14px;
}
.acc-sub > .acc-head { padding: 12px 14px; }
.acc-sub .acc-t { font-size: 12.5px; }
.acc-sub .acc-pad { padding: 14px; }

/* O toggle dentro do cabecalho nao pode abrir/fechar a sanfona ao ser clicado. */
.acc-head .toggle { flex-shrink: 0; }

/* ---------- Cartoes de provedor ---------- */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.prov {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  transition: border-color 0.2s;
}
/* O provedor em uso fica evidente sem precisar procurar o selo. */
.prov.is-active {
  border-color: rgba(57, 255, 136, 0.4);
  box-shadow: inset 0 0 0 1px rgba(57, 255, 136, 0.12);
}
.prov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.prov-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.prov-desc { font-size: 11px; color: var(--text-mute); margin: 0 0 12px; }

/* ---------- Barra de salvar ---------- */
/* Duas colunas de verdade: o .grid-2 e auto-fit e viraria 3 aqui. */
.g2 { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 900px) { .g2 { grid-template-columns: 1fr; } }

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 16px;
  max-width: 1080px;
  /* Solida e com borda: em cima do gradiente o texto do conteudo aparecia por baixo. */
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 -8px 24px rgba(5, 6, 10, 0.6);
}
/* Espaco para o ultimo campo nao terminar embaixo da barra. */
.acc-wrap { padding-bottom: 4px; }

@media (max-width: 760px) {
  .acc-sum { display: none; }
}

/* ---------- Menu numerado ---------- */
.menu-preview {
  background: #0b141a;              /* o verde-escuro do WhatsApp */
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.menu-preview .mp-bubble {
  background: #202c33;
  border-radius: 4px 12px 12px 12px;
  padding: 9px 12px;
  max-width: 340px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e9edef;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}
.menu-preview .mp-empty { color: var(--text-mute); font-size: 12px; }

.opt-row {
  display: grid;
  grid-template-columns: 30px 1fr 190px auto;
  gap: 8px;
  align-items: start;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.opt-n {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 5px;
}
.opt-extra { grid-column: 2 / -1; margin-top: 2px; }
@media (max-width: 900px) {
  .opt-row { grid-template-columns: 30px 1fr auto; }
  .opt-extra { grid-column: 1 / -1; }
}

/* ---------- CRM: etiquetas ---------- */
.cp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-tags:empty::after {
  content: 'Nenhuma etiqueta';
  font-size: 11px;
  color: var(--text-mute);
}
.crm-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  border: 1px solid;
  white-space: nowrap;
}
.crm-tag.pick { cursor: pointer; opacity: 0.35; transition: opacity 0.15s; }
.crm-tag.pick:hover { opacity: 0.7; }
.crm-tag.pick.on { opacity: 1; }
.crm-tag .x { margin-left: 5px; opacity: 0.6; cursor: pointer; }
.crm-tag .x:hover { opacity: 1; }

.tg-cyan   { color: #7df0ff; background: rgba(0, 240, 255, 0.12);  border-color: rgba(0, 240, 255, 0.4); }
.tg-purple { color: #d8b4fe; background: rgba(168, 85, 247, 0.14); border-color: rgba(168, 85, 247, 0.42); }
.tg-lime   { color: #86efac; background: rgba(57, 255, 136, 0.12); border-color: rgba(57, 255, 136, 0.4); }
.tg-amber  { color: #fcd34d; background: rgba(255, 176, 32, 0.13); border-color: rgba(255, 176, 32, 0.42); }
.tg-pink   { color: #f9a8d4; background: rgba(255, 45, 155, 0.13); border-color: rgba(255, 45, 155, 0.42); }
.tg-red    { color: #fca5a5; background: rgba(255, 59, 92, 0.13);  border-color: rgba(255, 59, 92, 0.42); }

/* ---------- CRM: notas ---------- */
.crm-note {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 2px solid var(--neon-amber);
  border-radius: 8px;
  padding: 9px 10px;
}
.crm-note-body { font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.crm-note-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-mute);
}
.crm-note-foot .del { cursor: pointer; }
.crm-note-foot .del:hover { color: var(--neon-red); }

/* ---------- CRM: lembretes ---------- */
.crm-rem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 9px;
  font-size: 11.5px;
}
.crm-rem.late { border-color: rgba(255, 59, 92, 0.45); background: rgba(255, 59, 92, 0.06); }
.crm-rem.done { opacity: 0.45; }
.crm-rem.done .rem-note { text-decoration: line-through; }
.crm-rem .rem-box {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-str);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.crm-rem.done .rem-box { background: var(--neon-lime); border-color: var(--neon-lime); }
.crm-rem .rem-when { font-size: 10px; color: var(--text-mute); margin-top: 2px; }
.crm-rem.late .rem-when { color: var(--neon-red); }
.cp-tags:empty::after, #cp-reminders:empty::after, #cp-notes:empty::after { font-size: 11px; color: var(--text-mute); }
#cp-reminders:empty::after { content: 'Nenhum lembrete'; }
#cp-notes:empty::after { content: 'Nenhuma nota ainda'; }

/* ==========================================================
   CRM — quadro de vendas
   ========================================================== */
.crm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-wrap: wrap;
}
.crm-tabs { display: flex; gap: 4px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.crm-tab {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.crm-tab.active { background: var(--bg-hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-str); }

.crm-board {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  overflow-x: auto;      /* muitas etapas rolam na horizontal, sem espremer */
  align-items: flex-start;
  height: calc(100% - 60px);
}
.crm-pane { padding: 20px; overflow-y: auto; height: calc(100% - 60px); }

.crm-col {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.crm-col.over { border-color: var(--neon-cyan); box-shadow: 0 0 0 1px var(--neon-cyan), var(--glow-cyan); }

.crm-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.crm-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.crm-col-name { font-size: 12.5px; font-weight: 700; flex: 1; min-width: 0; }
.crm-col-n {
  font-size: 10px;
  background: rgba(140, 160, 255, 0.14);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}
.crm-col-sum { font-size: 10px; color: var(--text-mute); padding: 0 14px 8px; }

.crm-cards { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 110px; }
.crm-cards.vazia::after {
  content: 'Arraste um lead para cá';
  display: block;
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
  padding: 18px 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.crm-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: grab;
  transition: border-color 0.15s, transform 0.1s;
}
.crm-card:hover { border-color: var(--border-str); }
.crm-card:active { cursor: grabbing; }
.crm-card.dragging { opacity: 0.4; transform: rotate(1.5deg); }

.crm-card-top { display: flex; align-items: center; gap: 8px; }
.crm-card .conv-avatar { width: 28px; height: 28px; font-size: 11px; flex-shrink: 0; }
.crm-card-name {
  font-size: 12.5px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-card-val { font-size: 12px; font-weight: 700; color: var(--neon-lime); font-variant-numeric: tabular-nums; }
.crm-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-mute);
}
.crm-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.crm-card-tags .crm-tag { font-size: 9px; padding: 2px 6px; }
.crm-card .rem-flag { color: var(--neon-amber); }
.crm-card .rem-flag.late { color: var(--neon-red); }
.crm-card .unread {
  background: var(--neon-cyan);
  color: #05060a;
  border-radius: 20px;
  padding: 1px 6px;
  font-weight: 800;
}

/* Etapas */
.stage-row {
  display: grid;
  grid-template-columns: 1fr 130px 110px auto;
  gap: 8px;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

/* Relatorio */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.rep-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.rep-k { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.05em; }
.rep-v { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.rep-v.dim { color: var(--text-mute); font-size: 20px; }
.rep-d { font-size: 10.5px; color: var(--text-mute); margin-top: 4px; }

.rep-bar-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; margin-bottom: 8px; }
.rep-bar-track { background: var(--bg-input); border-radius: 6px; height: 22px; overflow: hidden; }
.rep-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s; min-width: 2px; }
.rep-bar-label { font-size: 11.5px; color: var(--text-dim); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- CRM: seleção e importação ---------- */
.sel-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(0, 240, 255, 0.06);
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
  flex-wrap: wrap;
}
.sel-n { font-size: 12px; color: var(--text-dim); margin-right: auto; }
.sel-n b { color: var(--neon-cyan); font-size: 14px; }

.crm-card { position: relative; }
.card-pick {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-str);
  border-radius: 4px;
  background: var(--bg-panel);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.crm-card:hover .card-pick, .card-pick.on { opacity: 1; }
.card-pick.on { background: var(--neon-cyan); border-color: var(--neon-cyan); }
.card-pick svg { width: 10px; height: 10px; fill: none; stroke: #05060a; stroke-width: 3.5; }
.crm-card.picked { border-color: var(--neon-cyan); box-shadow: 0 0 0 1px var(--neon-cyan); }

.imp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.imp-stat { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 9px; text-align: center; }
.imp-stat-v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.imp-stat-k { font-size: 9.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.imp-stat.ok .imp-stat-v { color: var(--neon-lime); }
.imp-stat.dup .imp-stat-v { color: var(--neon-amber); }
.imp-stat.bad .imp-stat-v { color: var(--neon-red); }

.imp-table { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.imp-table table { width: 100%; font-size: 11px; border-collapse: collapse; }
.imp-table th { position: sticky; top: 0; background: var(--bg-elev); z-index: 1; }
.imp-table th, .imp-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.imp-row-bad { color: var(--text-mute); }
.imp-badge { font-size: 9px; padding: 1px 6px; border-radius: 20px; white-space: nowrap; }
.imp-badge.ok { background: rgba(57, 255, 136, 0.14); color: var(--neon-lime); }
.imp-badge.dup { background: rgba(255, 176, 32, 0.14); color: var(--neon-amber); }
.imp-badge.bad { background: rgba(255, 59, 92, 0.14); color: var(--neon-red); }

/* Prévia do botão de link (visual do WhatsApp) */
#lk-preview .lk-btn {
  display: block;
  text-align: center;
  margin-top: 8px;
  padding: 9px;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: #53bdeb;
  font-weight: 600;
  font-size: 13px;
}

/* ---------- Botão de mensagens salvas no chat ---------- */
.quick-wrap { position: relative; }
.quick-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border-str);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  z-index: 60;
  overflow: hidden;
}
.quick-pop-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-mute);
  text-transform: uppercase;
  padding: 12px 14px 8px;
}
.quick-pop-list { overflow-y: auto; flex: 1; }
.quick-pop-item {
  padding: 9px 14px;
  cursor: pointer;
  border-top: 1px solid var(--border);
}
.quick-pop-item:hover { background: var(--bg-hover); }
.qp-short { font-size: 11px; color: var(--neon-cyan); font-family: var(--mono); }
.qp-text {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-pop-list:empty::after {
  content: 'Nenhuma mensagem salva ainda';
  display: block;
  padding: 14px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
}
.quick-pop-manage {
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--neon-cyan);
  font: inherit;
  font-size: 12px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
}
.quick-pop-manage:hover { background: var(--bg-hover); }
