/* ==========================================================================
   Grupo Live — painel
   Design de tema único e deliberado: fundo frio, verde WhatsApp como acento,
   Sora nos títulos e números, DM Sans no texto.
   ========================================================================== */

:root {
  --bg:            #eef2f4;
  --surface:       #ffffff;
  --surface-2:     #f2f6f5;
  --surface-3:     #fafcfb;

  --ink:           #14231e;
  --ink-2:         #5c6f68;
  --ink-3:         #93a5a0;

  --rule:          #e2e9e7;
  --rule-2:        #e9efed;
  --rule-3:        #f0f4f2;
  --rule-forte:    #c9ddd5;

  --verde:         #0b8a63;
  --verde-escuro:  #086b4d;
  --verde-claro:   #e3f4ec;
  --verde-menta:   #6fd8b2;
  --escuro:        #0f2b22;
  --escuro-texto:  #b7ccc4;

  --azul:          #2f6fb0;   --azul-bg:     #e7effa;
  --ambar:         #9a5b00;   --ambar-bg:    #fdf1dd;
  --vermelho:      #b03a3a;   --vermelho-bg: #fbeaea;
  --roxo:          #8a5fb0;   --roxo-bg:     #f6ecfa;

  --sombra-verde:  0 2px 8px rgba(11, 138, 99, .25);
  --sombra-card:   0 1px 2px rgba(20, 35, 30, .04);

  --display: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --texto:   'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* Componentes com display explícito (.aviso, .card...) venceriam a regra
   [hidden]{display:none} do navegador e apareceriam mesmo escondidos. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--texto);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
h2 { font-size: 16.5px; font-weight: 600; }
h3 { font-size: 14.5px; font-weight: 600; }
p  { margin: 0; }

a { color: var(--verde); text-decoration: none; font-weight: 600; }
a:hover { color: var(--verde-escuro); text-decoration: underline; }

code { font-family: var(--mono); font-size: .88em; }

:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ shell -- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 16px;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--verde);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-nome { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: none; background: transparent;
  border-radius: 10px;
  color: var(--ink-2);
  font-family: var(--texto); font-weight: 500; font-size: 14.5px;
  cursor: pointer; text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--verde-claro); color: var(--verde-escuro); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  font-size: 11.5px; font-weight: 700;
  min-width: 20px; padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2);
  text-align: center;
}
.nav-item[aria-current="page"] .badge { background: #ffffff; color: var(--verde-escuro); }
.nav-item .badge.alerta { background: var(--vermelho-bg); color: var(--vermelho); }

.rodape-lateral { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.usuario { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.usuario-email {
  flex: 1; min-width: 0;
  font-size: 12px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-titulo {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 14px 12px 5px;
}

/* ------------------------------------------------------------ checklist --- */

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border-radius: 10px;
}
.checklist li + li { border-top: 1px solid var(--rule-3); border-radius: 0; }
.checklist li > div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.checklist b { font-size: 14px; font-weight: 600; }
.checklist .porque { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.checklist .detalhe { font-size: 12.5px; color: var(--ambar); font-weight: 500; margin-top: 2px; }
.checklist .marca {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center;
  border: 2px solid var(--rule-forte); color: #fff;
}
.checklist li.feito .marca { background: var(--verde); border-color: var(--verde); }
.checklist li.feito b { color: var(--ink-2); font-weight: 500; }
.checklist li.feito .porque { display: none; }
.checklist li.pendente { background: var(--surface-3); }
.checklist li.pendente .marca { border-color: var(--ambar); }
.checklist li .btn { flex: none; align-self: center; }

.conexao {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 6px;
}
.conexao-topo { display: flex; align-items: center; gap: 8px; }
.conexao-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.conexao-ponto.on  { background: var(--verde); }
.conexao-ponto.off { background: var(--vermelho); }
.conexao-ponto.meio{ background: var(--ambar); }
.conexao-titulo { font-size: 13px; font-weight: 600; }
.conexao-sub { font-size: 12.5px; color: var(--ink-2); word-break: break-word; }

.conteudo {
  flex: 1;
  min-width: 0;
  padding: 28px 40px 48px;
  display: flex; flex-direction: column; gap: 22px;
  max-width: 1240px; width: 100%; margin: 0 auto;
}

.pagina-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pagina-topo .titulo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pagina-topo .sub { font-size: 14px; color: var(--ink-2); }
.pagina-topo .acoes { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- botões -- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--texto); font-size: 14.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, color .13s;
}
.btn:hover:not(:disabled) { border-color: var(--rule-forte); background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.principal { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: var(--sombra-verde); }
.btn.principal:hover:not(:disabled) { background: var(--verde-escuro); border-color: var(--verde-escuro); }

.btn.perigo { color: var(--vermelho); border-color: #e8b4b4; }
.btn.perigo:hover:not(:disabled) { background: var(--vermelho-bg); border-color: var(--vermelho); }

.btn.fantasma { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.fantasma:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }

.btn.mini { padding: 8px 14px; font-size: 13.5px; }
.btn.icone { padding: 0; width: 32px; height: 32px; justify-content: center; border-radius: 8px; }
.btn.icone:hover:not(:disabled) { border-color: var(--rule-forte); color: var(--ink); }
.btn.icone.perigo:hover:not(:disabled) { border-color: #e8b4b4; color: var(--vermelho); }

/* ----------------------------------------------------------------- pills -- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.pill.verde   { background: var(--verde-claro);  color: var(--verde-escuro); }
.pill.azul    { background: var(--azul-bg);      color: var(--azul); }
.pill.ambar   { background: var(--ambar-bg);     color: var(--ambar); }
.pill.vermelho{ background: var(--vermelho-bg);  color: var(--vermelho); }
.pill.roxo    { background: var(--roxo-bg);      color: var(--roxo); }
.pill.escuro  { background: var(--escuro);       color: var(--verde-menta); }

.pill-mini { font-size: 11.5px; padding: 3px 9px; }

/* ---------------------------------------------------------------- toggle -- */

.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; display: inline-block; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle .trilho {
  display: block; width: 42px; height: 24px; border-radius: 99px;
  background: #c8d4d0; transition: background .2s;
}
.toggle .bolinha {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: left .2s; pointer-events: none;
}
.toggle input:checked ~ .trilho  { background: var(--verde); }
.toggle input:checked ~ .bolinha { left: 21px; }
.toggle input:focus-visible ~ .trilho { outline: 2px solid var(--verde); outline-offset: 2px; }
.toggle.no-escuro input:not(:checked) ~ .trilho { background: #3d564c; }

/* ----------------------------------------------------------------- cards -- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.card.compacto { padding: 16px 18px; gap: 12px; }
.card-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.card-escuro {
  background: var(--escuro);
  border-radius: 16px;
  padding: 22px 24px;
  color: #fff;
  display: flex; flex-direction: column; gap: 12px;
}
.card-escuro h2 { color: #fff; }
.card-escuro p { font-size: 13.5px; line-height: 1.55; color: var(--escuro-texto); }
.card-escuro a { color: var(--verde-menta); font-size: 13px; }

.metricas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.metrica {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 8px;
}
.metrica .rotulo { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.metrica .valor  { font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.metrica .nota   { font-size: 12.5px; color: var(--ink-2); }
.metrica .nota.bom  { color: var(--verde); font-weight: 600; }
.metrica .nota.ruim { color: var(--vermelho); font-weight: 600; }
.metrica.destaque .valor { color: var(--verde); }
.metrica.alerta  .valor  { color: var(--vermelho); }

/* -------------------------------------------------------------- mensagens -- */

.grupo-dia { display: flex; flex-direction: column; gap: 10px; }
.grupo-dia > .rotulo-dia {
  font-family: var(--display); font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px;
}

.msg {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
}
.msg.aberta { border-color: var(--rule-forte); }

/* Mensagem desligada aparece apagada na lista — mas nunca com o editor aberto,
   senão você edita um formulário que mal dá para ler. */
.msg.off .msg-linha { opacity: .55; }
.msg.off.aberta .msg-linha { opacity: 1; }
.msg.off.aberta { border-color: var(--ambar); }

.msg-linha {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 20px;
  cursor: pointer;
}
.msg-linha:hover { background: var(--surface-3); }
.msg-hora {
  font-family: var(--display); font-size: 16px; font-weight: 600;
  min-width: 52px; font-variant-numeric: tabular-nums;
}
.msg-sep { width: 1px; align-self: stretch; background: var(--rule-2); flex-shrink: 0; }
.msg-meio { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.msg-texto {
  font-size: 14.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Nome escopado de propósito: ".vazio" é a classe do painel de estado vazio
   (padding grande, borda tracejada) e colidia com esta linha. */
.msg-texto.sem-texto { color: var(--ink-3); font-style: italic; font-weight: 400; }
.msg-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-acoes { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* --------------------------------------------------------- editor fluxo --- */

.fx-barra {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px 14px 0 0; border-bottom: none;
}
.fx-zoom { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }

.fx-area { display: flex; border: 1px solid var(--rule); border-radius: 0 0 14px 14px; overflow: hidden; }

.fx-tela {
  position: relative; flex: 1; min-width: 0;
  height: 560px; overflow: hidden; cursor: grab;
  /* Arrastar o fundo é para mover a tela, não para selecionar texto. */
  user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: contain;
  /* Em propriedades separadas porque o JS move e escala a grade junto com o
     desenho — se ela ficasse parada, mover a tela pareceria arrastar os nós. */
  background-color: var(--surface-2);
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
}
.fx-tela--movendo { cursor: grabbing; }

.fx-svg, .fx-camada {
  position: absolute; top: 0; left: 0;
  width: 4000px; height: 3000px;
  transform-origin: 0 0;
}
.fx-svg { pointer-events: none; overflow: visible; }
.fx-svg .fx-hit { pointer-events: stroke; }
.fx-camada { pointer-events: none; }

.fx-no {
  position: absolute; pointer-events: auto;
  border: 2px solid; border-radius: 12px;
  padding: 11px 13px;
  cursor: grab; user-select: none;
  font-family: var(--texto);
}
.fx-no:active { cursor: grabbing; }
.fx-tipo { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fx-titulo { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-top: 2px; line-height: 1.35; }
.fx-resumo { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.4; white-space: pre-line; }
.fx-resumo::first-line { font-weight: 600; color: var(--ink); }

.fx-alerta {
  position: absolute; top: -8px; right: -8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--vermelho); color: #fff;
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}

.fx-porta {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink-3);
  transform: translate(-50%, -50%);
}
/* Fluxo horizontal: entra pela esquerda, sai pela direita. */
.fx-entrada { left: 0; top: 50%; }
.fx-saida { left: 100%; cursor: crosshair; border-color: var(--verde); }
.fx-saida:hover { background: var(--verde); transform: translate(-50%, -50%) scale(1.25); }
.fx-saida.fx-nao { border-color: #b06a2f; }
.fx-saida.fx-nao:hover { background: #b06a2f; }
.fx-rot-porta {
  position: absolute; left: calc(100% + 12px); transform: translateY(-50%);
  font-size: 10px; font-weight: 700; color: var(--verde); text-transform: uppercase;
  pointer-events: none;
}
.fx-rot-porta.fx-rot-nao { color: #b06a2f; }

.fx-painel {
  width: 300px; flex: none;
  border-left: 1px solid var(--rule); background: var(--surface);
  padding: 16px; overflow-y: auto; max-height: 560px;
  transition: width .15s, padding .15s;
}
.fx-painel--recolhido { width: 0; padding: 0; overflow: hidden; border-left: none; }
.fx-painel-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fx-painel-topo strong { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }

/* Excluir fica no fim e com rótulo. Antes era um "✕" no canto superior direito,
   que todo mundo lê como "fechar" — e virava exclusão sem querer. */
.fx-excluir { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule-3); }

/* Com o painel recolhido, as dicas viram uma faixa embaixo da tela. */
.fx-dicas {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  padding: 9px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-2);
  pointer-events: none;
}
.fx-dicas b { color: var(--ink); font-weight: 600; }
.fx-dicas.escondido { display: none; }

/* ------------------------------------------------- fluxo em tela cheia --- */

/* Editor de nós quer espaço. Nesta rota a barra lateral e as margens da
   página saem, e o desenho passa a ser a tela inteira; o que sobrou de
   cabeçalho vira uma faixa fina em cima. */
body.modo-fluxo { overflow: hidden; }
body.modo-fluxo .sidebar { display: none; }
body.modo-fluxo .conteudo {
  padding: 0; gap: 0; max-width: none; height: 100vh; overflow: hidden;
}

.fx-tudo { position: relative; display: flex; flex-direction: column; height: 100vh; min-height: 0; }

.fx-topo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.fx-topo-sep { width: 1px; height: 20px; background: var(--rule); }
.fx-topo-nome { font-family: var(--display); font-size: 15px; }
.fx-topo-estado { display: flex; align-items: center; }

.fx-selo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.fx-selo.ok { background: var(--verde-claro); color: var(--verde-escuro); }
.fx-selo.erro { background: var(--vermelho-bg); color: var(--vermelho); cursor: help; }

/* Em tela cheia o editor perde os cantos e as bordas externas: quem faz o
   recorte agora é a própria janela. */
body.modo-fluxo #fx-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.modo-fluxo .fx-barra { border: none; border-radius: 0; border-bottom: 1px solid var(--rule); }
body.modo-fluxo .fx-area { flex: 1; min-height: 0; border: none; border-radius: 0; }
body.modo-fluxo .fx-tela { height: auto; }
body.modo-fluxo .fx-painel { max-height: none; }

/* A prévia não cabe mais embaixo do desenho, então vira gaveta sobre ele. */
.fx-gaveta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  max-height: 46vh; overflow-y: auto;
  padding: 14px 18px 18px;
  background: var(--surface); border-top: 1px solid var(--rule);
  box-shadow: 0 -10px 30px rgba(20, 35, 30, .10);
}
.fx-gaveta-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.fx-gaveta-topo h2 { font-size: 16px; }
.fx-gaveta-nota { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }

@media (max-width: 900px) {
  .fx-area { flex-direction: column; }
  .fx-painel { width: auto; max-height: none; border-left: none; border-top: 1px solid var(--rule); }
  .fx-tela { height: 420px; }

  /* Sem largura para lado a lado, o painel do nó volta a ser uma faixa. */
  body.modo-fluxo .fx-painel { max-height: 45vh; }
  body.modo-fluxo .fx-tela { height: auto; min-height: 240px; }
}

/* --------------------------------------------------------------- leads --- */

.card-nota { font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; max-width: 78ch; }
.card-nota.alerta { color: var(--ambar); }
.acoes-linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

/* As iniciais são o fundo; a foto entra por cima e some sozinha se a URL
   tiver expirado, sem precisar de handler de erro (que a CSP barraria). */
.avatar {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--verde-claro); color: var(--verde-escuro);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  flex-shrink: 0;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.sub-linha { display: block; font-size: 12px; color: var(--ink-3); }

/* A regra geral da tabela é `white-space: nowrap`, boa para colunas curtas e
   péssima aqui: endereço e horário de atendimento são frases, e ficavam
   cortados na borda em vez de quebrar. */
.lead-detalhe > td { background: var(--surface-2); white-space: normal; }
.perfil { display: grid; gap: 10px 26px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 0; padding: 4px 2px; }
.perfil > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perfil dt { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.perfil dd { margin: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }

/* -------------------------------------------------------------- anexo --- */

.anexo-vazio {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 10px;
  border: 1px dashed var(--rule-forte); background: var(--surface-3);
}
.anexo-vazio > div { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.anexo-vazio b { font-size: 13px; font-weight: 600; }
.anexo-vazio span { font-size: 12.5px; color: var(--ink-2); }

.anexo {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--surface-2);
}
.anexo-thumb {
  width: 56px; height: 56px; flex: none; border-radius: 8px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--rule);
  display: grid; place-items: center;
}
.anexo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anexo-icone { font-size: 26px; line-height: 1; }
.anexo-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.anexo-info b { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.anexo-info span { font-size: 12.5px; color: var(--ink-2); }
.anexo-info .anexo-erro { color: var(--vermelho); font-weight: 600; }

/* "Disparar agora" estava lado a lado com Prévia e Testar, com o mesmo peso —
   sendo que é irreversível. Fica separado e explicado. */
.fora-de-hora {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--rule-forte);
}
.fora-de-hora > div { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.fora-de-hora b { font-size: 13px; font-weight: 600; }
.fora-de-hora span { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }

.msg-editor {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--rule-2);
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------------------------------------------------------------- campos -- */

.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > label, .campo > .rotulo { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.campo > .dica { font-size: 12.5px; color: var(--ink-3); }

.grade { display: grid; gap: 14px; }
.grade.c2 { grid-template-columns: 1fr 1fr; }
.grade.c3 { grid-template-columns: repeat(3, 1fr); }

/* Pega qualquer input pelo que ele NÃO é, em vez de listar type por type:
   <input> sem atributo type é text, e a lista por tipo deixava esses de fora
   com a aparência crua do navegador. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-family: var(--texto); font-size: 14px;
  color: var(--ink); background: var(--surface);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

/* A seta do select some com appearance:none; desenhamos uma. */
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c6f68' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* O datetime-local precisa do ícone nativo de calendário. */
input[type="datetime-local"] { appearance: auto; -webkit-appearance: auto; }

/* ------------------------------------------------------------- seletor --- */

/* O <select> continua no DOM (é ele que guarda o valor), mas some da tela:
   quem aparece é o botão abaixo. A lista nativa é desenhada pelo sistema
   operacional e não aceita CSS, então destoava do resto do painel. */
.sel { position: relative; width: 100%; min-width: 0; }
.sel > select { display: none; }

.sel-botao {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--rule); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-family: var(--texto); font-size: 14px; text-align: left;
  cursor: pointer;
}
.sel-botao:hover:not(:disabled) { border-color: var(--rule-forte); }
.sel-botao:focus-visible {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(11, 138, 99, .12);
}
.sel-botao:disabled { cursor: not-allowed; opacity: .6; }
.sel-botao[aria-expanded="true"] {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(11, 138, 99, .12);
}

.sel-valor { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-valor.sel-vazio { color: var(--ink-3); }
.sel-seta { flex-shrink: 0; color: var(--ink-3); transition: transform .15s; }
.sel-botao[aria-expanded="true"] .sel-seta { transform: rotate(180deg); }

/* No <body> e fixa na janela: dentro do painel do nó ela seria recortada. */
.sel-lista {
  position: fixed; z-index: 300;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 35, 30, .16);
  animation: selAbre .12s ease-out;
}
@keyframes selAbre { from { opacity: 0; transform: translateY(-4px); } }

.sel-opcao {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.sel-opcao > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-opcao > svg { flex-shrink: 0; color: var(--verde); }
.sel-opcao--ativa { background: var(--verde-claro); }
.sel-opcao[aria-selected="true"] { font-weight: 600; }
.sel-opcao[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }

/* Inline no cabeçalho: sem caixa própria, encostado no ícone. */
.seletor-live .sel { width: auto; }
.seletor-live .sel-botao {
  border: none; background: transparent;
  padding: 0; gap: 4px;
  font-size: 13.5px; font-weight: 600;
}
.seletor-live .sel-botao:focus-visible,
.seletor-live .sel-botao[aria-expanded="true"] { box-shadow: none; }

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

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(11, 138, 99, .12);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }


.linha-check { display: flex; align-items: center; gap: 10px; }
.linha-check .txt { font-size: 14px; font-weight: 500; }

/* ------------------------------------------------------------------ prev -- */

.previa {
  white-space: pre-wrap; word-break: break-word;
  background: var(--verde-claro);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  font-size: 14px; line-height: 1.6;
  max-height: 300px; overflow-y: auto;
  color: var(--escuro);
}

.aviso {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px; border-radius: 12px; font-size: 13.5px; line-height: 1.5;
}
.aviso.info    { background: var(--azul-bg);     color: var(--azul); }
.aviso.atencao { background: var(--ambar-bg);    color: var(--ambar); }
.aviso.erro    { background: var(--vermelho-bg); color: var(--vermelho); }
.aviso.ok      { background: var(--verde-claro); color: var(--verde-escuro); }
.aviso svg { flex-shrink: 0; margin-top: 1px; }
.aviso b { font-weight: 700; }

/* ---------------------------------------------------------------- tabela -- */

.rolagem { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--rule-3); white-space: nowrap; }
th {
  font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2);
}
th:first-child { border-top-left-radius: 15px; }
th:last-child  { border-top-right-radius: 15px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }
td.num { font-variant-numeric: tabular-nums; }
td.livre { white-space: normal; min-width: 220px; }

/* ---------------------------------------------------------------- lives --- */

.lista-lives { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.live-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 16px;
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
  cursor: pointer; text-align: left; font-family: var(--texto);
}
.live-card:hover { border-color: var(--rule-forte); }
.live-card[aria-current="true"] { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(11, 138, 99, .1); }
.live-card .nome { font-family: var(--display); font-size: 16px; font-weight: 600; }
.live-card .quando { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.live-card .rodape {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--rule-3);
}

/* As ações só aparecem no hover/foco, para o card não virar barra de botões.
   No toque não há hover, então ali ficam sempre visíveis. */
.live-acoes { margin-left: auto; display: flex; gap: 6px; opacity: 0; transition: opacity .13s; }
.live-card:hover .live-acoes,
.live-card:focus-within .live-acoes { opacity: 1; }
@media (hover: none) { .live-acoes { opacity: 1; } }

/* ---------------------------------------------------------------- vários -- */

.vazio {
  padding: 48px 24px; text-align: center;
  color: var(--ink-2); font-size: 14.5px;
  background: var(--surface); border: 1px dashed #d5e0dc; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

/* ------------------------------------------------------------- conexão --- */

.qr-area {
  display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.qr-moldura {
  background: #fff; padding: 12px; border-radius: 12px;
  border: 1px solid var(--rule);
  flex: none; line-height: 0;
}
.qr-moldura img { width: 240px; height: 240px; display: block; image-rendering: pixelated; }
.qr-passos { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }
.qr-passos ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.qr-passos li { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.qr-passos li b { color: var(--ink); font-weight: 600; }
.qr-expira { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.qr-carregando {
  width: 264px; height: 264px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px dashed var(--rule-forte); border-radius: 12px;
  color: var(--ink-3); font-size: 13.5px;
}

.ajuda {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface-3);
}
.ajuda > summary {
  cursor: pointer; padding: 13px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  list-style: none;
}
.ajuda > summary::-webkit-details-marker { display: none; }
.ajuda > summary::before { content: '？ '; color: var(--ink-3); }
.ajuda[open] > summary { color: var(--ink); border-bottom: 1px solid var(--rule); }
.ajuda > summary:hover { color: var(--ink); }
.ajuda-corpo { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ajuda-corpo p { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.ajuda-corpo ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ajuda-corpo li { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.ajuda-corpo b { color: var(--ink); font-weight: 600; }

.pareamento {
  font-family: var(--mono); font-size: 20px; font-weight: 600;
  letter-spacing: 3px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 10px; padding: 10px 14px; text-align: center;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-2); color: var(--ink-2);
  padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--rule); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--verde); color: var(--verde); background: var(--verde-claro); }
.chip:active { transform: translateY(1px); }

.barra { height: 8px; border-radius: 99px; background: var(--rule-2); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 99px; background: var(--verde); }
.card-escuro .barra { background: rgba(255, 255, 255, .12); }
.card-escuro .barra > span { background: var(--verde-menta); }

.seletor-live {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 14px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink);
  font-family: var(--texto);
}
.seletor-live:hover { border-color: var(--rule-forte); }
/* Inline no cabeçalho: sem caixa própria, mas mantém a seta desenhada. */
.seletor-live select {
  border: none;
  padding: 0 18px 0 0;
  width: auto;
  font-weight: 600;
  font-size: 13.5px;
  background-color: transparent;
  background-position: right 0 center;
  cursor: pointer;
}
.seletor-live select:focus { box-shadow: none; }

/* --------------------------------------------------------------- toasts --- */

#toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  padding: 13px 16px; border-radius: 12px;
  background: var(--escuro); color: #fff;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(15, 43, 34, .25);
  animation: sobe .2s ease-out;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.erro { background: #7d2020; }
.toast .marca { color: var(--verde-menta); font-weight: 700; flex-shrink: 0; }
.toast.erro .marca { color: #ffb4a8; }

@keyframes sobe { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } * { transition: none !important; } }

/* --------------------------------------------------------------- diálogo -- */

.overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(15, 43, 34, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialogo {
  background: var(--surface); border-radius: 18px; padding: 26px;
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 20px 50px rgba(15, 43, 34, .3);
  max-height: 90vh; overflow-y: auto;
}
.dialogo .rodape { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------------- login --- */

.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.caixa-login {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 18px;
  padding: 32px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--sombra-card);
}
.caixa-login .brand { margin-bottom: 2px; }
.caixa-login .sub { color: var(--ink-2); font-size: 14px; margin-top: -8px; }
.caixa-login .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* --------------------------------------------------------------- mobile --- */

@media (max-width: 980px) {
  .metricas { grid-template-columns: repeat(2, 1fr); }
  .grade.c2, .grade.c3 { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 14px;
    padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--rule);
    overflow-x: auto;
  }
  .sidebar .brand-nome { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { padding: 8px 12px; white-space: nowrap; }
  .nav-item span.rotulo { display: none; }
  .nav-item .badge { margin-left: 0; }
  .rodape-lateral { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; flex-shrink: 0; }
  .conexao { padding: 8px 12px; }
  .conexao-sub { display: none; }
  .usuario-email { display: none; }
  .conteudo { padding: 20px 16px 40px; }
  .msg-linha { flex-wrap: wrap; gap: 12px; }
  .msg-sep { display: none; }
}
