:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar: #14172b;
  --sidebar-2: #1d2140;
  --sidebar-txt: #a7adcf;
  --text: #171a2b;
  --dim: #656d84;
  --faint: #949cb3;
  --border: #edeff7;
  --border-forte: #dfe3ef;
  --accent: #4f46e5;
  --accent-suave: #eef0fe;
  --ok: #10b981;
  --alerta: #f59e0b;
  --erro: #ef4444;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(23,26,43,.04);
  --sombra-md: 0 4px 12px rgba(23,26,43,.06);
  --sombra-lg: 0 12px 32px rgba(23,26,43,.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

/* A barra lateral NÃO encosta na borda: o app é uma moldura com dois painéis
   flutuantes. O respiro em volta é o que faz a tela parecer um produto e não
   uma página web dos anos 2000. */
.app {
  display: flex; height: 100vh; padding: 12px; gap: 12px;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 560px at -8% -12%, rgba(124,116,255,.14), transparent 60%),
    radial-gradient(900px 480px at 108% -6%, rgba(14,165,233,.10), transparent 55%);
}

/* ===================== Sidebar ===================== */
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-txt);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 12px; overflow-y: auto;
  border-radius: 20px; border: 1px solid rgba(255,255,255,.07);
  box-shadow: var(--sombra-lg);
  transition: width .16s ease;
}
.nav-marca { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.nav-logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 17px;
  box-shadow: 0 6px 16px var(--accent-sombra); flex-shrink: 0;
}
/* Logotipo escrito: ocupa a linha da marca e dispensa o texto ao lado. No
   modo trilho não cabe — aí volta o selo com a inicial. */
