/* Área de Configurações — herda os tokens de styles.css */

/* link fixo no rodapé da barra lateral, acima do usuário */
.sidebar-config {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-config .nav-item { margin: 0; }

/* quando existe o bloco de configurações, o rodapé perde o auto-margin */
.sidebar-config ~ .sidebar-footer { margin-top: 12px; }

/* parâmetro editável */
.config-item .edit .sufixo {
  font-size: 12.5px;
  color: var(--text-faint);
  min-width: 20px;
}

/* regra fixa do sistema — o que não é configurável, e por quê */
.regra-fixa {
  border-left: 2px solid var(--brand);
  background: var(--surface-2);
  padding: 12px 15px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  font-size: 12.8px;
  color: var(--text-muted);
  line-height: 1.65;
}
.regra-fixa:last-child { margin-bottom: 0; }
.regra-fixa b { color: var(--text); display: block; margin-bottom: 3px; }

/* fases de um funil, em leitura */
.fases-config { display: flex; flex-wrap: wrap; gap: 8px; }
.fase-config {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 7px;
  background: var(--surface-2);
  font-size: 12.8px;
}
.fase-config .ord {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* pilares de conteúdo */
.pilar-linha {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}
.pilar-linha:last-child { border-bottom: none; }
.pilar-linha .cor {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 34px;
}
.pilar-linha .nome { font-size: 13.5px; font-weight: 600; }
.pilar-linha .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

/* linha de informação (chave à esquerda, valor à direita) */
.linha-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.linha-info:last-child { border-bottom: none; }
.linha-info span { color: var(--text-muted); }

/* --- TV ao Vivo: link e escolha de painéis --- */
.link-tv { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-tv input {
  flex: 1; min-width: 260px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2); color: var(--text-muted);
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
}

.paineis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 9px; }
.painel-opcao {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 11px 13px; cursor: pointer; background: var(--surface-2);
  font-size: 13px;
}
.painel-opcao:hover { border-color: var(--text-faint); }
.painel-opcao.on { border-color: var(--brand); background: var(--brand-soft); }
.painel-opcao input { accent-color: var(--brand); }
.painel-opcao .ordem {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-faint);
}
.painel-opcao.on .ordem { background: var(--brand); color: var(--brand-contraste); }
.painel-opcao .nome { flex: 1; }