.nav-logo-marca { max-width: 150px; max-height: 34px; object-fit: contain;
  background: #fff; border-radius: 8px; padding: 5px 8px; }
.nav-marca.com-logo .nav-logo,
.nav-marca.com-logo .so-sem-logo { display: none; }
.nav-marca.com-logo.sem-logo .nav-logo,
.nav-marca.com-logo.sem-logo .so-sem-logo { display: block; }
.app.trilho .nav-logo-marca { display: none; }
.app.trilho .nav-marca.com-logo .nav-logo { display: grid; }
.nav-nome { font-weight: 700; font-size: 16px; color: #fff; letter-spacing: -.2px; }
.nav-sub { font-size: 11px; color: #6f77a0; }

.nav-lista { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.nav-secao-tit {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px;
  color: #5a6390; font-weight: 700; padding: 0 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; color: var(--sidebar-txt);
  padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px;
  font-weight: 500; text-align: left; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.ativo { background: var(--accent); color: #fff; font-weight: 600; }
.nav-ico { display: grid; place-items: center; flex-shrink: 0; }
.nav-ico svg { width: 17px; height: 17px; }

.nav-usuario {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-top: 1px solid var(--sidebar-2); margin-top: auto;
}
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.nav-usuario-info { display: flex; flex-direction: column; min-width: 0; }
.nav-usuario-rot { font-size: 10.5px; color: #6f77a0; }
.nav-usuario-nome { font-size: 13px; font-weight: 600; color: #fff; }
#sel-usuario {
  background: transparent; border: none; color: #fff; font-size: 13.5px;
  font-weight: 700; cursor: pointer; padding: 0; margin-left: -2px; max-width: 150px;
}
#sel-usuario:focus { outline: none; }
#sel-usuario option { color: var(--text); }

/* ===================== Conteúdo ===================== */
.conteudo {
  flex: 1; overflow-y: auto; min-width: 0;
  border-radius: 20px; border: 1px solid var(--border); background: var(--bg);
  background-image: radial-gradient(760px 380px at 100% 0%, rgba(124,116,255,.07), transparent 62%);
}
.pagina { padding: 26px 30px; }
.pagina-topo { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.pagina-topo h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.pagina-sub { color: var(--faint); font-size: 13px; }
.carregando { color: var(--faint); padding: 30px 0; }

.cartao {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden;
}

/* Tabela */
.tabela { width: 100%; border-collapse: collapse; }
.tabela th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--dim); font-weight: 700; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.tabela td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.tabela tr:last-child td { border-bottom: none; }
.col-centro { text-align: center; }

.celula-pessoa { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 12.5px; flex-shrink: 0;
}
.pessoa-nome { font-weight: 600; }
.pessoa-email { font-size: 12px; color: var(--faint); }

/* Switch */
.switch { display: inline-flex; cursor: pointer; }
.switch input { display: none; }
.switch-trilho {
  width: 38px; height: 22px; border-radius: 12px; background: var(--border-forte);
  position: relative; transition: background .2s;
}
.switch-bolinha {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--sombra); transition: transform .2s;
}
.switch input:checked + .switch-trilho { background: var(--ok); }
.switch input:checked + .switch-trilho .switch-bolinha { transform: translateX(16px); }

/* Placeholder das fases seguintes */
.placeholder {
  background: var(--surface); border: 1px dashed var(--border-forte);
  border-radius: var(--raio); padding: 60px 30px; text-align: center; color: var(--dim);
}
.placeholder-ico { font-size: 34px; color: var(--accent); opacity: .5; margin-bottom: 12px; }
.placeholder-tit { font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.placeholder-sub { margin: 0 0 14px; font-size: 13.5px; }
.placeholder-tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; background: var(--accent-suave); color: var(--accent);
  padding: 3px 10px; border-radius: 20px;
}

/* Tela de espera / erro */
.tela-vazia { height: 100vh; display: grid; place-content: center; text-align: center; gap: 6px; }
.tela-vazia-ico {
  font-size: 34px; color: #fff; width: 70px; height: 70px; margin: 0 auto 14px;
  border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
}
.tela-vazia-tit { font-size: 20px; font-weight: 700; margin: 0; }
.tela-vazia-sub { color: var(--faint); margin: 0; }

/* Toasts */
.toasts {
  position: fixed; bottom: 22px; right: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--sombra-lg);
  font-size: 13px; max-width: 340px; animation: entra .25s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.aviso { border-left-color: var(--alerta); }
.toast.erro { border-left-color: var(--erro); }
@keyframes entra { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-forte); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== Botões e formulários ===================== */
.btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-forte);
  border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-suave); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px var(--accent-sombra); }
.btn.primario:hover { filter: brightness(1.07); color: #fff; }
.btn.ganho { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.btn.ganho:hover { background: #d1fae5; color: #047857; }
.btn.perda:hover { border-color: var(--alerta); color: #b45309; background: #fffbeb; }
.btn.perigo:hover { border-color: var(--erro); color: var(--erro); background: #fef2f2; }
.btn-icone { background: none; border: none; font-size: 16px; cursor: pointer;
  color: var(--faint); padding: 4px 8px; border-radius: 6px; }
.btn-icone:hover { background: var(--surface-2); color: var(--text); }
.flex-espaco { flex: 1; }

.barra-busca { margin-bottom: 14px; }
.barra-busca input, .campo input, .campo select, .campo textarea {
  width: 100%; border: 1px solid var(--border-forte); border-radius: 9px;
  padding: 9px 12px; font-size: 13.5px; font-family: inherit; background: var(--surface);
  color: var(--text);
}
.barra-busca input { max-width: 380px; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .barra-busca input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-suave);
}
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.campo > span { font-size: 12px; font-weight: 600; color: var(--dim); }
.campo-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.etiqueta { display: inline-block; font-size: 11.5px; font-weight: 600; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; color: var(--dim); }
.vazio { text-align: center; color: var(--faint); padding: 28px !important; }
.avatar.quadrado { border-radius: 9px; }

/* ===================== Funil (kanban) ===================== */
.pagina-funil { display: flex; flex-direction: column; height: 100%; padding-bottom: 0; }
.pagina-topo .btn { margin-left: auto; }

.resumo-linha { display: flex; gap: 22px; padding: 14px 18px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio);
  box-shadow: var(--sombra); overflow-x: auto; }
.resumo-item { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.resumo-num { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.resumo-rot { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.resumo-item.destaque .resumo-num { color: var(--alerta); }

.kanban { display: flex; gap: 14px; overflow-x: auto; flex: 1; padding-bottom: 22px; align-items: flex-start; }
.col { flex: 0 0 272px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--raio); display: flex; flex-direction: column; max-height: 100%; }
.col-topo { padding: 12px 14px 10px; border-top: 2px solid var(--accent);
  border-radius: var(--raio) var(--raio) 0 0; background: var(--surface); }
.col-tit { display: flex; align-items: center; gap: 8px; }
.col-nome { font-weight: 700; font-size: 13.5px; }
.col-qtd { font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--dim);
  border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; }
.col-soma { font-size: 12px; color: var(--dim); margin-top: 3px; }
.col-cards { padding: 10px; display: flex; flex-direction: column; gap: 9px;
  overflow-y: auto; flex: 1; min-height: 90px; transition: background .15s; }
.col-cards.sobre { background: rgba(79,70,229,.06); }
.col-vazia { color: var(--faint); font-size: 12.5px; text-align: center; padding: 22px 8px;
  border: 1px dashed var(--border-forte); border-radius: 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 12px; cursor: grab; box-shadow: var(--sombra); transition: box-shadow .15s, transform .05s; }
.card:hover { box-shadow: var(--sombra-md); }
.card:active { cursor: grabbing; }
.card.arrastando { opacity: .4; transform: rotate(1.5deg); }
.card.na-fila { border-left: 2px solid var(--alerta); }
.card-titulo { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.card-empresa { font-size: 12px; color: var(--dim); margin-top: 3px; }
.card-valor { font-size: 15px; font-weight: 700; margin-top: 7px; letter-spacing: -.3px; }
.card-rodape { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 9px; }
.card-dono { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  color: var(--dim); font-weight: 600; }
.card-avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 9px; font-weight: 700; }
.card-prazo { font-size: 11.5px; color: var(--faint); }
.card-prazo.atrasado { color: var(--erro); font-weight: 700; }
.btn-assumir { background: var(--alerta); color: #fff; border: none; border-radius: 7px;
  padding: 4px 11px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.btn-assumir:hover { filter: brightness(1.07); }
.btn-assumir:disabled { opacity: .6; cursor: wait; }
.marca-solta { height: 2px; background: var(--accent); border-radius: 2px; margin: 2px 0;
  box-shadow: 0 0 6px var(--accent-sombra); }

/* ===================== Modal ===================== */
.modal-fundo { position: fixed; inset: 0; background: rgba(15,18,32,.55); z-index: 60;
  display: grid; place-items: center; padding: 20px; animation: aparece .15s ease; }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 16px; width: min(620px, 100%);
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--sombra-lg); }
.modal-estreito { width: min(520px, 100%); }
.modal-topo { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-topo h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.modal-corpo { padding: 18px 20px; overflow-y: auto; }
.modal-rodape { display: flex; align-items: center; gap: 9px; padding: 14px 20px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 16px 16px; }
.dono-linha { display: flex; gap: 9px; }
.dono-linha select { flex: 1; }
.modal-acoes-fechamento { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding-top: 14px; margin-top: 4px; border-top: 1px dashed var(--border-forte); }
.perder-bloco { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.perder-bloco select { flex: 1; border: 1px solid var(--border-forte); border-radius: 9px;
  padding: 8px 11px; font-size: 13px; font-family: inherit; background: var(--surface); }

/* ===================== Inbox do WhatsApp ===================== */
.pagina-inbox { display: flex; flex-direction: column; height: 100%; padding-bottom: 0; }
.inbox-metricas { display: flex; gap: 16px; font-size: 12.5px; color: var(--dim); margin-left: 4px; }
.inbox-metricas b { color: var(--text); font-size: 14px; }
.inbox-metricas .alerta b { color: var(--alerta); }

.wa-selo { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  font-weight: 600; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 11px; white-space: nowrap; }
.wa-selo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--alerta); }
.wa-selo.ok .wa-selo-dot { background: var(--ok); box-shadow: 0 0 7px rgba(16,185,129,.7); }
.wa-selo.off .wa-selo-dot { background: var(--erro); box-shadow: 0 0 7px rgba(239,68,68,.6); }

.wa { flex: 1; display: grid; grid-template-columns: 340px 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: var(--raio); overflow: hidden;
  background: var(--surface); box-shadow: var(--sombra); min-height: 0; margin-bottom: 22px; }

.wa-lista { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.wa-filtros { display: flex; gap: 6px; padding: 12px 12px 8px; }
.filtro { background: var(--surface-2); color: var(--dim); border: none; border-radius: 16px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.filtro:hover { background: #eef1f5; }
.filtro.ativo { background: var(--accent-suave); color: var(--accent); }
.wa-busca { padding: 0 12px 10px; }
.wa-busca input { width: 100%; border: none; background: var(--surface-2); border-radius: 9px;
  padding: 9px 13px; font-size: 13px; font-family: inherit; }
.wa-busca input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-suave); }

.wa-conversas { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.wa-vazio { padding: 30px 16px; text-align: center; color: var(--faint); font-size: 13px; }
.wa-conv { display: flex; gap: 11px; padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .12s; }
.wa-conv:hover { background: var(--surface-2); }
.wa-conv.ativa { background: var(--accent-suave); }
.wa-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: grid;
  place-items: center; color: #fff; font-weight: 700; font-size: 15px; object-fit: cover;
  text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.wa-avatar.grande { width: 42px; height: 42px; }
.wa-conv-main { flex: 1; min-width: 0; }
.wa-conv-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wa-conv-nome { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-conv-hora { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.wa-conv-previa { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 2px; }
.wa-conv-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.chip-dono { font-size: 10.5px; font-weight: 600; color: #fff; border-radius: 20px;
  padding: 2px 8px; }
.chip-fila { font-size: 10.5px; font-weight: 700; color: #b26a00; background: #fff3e0;
  border: 1px solid #ffd699; border-radius: 20px; padding: 1px 8px; }
.tag-fechada { font-size: 10px; color: var(--faint); background: var(--surface-2);
  border-radius: 4px; padding: 1px 6px; font-weight: 600; }
.tag-grupo { font-size: 10px; color: #1a6ea8; background: #e3f2fd; border-radius: 4px;
  padding: 1px 6px; font-weight: 600; }
.tag-negocio { font-size: 10px; color: var(--accent); background: var(--accent-suave);
  border-radius: 4px; padding: 1px 6px; font-weight: 700; }
.badge { min-width: 19px; height: 19px; border-radius: 10px; background: #25d366; color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-left: auto; padding: 0 5px; }

/* Chat */
.wa-chat { display: flex; flex-direction: column; min-height: 0;
  background-color: #eae6df;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 22px 22px; }
.wa-splash { margin: auto; text-align: center; color: var(--dim); max-width: 400px; padding: 20px; }
.wa-splash-logo { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 32px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--sombra-md); }
.wa-splash-tit { font-size: 19px; font-weight: 300; color: #41525d; margin: 0 0 8px; }
.wa-splash-sub { font-size: 13px; color: var(--faint); line-height: 1.6; margin: 0; }

.wa-chat-topo { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.wa-chat-info { flex: 1; min-width: 0; }
.wa-chat-nome { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.wa-chat-sub { font-size: 12.5px; color: var(--dim); margin-top: 1px; display: flex; align-items: center; gap: 6px; }
.ponto { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.wa-chat-acoes { display: flex; gap: 7px; align-items: center; }
.btn.icone { padding: 7px 10px; font-size: 15px; line-height: 1; }
.btn.icone.girando { animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.btn.pequeno { padding: 5px 11px; font-size: 12px; }

/* Faixa do CRM dentro da conversa */
.crm-faixa { display: flex; align-items: center; gap: 9px; padding: 9px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12.5px;
  color: var(--dim); flex-shrink: 0; }
.crm-faixa.ok { background: #f5f3ff; }
.crm-ico { color: var(--accent); font-size: 13px; }

.wa-mensagens { flex: 1; overflow-y: auto; padding: 20px 7%; display: flex;
  flex-direction: column; gap: 4px; }
.wa-sem-msg { align-self: center; color: var(--dim); font-size: 12.5px; background: #fff;
  padding: 7px 14px; border-radius: 8px; margin-top: 20px; box-shadow: var(--sombra); }
.bolha { position: relative; max-width: 66%; padding: 7px 11px 8px; border-radius: 9px;
  font-size: 14px; line-height: 1.42; box-shadow: 0 1px 1px rgba(0,0,0,.13); margin-top: 6px; }
.bolha.entrada { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.bolha.entrada::before { content: ""; position: absolute; top: 0; left: -8px; width: 0; height: 0;
  border: 8px solid transparent; border-top-color: #fff; border-right: 0; }
.bolha.saida { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 0; }
.bolha.saida::before { content: ""; position: absolute; top: 0; right: -8px; width: 0; height: 0;
  border: 8px solid transparent; border-top-color: #d9fdd3; border-left: 0; }
.bolha.saida.falhou { background: #fff1f0; }
.bolha.saida.falhou::before { border-top-color: #fff1f0; }
.bolha-autor { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.bolha-autor.entrada { color: #d9376e; }
.bolha-meta { font-size: 10.5px; margin-top: 3px; color: var(--faint); text-align: right;
  display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.checks { color: #53bdeb; font-size: 12px; letter-spacing: -2px; }
.checks.falhou { color: var(--erro); font-weight: 700; letter-spacing: 0; }
.bolha-erro { font-size: 11.5px; color: #b3261e; background: #ffe3e0; border-radius: 6px;
  padding: 5px 8px; margin-top: 5px; line-height: 1.35; }
.bolha-img { max-width: 100%; max-height: 300px; border-radius: 6px; display: block; margin-bottom: 4px; }
.bolha-audio { width: 250px; max-width: 100%; margin: 2px 0 4px; }
.bolha-video { max-width: 100%; max-height: 300px; border-radius: 6px; display: block; margin-bottom: 4px; }
.bolha-doc { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.05);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 4px; text-decoration: none;
  color: inherit; font-size: 13px; font-weight: 600; }

.wa-composer { padding: 10px 16px 12px; background: var(--surface-2); flex-shrink: 0; }
.wa-aviso { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 8px;
  font-size: 12.5px; margin-bottom: 9px; }
.wa-aviso.warn { background: #fff3e0; color: #b26a00; border: 1px solid #ffd699; }
.wa-aviso.info { background: var(--accent-suave); color: var(--accent); border: 1px solid #d5d7fb; }
.wa-aviso.ok { background: #e7f4e8; color: #1a7f37; border: 1px solid #b5dfb9; }
.wa-composer-linha { display: flex; gap: 10px; align-items: flex-end; }
.wa-composer textarea { flex: 1; resize: none; background: #fff; border: none; border-radius: 22px;
  padding: 12px 18px; font-size: 14px; font-family: inherit; max-height: 110px; min-height: 44px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wa-composer textarea:focus { outline: none; }
.wa-enviar { display: grid; place-items: center; background: #008069; color: #fff; border: none;
  border-radius: 50%; width: 44px; height: 44px; cursor: pointer; flex-shrink: 0; }
.wa-enviar svg { width: 19px; height: 19px; }
.wa-enviar:disabled { opacity: .4; cursor: not-allowed; }
.wa-dica { font-size: 11.5px; color: var(--faint); margin-top: 7px; }
.modal-nota { font-size: 12.5px; color: var(--dim); margin: 0 0 14px; }

/* ===================== Configurações / roleta ===================== */
.secao { padding: 20px 22px; margin-bottom: 16px; }
.secao-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.secao-tit { margin: 0 0 5px; font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.secao-sub { margin: 0 0 14px; font-size: 13px; color: var(--dim); line-height: 1.5; max-width: 640px; }
.switch.grande .switch-trilho { width: 46px; height: 26px; }
.switch.grande .switch-bolinha { width: 22px; height: 22px; }
.switch.grande input:checked + .switch-trilho .switch-bolinha { transform: translateX(20px); }

.modos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 16px; }
.modos.desligado, .escopo.desligado { opacity: .45; pointer-events: none; }
.modo { border: 1px solid var(--border-forte); border-radius: 12px; padding: 13px 15px;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all .15s; }
.modo:hover { border-color: var(--accent); }
.modo.escolhido { border-color: var(--accent); background: var(--accent-suave); }
.modo input { display: none; }
.modo-tit { font-weight: 700; font-size: 14px; }
.modo-desc { font-size: 12.5px; color: var(--dim); line-height: 1.45; }

.escopo { display: flex; gap: 22px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--dim); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.carga-lista { display: flex; flex-direction: column; gap: 9px; }
.carga-item { display: flex; align-items: center; gap: 11px; }
.avatar.pequeno { width: 28px; height: 28px; font-size: 10.5px; }
.carga-nome { width: 130px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.carga-trilho { flex: 1; height: 9px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; overflow: hidden; }
.carga-preenche { display: block; height: 100%; border-radius: 5px; transition: width .5s ease; }
.carga-num { width: 26px; text-align: right; font-weight: 700; font-size: 14px; }
.carga-recebidos { width: 96px; text-align: right; font-size: 11.5px; color: var(--faint); }
.vazio-inline { color: var(--faint); font-size: 13px; margin: 4px 0 0; }
.col-fraca { color: var(--faint); font-size: 12.5px; }

/* ===================== Abas do modal, itens e timeline ===================== */
.abas { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.aba { background: none; border: none; border-bottom: 1.5px solid transparent; padding: 11px 14px;
  font-size: 13.5px; font-weight: 600; color: var(--dim); cursor: pointer; margin-bottom: -1px; }
.aba:hover { color: var(--text); }
.aba.ativa { color: var(--accent); border-bottom-color: var(--accent); }

.campo-dica { font-size: 11.5px; color: var(--faint); }
.col-direita { text-align: right; }
.col-check { width: 42px; text-align: center; }
.col-check input { width: 16px; height: 16px; accent-color: var(--ok); cursor: pointer; }
.valor-forte { font-weight: 700; }
.sku { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 7px; color: var(--dim); }
.tabela.compacta th, .tabela.compacta td { padding: 8px 10px; font-size: 13px; }
.tabela tfoot td { padding: 10px; border-top: 1px solid var(--border-forte); }
tr.concluida .ativ-titulo { text-decoration: line-through; color: var(--faint); }
.ativ-titulo { font-weight: 600; }
.prazo-atrasado { color: var(--erro); font-weight: 700; font-size: 12.5px; }

.add-item { display: grid; grid-template-columns: 1fr 70px 70px auto; gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-forte); }
.add-item select, .add-item input { border: 1px solid var(--border-forte); border-radius: 9px;
  padding: 8px 11px; font-size: 13px; font-family: inherit; background: var(--surface); }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; flex-shrink: 0; }
.tl-item.tl-marco .tl-ico { background: var(--accent-suave); border-color: #d5d7fb; }
.tl-item.tl-mensagem .tl-ico { background: #e7f7ef; border-color: #b7ead4; }
.tl-corpo { flex: 1; min-width: 0; }
.tl-texto { font-size: 13.5px; line-height: 1.4; }
.tl-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ===================== Campos personalizados e etiquetas ===================== */
.etiq { display: inline-flex; align-items: center; gap: 5px; color: #fff; font-size: 11.5px;
  font-weight: 600; border-radius: 20px; padding: 3px 10px; }
.etiq.mini { font-size: 10px; padding: 1px 8px; font-weight: 600; }
/* No kanban, cada card com um chip preenchido vira um quadro de confete. O
   mesmo dado, lavado: fundo translúcido e o texto na cor cheia. A mistura vem
   pronta do JS (`corSuave`) — ver o comentário lá. */
.etiq.mini.lavada { border: 1px solid transparent; font-weight: 600; }
.etiq-x { background: none; border: none; color: rgba(255,255,255,.85); cursor: pointer;
  font-size: 10px; padding: 0 0 0 2px; line-height: 1; }
.etiq-x:hover { color: #fff; }
.etiquetas-lista { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.etiquetas-campo { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.etiq-add { border: 1px dashed var(--border-forte); border-radius: 20px; padding: 3px 10px;
  font-size: 11.5px; font-family: inherit; background: var(--surface); color: var(--dim);
  cursor: pointer; }
.card-etiquetas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }

.add-campo { display: grid; grid-template-columns: 1.4fr 120px 120px 1.4fr auto; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-forte); }
.add-etiqueta { display: grid; grid-template-columns: 1fr 52px auto; gap: 8px;
  margin-top: 4px; max-width: 460px; }
.add-campo input, .add-campo select, .add-etiqueta input {
  border: 1px solid var(--border-forte); border-radius: 9px; padding: 8px 11px;
  font-size: 13px; font-family: inherit; background: var(--surface); }
.add-etiqueta input[type="color"] { padding: 3px; height: 36px; cursor: pointer; }
.obrig { font-size: 10px; font-weight: 700; color: var(--alerta); background: #fff7ed;
  border-radius: 4px; padding: 1px 6px; }

.campos-custom { border-top: 1px dashed var(--border-forte); padding-top: 14px; margin-top: 4px; }
.campos-custom-tit { font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--dim); margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   Fase 7 — IA no card e importação por planilha
   -------------------------------------------------------------------------- */

/* Etiqueta de estado usada na prévia da importação e na confiança da IA. */
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; border-radius: 5px; padding: 2px 7px;
  background: var(--surface-2); color: var(--dim); }
.tag.ok    { background: #e7f7f0; color: #08795a; }
.tag.aviso { background: #fef3e0; color: #a35a06; }
.tag.erro  { background: #fdeaea; color: #b42318; }
.tag.fraca { background: var(--surface-2); color: var(--faint); }

.aviso-bloco { background: #fef3e0; border: 1px solid #f6d9a8; color: #8a4d05;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 12px 0 0; }

/* ------------------------------------------------------------------- IA */
.ia-caixa { border: 1px dashed var(--border-forte); border-radius: 12px;
  padding: 12px; margin-bottom: 16px; background: var(--surface-2); }
.ia-topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.ia { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  border-color: transparent; font-weight: 600; }
.btn.ia:hover:not(:disabled) { filter: brightness(1.06); }
.btn.ia:disabled { background: var(--border-forte); color: var(--faint); }

.ia-painel { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
/* `display: flex` ganha de [hidden] por especificidade — sem esta linha o
   painel nasce aberto mesmo com o atributo. */
.ia-painel[hidden] { display: none; }
.ia-painel textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px;
  border: 1px solid var(--border-forte); background: var(--surface); resize: vertical; }
.ia-acoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ia-sugestao { border: 1px solid var(--accent-suave); background: var(--surface);
  border-radius: 12px; padding: 12px; }
.ia-sug-topo { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; }
.ia-lista { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 0 0 10px; }
.ia-lista > div { display: flex; gap: 6px; min-width: 0; }
.ia-lista dt { font-size: 12px; color: var(--dim); white-space: nowrap; }
.ia-lista dd { margin: 0; font-size: 13px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; }
.ia-resumo { font-size: 13px; color: var(--dim); line-height: 1.5;
  border-top: 1px solid var(--border); padding-top: 10px; margin: 0 0 10px; }

/* ----------------------------------------------------------- Importação */
.import-topo { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 10px; }
.import-topo .campo { min-width: 200px; }
.import-arquivo input[type="file"] { font: inherit; padding: 8px;
  border: 1px dashed var(--border-forte); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; }

.mapa-colunas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px; margin-top: 12px; }
.mapa-item { display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.mapa-coluna { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapa-item select { flex: 1; min-width: 0; }

.import-acoes { display: flex; align-items: center; gap: 12px; margin-top: 14px;
  flex-wrap: wrap; }

/* A linha com problema salta aos olhos na prévia — é ela que precisa de ação. */
tr.linha-erro td { background: #fdf3f3; }
tr.linha-ignorar td { opacity: .6; }

/* --------------------------------------------------------------------------
   Fase 8 — Relatórios e metas
   -------------------------------------------------------------------------- */

.periodo-chips { display: flex; gap: 6px; margin-left: auto; }
.chip { border: 1px solid var(--border-forte); background: var(--surface);
  color: var(--dim); border-radius: 999px; padding: 5px 12px; font: inherit;
  font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.ativo { background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600; }

/* Os cinco números que respondem "como estamos". */
.cartoes-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio);
  box-shadow: var(--sombra); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  border-top: 2px solid var(--accent); }
.kpi.ok { border-top-color: var(--ok); }
.kpi.erro { border-top-color: var(--erro); }
.kpi-num { font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.kpi-rot { font-size: 12px; font-weight: 600; color: var(--dim); }
.kpi-nota { font-size: 11.5px; color: var(--faint); }

/* ------------------------------------------------------------------ Metas */
.meta-geral { display: flex; align-items: center; gap: 14px; margin: 6px 0 2px; }
.meta-num { display: flex; align-items: baseline; gap: 6px; min-width: 190px; }
.meta-num b { font-size: 22px; letter-spacing: -.3px; }
.meta-num span { font-size: 12.5px; color: var(--dim); }
.barra-meta { flex: 1; height: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.barra-meta > span { display: block; height: 100%; background: var(--accent);
  border-radius: 999px; transition: width .3s ease; }
.barra-meta.pequena { height: 8px; }
.meta-pct { font-size: 13px; font-weight: 700; min-width: 58px; text-align: right;
  color: var(--accent); }
.meta-pct.ok { color: var(--ok); }
.meta-pct.baixo { color: var(--alerta); }

.metas-pessoas { display: flex; flex-direction: column; gap: 8px; margin-top: 14px;
  border-top: 1px solid var(--border); padding-top: 14px; }
.meta-pessoa { display: flex; align-items: center; gap: 10px; }
.meta-nome { min-width: 130px; font-size: 13px; font-weight: 600; }
.meta-valores { font-size: 12px; color: var(--dim); min-width: 170px; text-align: right; }
.metas-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px;
  border-top: 1px solid var(--border); padding-top: 12px; }
.metas-form .campo > span { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------- Previsto x realizado */
.grafico-meses { display: flex; align-items: flex-end; gap: 14px; height: 180px;
  padding: 10px 4px 0; }
.gm-col { flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 4px; height: 100%; }
/* As duas barras se sobrepõem: a meta é o trilho, o realizado é o preenchimento.
   Lado a lado, o olho compara alturas; sobrepostas, ele vê a diferença. */
.gm-barras { position: relative; flex: 1; width: 100%; max-width: 46px;
  display: flex; align-items: flex-end; justify-content: center; }
.gm-meta { position: absolute; bottom: 0; width: 100%; background: var(--surface-2);
  border: 1px dashed var(--border-forte); border-radius: 6px 6px 0 0; }
.gm-real { position: relative; width: 62%; background: var(--accent);
  border-radius: 6px 6px 0 0; min-height: 2px; transition: height .3s ease; }
.gm-real.bateu { background: var(--ok); }
.gm-valor { font-size: 11.5px; font-weight: 700; }
.gm-rot { font-size: 11px; color: var(--faint); }

.legenda { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px; }
.ponto.meta { background: var(--surface-2); border: 1px dashed var(--border-forte); }
.ponto.real { background: var(--accent); }
.ponto.bateu { background: var(--ok); }

/* --------------------------------------------------- Barras dentro da tabela */
.mini-barra { height: 6px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; margin-bottom: 3px; min-width: 60px; }
.mini-barra > span { display: block; height: 100%; background: var(--accent);
  border-radius: 999px; }
.mini-barra > span.perda { background: var(--erro); }
.ponto-cor { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: 0; }
.num-perda { color: var(--erro); font-weight: 700; }
.pos { font-size: 12px; font-weight: 700; color: var(--faint); min-width: 14px; }

/* --------------------------------------------------------------------------
   Fase 9 — Lista de negócios
   -------------------------------------------------------------------------- */

.filtros-barra { display: flex; gap: 10px; align-items: center; padding: 12px 14px;
  margin-bottom: 14px; flex-wrap: wrap; }
.filtros-barra .busca { flex: 1; min-width: 220px; }
.filtros-barra select { min-width: 150px; }

.tabela.clicavel tbody tr { cursor: pointer; }
.tabela.clicavel tbody tr:hover { background: var(--accent-suave); }
.cel-titulo { font-weight: 600; }

.ordenavel { cursor: pointer; user-select: none; white-space: nowrap; }
.ordenavel:hover { color: var(--accent); }
.seta { font-size: 10px; color: var(--accent); }

/* Pílula do estágio: a cor vem por variável para a mesma regra servir aos 5. */
.pilula { display: inline-block; font-size: 11.5px; font-weight: 600;
  border-radius: 999px; padding: 3px 10px; color: var(--c, var(--dim));
  background: color-mix(in srgb, var(--c, #999) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, #999) 30%, transparent); }
.pilula.ganho { color: #08795a; background: #e7f7f0; border-color: #b6e6d4; }
.pilula.perdido { color: #b42318; background: #fdeaea; border-color: #f6c9c6; }

.alerta-txt { color: var(--alerta); }

/* ===================== Sino, notificações e menções ===================== */
.nav-sino { margin-left: auto; }
.sino {
  position: relative; background: transparent; border: none; color: var(--sidebar-txt);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; transition: background .12s, color .12s;
}
.sino:hover { background: var(--sidebar-2); color: #fff; }
.sino svg { width: 19px; height: 19px; }
.sino.tem-novidade { color: #fff; }
.sino-badge {
  position: absolute; top: -1px; right: -1px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: var(--erro); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  border: 1.5px solid var(--sidebar);
}

/* O painel fica fora do fluxo: trocar de rota não pode fechá-lo. */
.notif-painel {
  position: fixed; top: 14px; left: 250px; width: 390px; max-height: 78vh;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio);
  box-shadow: var(--sombra-lg); z-index: 60; display: flex; flex-direction: column;
  overflow: hidden;
}
/* `display: flex` ganha do [hidden] do navegador — sem esta linha o painel
   fecha por dentro (hidden=true) e continua na tela. */
.notif-painel[hidden] { display: none; }
.notif-topo { display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); }
.notif-filtros { display: flex; gap: 6px; padding: 10px 12px 6px; }
.btn-texto { background: none; border: none; color: var(--accent); font: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.btn-texto:disabled { color: var(--faint); cursor: default; }

.notif-lista { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.notif { display: flex; gap: 11px; align-items: flex-start; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.notif:hover { background: var(--surface-2); }
.notif.nova { background: var(--accent-suave); }
.notif.nova:hover { background: #e6e9fd; }
.notif-ico { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--dim); }
.notif-ico.prazo { background: #fef3e2; color: #b45309; }
.notif-corpo { min-width: 0; flex: 1; }
.notif-titulo { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-texto { font-size: 12.5px; color: var(--dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-meta { font-size: 11px; color: var(--faint); margin-top: 3px; }
.notif-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  flex-shrink: 0; margin-top: 6px; }
.notif-vazio { padding: 32px 16px; text-align: center; color: var(--faint); font-size: 13px; }

/* Chips de menção (no comentário, na tarefa, em qualquer texto renderizado) */
.mencao { display: inline; font-weight: 600; color: var(--accent);
  background: var(--accent-suave); border-radius: 5px; padding: 1px 4px; }
.mencao.ref { border: none; font: inherit; font-weight: 600; cursor: pointer;
  color: #0369a1; background: #e0f2fe; }
.mencao.ref:hover { background: #bae6fd; }

.mencao-popup {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 70;
  background: var(--surface); border: 1px solid var(--border-forte);
  border-radius: 11px; box-shadow: var(--sombra-lg); overflow: hidden; max-height: 232px;
  overflow-y: auto;
}
.mencao-item { display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; padding: 8px 11px; cursor: pointer; text-align: left;
  font: inherit; }
.mencao-item:hover, .mencao-item.ativo { background: var(--accent-suave); }
.mencao-ico { width: 28px; height: 28px; border-radius: 50%; display: grid;
  place-items: center; background: #e0f2fe; color: #0369a1; font-weight: 700;
  font-size: 13px; flex-shrink: 0; }
.mencao-nome { font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.mencao-detalhe { margin-left: auto; font-size: 11.5px; color: var(--faint); flex-shrink: 0; }

/* ===================== Comentários ===================== */
.coment-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.coment-seguidores { display: flex; align-items: center; flex-wrap: wrap; }
.coment-seguidores .avatar { margin-right: -7px; border: 1.5px solid var(--surface); }

.coment-lista { list-style: none; margin: 0 0 16px; padding: 0;
  display: flex; flex-direction: column; gap: 14px; }
.coment { display: flex; gap: 11px; }
.coment.resolvido .coment-texto { color: var(--faint); text-decoration: line-through; }
.coment-corpo { flex: 1; min-width: 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; }
.coment-cab { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.coment-quando { color: var(--faint); font-size: 11.5px; }
.coment-texto { font-size: 13.5px; line-height: 1.5; margin-top: 3px; word-break: break-word; }

.coment-escrever { display: flex; gap: 11px; align-items: flex-start; }
.coment-campo { flex: 1; position: relative; }
.coment-campo textarea { width: 100%; font: inherit; font-size: 13.5px; padding: 10px 12px;
  border: 1px solid var(--border-forte); border-radius: 11px; resize: vertical;
  background: var(--surface); }
.coment-campo textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-suave); }
.coment-acoes { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.coment-acoes .campo-dica { margin-right: auto; }

.card-coment { font-size: 11.5px; color: var(--faint); font-weight: 600; }

/* ===================== Tema escuro ===================== */
/* O tema é um atributo no <html> (`data-tema="escuro"`), escrito por um script
   inline no <head> ANTES do CSS pintar: assim quem usa escuro não leva um
   flash branco na cara a cada carregamento.

   Quase tudo vira sozinho porque as telas usam os tokens. O que está abaixo do
   bloco de tokens é a lista do que tinha cor fixa — em geral cores emprestadas
   do WhatsApp, que no escuro precisam de outra versão, não de um filtro. */
:root[data-tema="escuro"] {
  --bg: #0e1016;
  --surface: #171a24;
  --surface-2: #1e2230;
  --sidebar: #0a0c12;
  --sidebar-2: #1a1f2e;
  --sidebar-txt: #99a1c0;
  --text: #e8eaf2;
  --dim: #a3abc0;
  --faint: #7a8299;
  --border: #212634;
  --border-forte: #2c3243;
  --accent: #7c74ff;
  --accent-2: #5f57d6;
  --accent-suave: #23254a;
  --accent-sombra: rgba(124,116,255,.32);
  --sombra: 0 1px 2px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.4);
  --sombra-md: 0 4px 14px rgba(0,0,0,.5);
  --sombra-lg: 0 14px 36px rgba(0,0,0,.6);
  color-scheme: dark;
}

:root[data-tema="escuro"] .nav-sub,
:root[data-tema="escuro"] .nav-usuario-rot,
:root[data-tema="escuro"] .nav-secao-tit { color: #6c7596; }
:root[data-tema="escuro"] .filtro:hover { background: #262c3d; }

:root[data-tema="escuro"] .btn.ganho { background: #10281f; border-color: #1c4a38; color: #34d399; }
:root[data-tema="escuro"] .btn.ganho:hover { background: #16362a; color: #4ade80; }
:root[data-tema="escuro"] .btn.perda:hover { background: #2b2113; color: #fbbf24; }
:root[data-tema="escuro"] .btn.perigo:hover { background: #2c1618; color: #f87171; }

:root[data-tema="escuro"] .tag.ok, :root[data-tema="escuro"] .pilula.ganho {
  background: #10281f; color: #34d399; border-color: #1c4a38; }
:root[data-tema="escuro"] .tag.aviso { background: #2b2113; color: #fbbf24; }
:root[data-tema="escuro"] .tag.erro, :root[data-tema="escuro"] .pilula.perdido {
  background: #2c1618; color: #f87171; border-color: #4c2226; }
:root[data-tema="escuro"] .aviso-bloco { background: #2b2113; border-color: #4a3a1a; color: #fbbf24; }
:root[data-tema="escuro"] tr.linha-erro td { background: #2c1618; }
:root[data-tema="escuro"] .chip-fila { background: #2b2113; color: #fbbf24; border-color: #4a3a1a; }
:root[data-tema="escuro"] .tag-grupo { background: #16283a; color: #7dd3fc; }

/* Notificações, menções e comentários */
:root[data-tema="escuro"] .sino-badge { border-color: var(--sidebar); }
:root[data-tema="escuro"] .notif.nova:hover { background: #2a2c55; }
:root[data-tema="escuro"] .notif-ico.prazo { background: #2b2113; color: #fbbf24; }
:root[data-tema="escuro"] .mencao.ref { background: #16283a; color: #7dd3fc; }
:root[data-tema="escuro"] .mencao.ref:hover { background: #1d3853; }
:root[data-tema="escuro"] .mencao-ico { background: #16283a; color: #7dd3fc; }

/* Timeline e etiquetas */
:root[data-tema="escuro"] .tl-item.tl-marco .tl-ico { border-color: #33356b; }
:root[data-tema="escuro"] .tl-item.tl-mensagem .tl-ico { background: #10281f; border-color: #1c4a38; }
:root[data-tema="escuro"] .crm-faixa.ok { background: #1d1f3a; }

/* Chat do WhatsApp: o papel de parede e as bolhas têm cor própria, não token */
:root[data-tema="escuro"] .wa-chat {
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
}
:root[data-tema="escuro"] .wa-splash-tit { color: #cbd5e1; }
:root[data-tema="escuro"] .wa-sem-msg { background: var(--surface-2); }
:root[data-tema="escuro"] .bolha.entrada { background: #202c33; }
:root[data-tema="escuro"] .bolha.entrada::before { border-top-color: #202c33; }
:root[data-tema="escuro"] .bolha.saida { background: #005c4b; }
:root[data-tema="escuro"] .bolha.saida::before { border-top-color: #005c4b; }
:root[data-tema="escuro"] .bolha.saida.falhou { background: #4a1d1d; }
:root[data-tema="escuro"] .bolha.saida.falhou::before { border-top-color: #4a1d1d; }
:root[data-tema="escuro"] .bolha-autor.entrada { color: #f472b6; }
:root[data-tema="escuro"] .bolha-erro { background: #4a1d1d; color: #fca5a5; }
:root[data-tema="escuro"] .bolha-doc { background: rgba(255,255,255,.07); }
:root[data-tema="escuro"] .wa-composer textarea { background: var(--surface-2); color: var(--text); }
:root[data-tema="escuro"] .wa-aviso.warn { background: #2b2113; color: #fbbf24; border-color: #4a3a1a; }
:root[data-tema="escuro"] .wa-aviso.ok { background: #10281f; color: #34d399; border-color: #1c4a38; }
:root[data-tema="escuro"] .wa-aviso.info { border-color: #33356b; }

/* Botão de tema, ao lado do sino */
.nav-tema {
  background: transparent; border: none; color: var(--sidebar-txt); cursor: pointer;
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font-size: 15px; transition: background .12s, color .12s;
}
.nav-tema:hover { background: var(--sidebar-2); color: #fff; }
.nav-acoes { margin-left: auto; display: flex; align-items: center; gap: 2px; }

/* ===================== Barra lateral: modo trilho e barra de ações ===================== */
.nav-marca { padding: 2px 6px 0; }
.nav-marca-txt { min-width: 0; }
.nav-barra {
  display: flex; align-items: center; gap: 2px; padding: 0 4px;
  border-bottom: 1px solid var(--sidebar-2); padding-bottom: 10px;
}
.nav-recolher {
  background: transparent; border: none; color: var(--sidebar-txt); cursor: pointer;
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  margin-left: auto; transition: background .12s, color .12s;
}
.nav-recolher:hover { background: var(--sidebar-2); color: #fff; }
.nav-recolher svg { width: 17px; height: 17px; transition: transform .16s ease; }

/* Item ativo ganha um traço luminoso à esquerda — o "você está aqui" que não
   depende só da cor de fundo. */
.nav-item { position: relative; }
.nav-item.ativo::before {
  content: ""; position: absolute; left: -5px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 18px; border-radius: 2px; background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,.5);
}

.app.trilho .sidebar { width: 68px; padding: 14px 8px; align-items: center; }
.app.trilho .nav-marca { justify-content: center; padding: 2px 0 0; }
.app.trilho .nav-marca-txt,
.app.trilho .nav-txt,
.app.trilho .nav-secao-tit,
.app.trilho .nav-usuario-info { display: none; }
.app.trilho .nav-barra { flex-direction: column; gap: 4px; width: 100%; }
.app.trilho .nav-recolher { margin-left: 0; }
.app.trilho .nav-recolher svg { transform: rotate(180deg); }
.app.trilho .nav-item { justify-content: center; padding: 10px; }
.app.trilho .nav-item.ativo::before { left: -4px; }
.app.trilho .nav-secao { width: 100%; }
.app.trilho .nav-usuario { justify-content: center; padding: 10px 0; }
.app.trilho .notif-painel { left: 92px; }

/* ===================== Visão geral ===================== */
.pagina-visao { display: flex; flex-direction: column; gap: 18px; }
.visao-topo { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.visao-ola h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.visao-sub { margin: 4px 0 0; font-size: 13px; color: var(--dim); }
.visao-sub::first-letter { text-transform: uppercase; }
.visao-acoes { margin-left: auto; display: flex; gap: 8px; }
.visao-acoes .btn { display: inline-flex; align-items: center; gap: 7px; }
.visao-acoes .btn svg { width: 16px; height: 16px; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); }
.kpi-tec {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 15px; box-shadow: var(--sombra); position: relative; overflow: hidden;
}
.kpi-tec::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}
.kpi-tec.alerta::after { background: linear-gradient(90deg, var(--alerta), transparent 70%); }
.kpi-tec.ok::after { background: linear-gradient(90deg, var(--ok), transparent 70%); }
.kpi-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-suave); color: var(--accent); flex-shrink: 0;
}
.kpi-ico svg { width: 17px; height: 17px; }
.kpi-tec .kpi-num { font-size: 21px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; }
.kpi-tec .kpi-rot { font-size: 11.5px; font-weight: 700; color: var(--faint);
  text-transform: uppercase; letter-spacing: .4px; }
.kpi-tec .kpi-nota { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.kpi-barra { height: 5px; border-radius: 3px; background: var(--surface-2);
  border: 1px solid var(--border); overflow: hidden; margin: 6px 0 3px; }
.kpi-barra > span { display: block; height: 100%; background: var(--accent); }

.visao-grade { display: grid; gap: 14px; grid-template-columns: 1.15fr 1fr; align-items: start; }
.visao-coluna { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1080px) { .visao-grade { grid-template-columns: 1fr; } }

.bloco { padding: 4px 0 6px; }
.bloco-topo { display: flex; align-items: center; gap: 10px; padding: 13px 16px 9px; }
.bloco-topo h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 7px; }
.bloco-topo .btn-texto { margin-left: auto; }
.bloco-vazio { padding: 4px 16px 14px; }
.conta { font-size: 11px; font-weight: 700; background: var(--accent-suave); color: var(--accent);
  border-radius: 20px; padding: 1px 8px; }
.conta.alerta { background: #fef3e0; color: #a35a06; }

.lista-lin { list-style: none; margin: 0; padding: 0; }
.lin { display: flex; align-items: center; gap: 11px; padding: 10px 16px;
  border-top: 1px solid var(--border); }
.lin:hover { background: var(--surface-2); }
.lin-corpo { flex: 1; min-width: 0; cursor: pointer; }
.lin-tit { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.lin-tit.fraco { font-weight: 500; white-space: normal; color: var(--dim); }
.lin-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.lin-quando { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.lin-ponto { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lin-selo { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); font-size: 13px; flex-shrink: 0; }
.lin-tarefa input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ok);
  cursor: pointer; flex-shrink: 0; }
.lin-tarefa.atrasada .lin-tit { color: var(--text); }
.lin-mural { align-items: flex-start; }
.btn-fino { background: none; border: 1px solid var(--border-forte); color: var(--dim);
  border-radius: 7px; padding: 3px 9px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; flex-shrink: 0; font-family: inherit; }
.btn-fino:hover { border-color: var(--accent); color: var(--accent); }

.equipe-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px; padding: 6px 16px 12px; }
.equipe-nums > div { display: flex; flex-direction: column; }
.equipe-nums b { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.equipe-nums span { font-size: 11.5px; color: var(--faint); }
.equipe-nums .destaque b { color: var(--alerta); }
.meta-linha { padding: 0 16px 14px; }
.meta-cab { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--dim); margin-bottom: 6px; }

:root[data-tema="escuro"] .sidebar { border-color: rgba(255,255,255,.05); }
:root[data-tema="escuro"] .conta.alerta { background: #2b2113; color: #fbbf24; }

.sel-funil { border: 1px solid var(--border-forte); background: var(--surface);
  color: var(--text); border-radius: 20px; padding: 5px 12px; font: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sel-funil:focus { outline: none; border-color: var(--accent); }

/* ===================== Entrada (login do piloto) ===================== */
.login-fundo {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--bg);
  background-image:
    radial-gradient(900px 460px at 50% -10%, var(--accent-suave), transparent 60%);
}
.login-caixa {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 24px 22px; box-shadow: var(--sombra-lg);
}
.login-marca { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 19px; font-weight: 700; flex-shrink: 0;
}
.login-logo-img { max-width: 150px; max-height: 40px; object-fit: contain; }
.login-nome { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.login-sub { font-size: 12px; color: var(--faint); }
.login-btn { width: 100%; margin-top: 6px; padding: 10px; }
.login-erro { margin: 12px 0 0; font-size: 12.5px; color: var(--erro); text-align: center; }
.login-erro[hidden] { display: none; }

.nav-sair {
  background: transparent; border: none; color: var(--sidebar-txt); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-size: 14px; margin-left: auto;
  flex-shrink: 0;
}
.nav-sair:hover { background: var(--sidebar-2); color: #fff; }
.app.trilho .nav-sair { display: none; }

/* ===================== Meu WhatsApp ===================== */
.zap-cartao { margin-bottom: 16px; }
.zap-topo { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.zap-acoes { margin-left: auto; }
.zap-status {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  font-weight: 600; color: var(--dim);
}
.zap-status.pequeno { font-size: 11.5px; flex-shrink: 0; }
.zap-bolinha { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.zap-status.conectada { color: var(--ok); }
.zap-status.conectada .zap-bolinha { background: var(--ok); box-shadow: 0 0 6px rgba(16,185,129,.6); }
.zap-status.conectando { color: var(--alerta); }
.zap-status.conectando .zap-bolinha { background: var(--alerta); animation: pulsa 1.2s infinite; }
@keyframes pulsa { 50% { opacity: .25; } }
.zap-numero { font-size: 20px; font-weight: 700; letter-spacing: -.3px; margin-top: 4px; }

.zap-qr { display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.zap-qr img { width: 220px; height: 220px; background: #fff; border-radius: 12px;
  padding: 8px; border: 1px solid var(--border); }
.zap-passos { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--dim);
  line-height: 1.9; }
.zap-passos b { color: var(--text); }
.zap-equipe { margin-top: 6px; }
.zap-equipe .lin:first-child { border-top: none; }

/* ===================== Tutorial guiado ===================== */
/* O véu é a SOMBRA do buraco (`box-shadow` gigante), não um elemento por cima:
   assim o recorte acompanha o alvo sem quatro divs de moldura para alinhar. */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour-buraco {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(9, 11, 20, .62);
  outline: 2px solid var(--accent);
  outline-offset: 0;
  transition: top .24s ease, left .24s ease, width .24s ease, height .24s ease;
}
.tour-buraco.sem-alvo { outline: none; border-radius: 0; }

.tour-balao {
  position: fixed; width: 330px; max-width: calc(100vw - 32px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-forte); border-radius: 16px;
  padding: 16px 18px 14px; box-shadow: var(--sombra-lg);
  animation: tour-entra .18s ease;
}
.tour-balao.centro {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 400px; max-width: calc(100vw - 32px);
}
@keyframes tour-entra { from { opacity: 0; transform: translateY(6px); } }
.tour-balao.centro { animation: none; }

.tour-cabeca { display: flex; align-items: center; gap: 8px; }
.tour-conta {
  font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-suave);
  padding: 3px 8px; border-radius: 20px;
}
.tour-x {
  margin-left: auto; background: transparent; border: none; color: var(--faint);
  cursor: pointer; font-size: 14px; width: 26px; height: 26px; border-radius: 8px;
}
.tour-x:hover { background: var(--surface-2); color: var(--text); }
.tour-tit { margin: 10px 0 6px; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.tour-txt { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--dim); }
.tour-txt b { color: var(--text); font-weight: 600; }

.tour-pontos { display: flex; gap: 5px; margin: 14px 0 12px; }
.tour-ponto {
  width: 6px; height: 6px; border-radius: 50%; background: var(--border-forte);
  transition: background .16s, width .16s;
}
.tour-ponto.feito { background: var(--accent-suave); }
.tour-ponto.aqui { width: 18px; border-radius: 4px; background: var(--accent); }

.tour-acoes { display: flex; align-items: center; gap: 8px; }
.tour-espaco { flex: 1; }
.tour-btn {
  border: 1px solid var(--border-forte); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; font-family: inherit;
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tour-btn:hover { background: var(--surface-2); }
.tour-btn.primario { background: var(--accent); border-color: var(--accent); color: #fff; }
.tour-btn.primario:hover { filter: brightness(1.06); }
.tour-btn.fantasma { border-color: transparent; background: transparent; color: var(--faint); }
.tour-btn.fantasma:hover { color: var(--text); background: var(--surface-2); }

:root[data-tema="escuro"] .tour-buraco { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .72); }