.previa-painel {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 8px; background: var(--surface-2);
}
.previa-painel .cab { display: flex; align-items: center; gap: 9px; font-size: 13.5px; margin-bottom: 4px; }
.previa-painel .dest { font-size: 12.5px; color: var(--text-muted); }
.previa-painel .erro-previa { font-size: 12px; color: var(--red); margin-top: 5px; }
.farol-mini { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.farol-mini.verde { background: var(--green); }
.farol-mini.amarelo { background: var(--orange); }
.farol-mini.vermelho { background: var(--red); }
.farol-mini.neutro { background: var(--text-faint); }

/* --- plano de ação --- */
.func-linha {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 13px 0; border-bottom: 1px solid var(--border-soft);
}
.func-linha:last-child { border-bottom: none; }
.func-linha .nome { font-size: 13.8px; font-weight: 600; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.func-linha .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }
.func-linha .trava {
  font-size: 12px; color: var(--brand); margin-top: 6px;
  display: flex; align-items: center; gap: 6px; line-height: 1.5;
}

.entrega-linha {
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.entrega-linha:last-child { border-bottom: none; }
.entrega-linha .quando { color: var(--text-faint); font-size: 12px; width: 82px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.entrega-linha .mod { color: var(--brand); font-size: 11.5px; width: 128px; flex-shrink: 0; }
.entrega-linha .oq { flex: 1; }

/* --- histórico --- */
.historico-lista { display: flex; flex-direction: column; }
.hist-linha {
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.hist-linha:last-child { border-bottom: none; }
.hist-linha .quando {
  color: var(--text-faint); font-size: 12px; width: 108px; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.hist-linha .acao {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  width: 72px; flex-shrink: 0;
}
.hist-linha .acao-criou { color: var(--green); }
.hist-linha .acao-alterou { color: var(--brand); }
.hist-linha .acao-removeu { color: var(--red); }
.hist-linha .acao-entrou { color: var(--blue); }
.hist-linha .oq { flex: 1; }
.hist-linha .quem { color: var(--text-muted); font-size: 12.5px; flex-shrink: 0; }

@media (max-width: 760px) {
  .hist-linha, .entrega-linha { flex-wrap: wrap; gap: 6px 12px; }
  .hist-linha .oq { width: 100%; order: 3; }
}

/* Acesso por funil — quem consegue abrir cada quadro */
.acesso-lista { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.acesso-linha {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r); cursor: pointer;
}
.acesso-linha:hover { background: var(--surface-2); }
.acesso-linha.fixo { cursor: default; opacity: .65; }
.acesso-nome { font-weight: 600; }
.acesso-cargo { font-size: 12px; color: var(--text-muted); }
.acesso-obs { font-size: 11.5px; color: var(--brand); white-space: nowrap; }

/* ---- Conexões: WhatsApp e e-mail ------------------------------------- */
.cx-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border-soft);
}
.cx-item:last-child { border-bottom: none; }
.cx-info { min-width: 0; flex: 1; }
.cx-nome { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cx-tipo {
  font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 4px; font-weight: 700;
}
.cx-tipo.pessoal { background: var(--surface-3); color: var(--text-muted); }
.cx-tipo.comercial { background: var(--brand-soft); color: var(--brand); }
.cx-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.cx-sub code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.cx-erro { color: var(--red); }
.cx-acoes { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.selo-cx {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: .3px;
}
.selo-cx.ok { background: var(--green-bg); color: var(--green); }
.selo-cx.off { background: var(--surface-3); color: var(--text-faint); }
.selo-cx.erro { background: var(--red-bg); color: var(--red); }

.cx-sucesso {
  background: var(--green-bg); border: 1px solid var(--green); color: var(--green);
  border-radius: var(--r); padding: 9px 12px; font-size: 12.5px; margin-bottom: 10px;
}

/* QR de pareamento */
.qr-passos { margin: 0 0 14px; padding-left: 20px; font-size: 12.5px; line-height: 1.9; color: var(--text-muted); }
.qr-img {
  display: block; width: 240px; height: 240px; margin: 0 auto;
  background: #fff; padding: 10px; border-radius: var(--r);
}
.qr-codigo {
  word-break: break-all; font-size: 10.5px; background: var(--surface-3);
  padding: 10px; border-radius: var(--r); color: var(--text-muted);
}
.qr-estado { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-top: 14px; }


/* ---- escopo principal da proposta ---- */
.ep-secao {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.ep-secao-topo { display: flex; align-items: center; gap: 10px; }
.ep-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--r);
  background: var(--brand); color: var(--brand-contraste);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.ep-secao-topo .ep-titulo { flex: 1; min-width: 0; }
.ep-acoes { display: flex; gap: 4px; flex-shrink: 0; }
.ep-secao textarea { width: 100%; margin-top: 9px; }
.config-item-alto .edit { flex-direction: column; align-items: stretch; gap: 8px; }
.config-item-alto textarea { width: 100%; min-width: 320px; }


/* ---- senha redefinida: aparece uma vez so ---- */
.senha-nova {
  background: var(--orange-bg); border: 1px solid var(--brand);
  border-radius: var(--r); padding: 16px; margin: 4px 0 6px;
}
.senha-nova .t { font-size: 12px; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: .8px; }
.senha-nova code {
  display: block; margin: 10px 0; font-size: 19px; font-weight: 700;
  letter-spacing: .5px; word-break: break-all; color: var(--text);
}
.senha-nova .d { font-size: 12.5px; line-height: 1.6; color: var(--text-muted); margin-bottom: 10px; }


/* ---- demandas: o que pediram e o que decidimos ---- */
.demanda-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 15px 4px; border-bottom: 1px solid var(--border);
}
.demanda-item:last-child { border-bottom: none; }
.demanda-corpo { flex: 1; min-width: 0; }
.demanda-nome {
  font-size: 14.5px; font-weight: 600; display: flex; align-items: center;
  gap: 9px; flex-wrap: wrap;
}
.demanda-desc { font-size: 13px; line-height: 1.65; color: var(--text-faint); margin-top: 5px; }
.demanda-origem {
  font-size: 11.5px; color: var(--text-faint); margin-top: 7px;
  text-transform: uppercase; letter-spacing: .5px;
}
.demanda-acoes { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }

.selo-cx.alerta { background: var(--orange-bg); color: var(--orange); }

/* ---- cadastro: empresa e contato ---- */
.cad-contato {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 2px; border-bottom: 1px solid var(--border-soft);
}
.cad-contato:last-child { border-bottom: none; }
.cad-contato-nome { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cad-contato-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* --- o que falta fazer: uma lista só, em ordem de chegada --- */
.pend-busca { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.pend-busca input {
  flex: 1; max-width: 340px; padding: 8px 12px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
}
.pend-busca input:focus { outline: none; border-color: var(--brand); }
.pend-busca .muted { font-size: 12px; white-space: nowrap; }

.pend-lista { max-height: 620px; overflow-y: auto; }
.pend-linha {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.pend-linha:last-child { border-bottom: none; }
.pend-linha .pos {
  width: 30px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text-faint); font-size: 12.5px; padding-top: 2px;
}
.pend-linha .corpo { flex: 1; min-width: 0; }
.pend-linha .nome { font-size: 13.8px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pend-linha .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }
.pend-linha .trava {
  font-size: 12px; color: var(--brand); margin-top: 6px;
  display: flex; align-items: center; gap: 6px; line-height: 1.5;
}
.pend-linha .origem { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }

.lista-rolavel { max-height: 460px; overflow-y: auto; }

@media (max-width: 760px) {
  .pend-busca { flex-wrap: wrap; }
  .pend-busca input { max-width: none; }
  .pend-linha .pos { width: 22px; }
}
