/* ERP BNK — estilos base */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #17202c;
  --muted: #5c6878;
  --line: #e2e6ec;
  --brand: #011035;      /* azul-marinho da logo BNK Héstia */
  --brand-2: #17336e;
  --laranja: #ef461c;    /* chama da logo */
  --laranja-claro: #f7931e;
  --accent: #1f7a5c;
  --warn: #b26b00;
  --danger: #b3261e;
  --radius: 8px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #cfd9e6; padding: 20px 14px; display: flex;
  flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 2px; }
.logo img { width: 36px; height: 36px; }
.logo strong { display: block; font-size: 17px; letter-spacing: .01em; }
.logo small { display: block; font-weight: 400; color: #8fa4bd; font-size: 12px; }
.empresa-atual { margin: 14px 0 10px; padding: 10px; border-radius: var(--radius);
  background: rgba(255,255,255,.07); font-size: 12.5px; }
.empresa-atual strong { color: #fff; display: block; font-size: 13.5px; }
.empresa-atual a { color: #9cc3f0; }
.nav-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d93ad;
  margin: 14px 10px 4px; }
.sidebar a.item { color: #dbe4ef; padding: 7px 10px; border-radius: 6px; display: block; }
.sidebar a.item:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar a.item.ativo { background: rgba(255,255,255,.12); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--laranja); }
.sidebar .rodape { margin-top: auto; font-size: 12.5px; padding: 10px; }
.sidebar .rodape button { background: none; border: 0; color: #9cc3f0; padding: 0; cursor: pointer; font: inherit; }

main { padding: 28px 32px 48px; max-width: 1240px; width: 100%; }
.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap; }
.cabecalho .sub { color: var(--muted); margin-top: 2px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.kpi { padding: 16px 18px; }
.kpi .rotulo { color: var(--muted); font-size: 12.5px; }
.kpi .valor { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .det { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.vazio { color: var(--muted); padding: 24px 10px; text-align: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; }
.btn:hover { background: #f1f3f6; text-decoration: none; }
.btn.prim { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.prim:hover { background: var(--brand); }
.btn.perigo { color: var(--danger); }
.btn.peq { padding: 4px 10px; font-size: 13px; }
form.inline { display: inline; }

.form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.campo { display: flex; flex-direction: column; gap: 5px; grid-column: span 6; }
.campo.c2 { grid-column: span 2; } .campo.c3 { grid-column: span 3; } .campo.c4 { grid-column: span 4; }
.campo.c8 { grid-column: span 8; } .campo.c12 { grid-column: span 12; }
label { font-size: 12.5px; font-weight: 600; color: #384556; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd6df; border-radius: 6px;
  background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #fbd3c4; border-color: var(--laranja); }
textarea { min-height: 84px; resize: vertical; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filtros .campo { grid-column: auto; min-width: 150px; }
.form-acoes { grid-column: span 12; display: flex; gap: 8px; margin-top: 4px; }

.alerta { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid; }
.alerta.erro { background: #fdecea; border-color: #f4c5c1; color: #7a1c15; }
.alerta.ok { background: #e7f5ee; border-color: #b8e0cb; color: #14533d; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #eef1f5; color: #3a4757; white-space: nowrap; }
.tag.ativo, .tag.pago { background: #e3f3ea; color: #17603f; }
.tag.vencido, .tag.cancelado, .tag.encerrado { background: #fbe7e5; color: #8f2219; }
.tag.parcial, .tag.suspenso, .tag.a60 { background: #fdf1dc; color: #7c4b00; }
.tag.a30 { background: #fbe1cf; color: #8a3a00; }
.tag.rascunho, .tag.aberto { background: #e7eef8; color: #1d4f86; }

dl.dados { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin: 0; }
dl.dados dt { color: var(--muted); }
dl.dados dd { margin: 0; }
.abas { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.abas a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.abas a.ativo { color: var(--ink); border-color: var(--laranja); font-weight: 600; }
.abas a:hover { text-decoration: none; color: var(--ink); }
pre.json { font-size: 12px; background: #f6f8fa; padding: 6px 8px; border-radius: 6px; margin: 0;
  white-space: pre-wrap; word-break: break-word; max-width: 420px; }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--brand);
  background-image: radial-gradient(circle at 15% 110%, rgba(239,70,28,.28), transparent 45%); }
.login .card { width: 400px; padding: 32px 30px 28px; }
.login .marca { display: block; width: 260px; max-width: 100%; margin: 0 auto 20px; }
.login .faixa { height: 4px; margin: -32px -30px 28px; border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #ffa000, var(--laranja), #e2262a); }
.login .form { grid-template-columns: 1fr; }
.login .campo { grid-column: auto; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .campo, .campo.c2, .campo.c3, .campo.c4, .campo.c8 { grid-column: span 12; }
  main { padding: 20px 16px; }
}

.paginacao { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
code { background: #f1f3f6; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
.aviso { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; background: #fff4e5;
  border: 1px solid #f5cf9b; color: #6b3d00; }
.campo.c9 { grid-column: span 9; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 14px; }
.check input { width: auto; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { padding: 12px 14px; border-radius: 10px; max-width: 85%; white-space: pre-wrap; line-height: 1.55; }
.msg.usuario { align-self: flex-end; background: #e8eef9; }
.msg.assistente { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msg .fontes { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.barra { height: 8px; border-radius: 4px; background: #eef1f5; overflow: hidden; min-width: 80px; }
.barra span { display: block; height: 100%; background: var(--accent); }
.barra.neg span { background: var(--danger); }

/* CRM: funil */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto;
  padding-bottom: 8px; margin-bottom: 12px; }
.coluna { background: #eceff4; border-radius: var(--radius); padding: 10px; min-height: 360px; transition: background .15s; }
.coluna.alvo { background: #fde7dd; outline: 2px dashed var(--laranja); }
.coluna-topo { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 10px; font-size: 13.5px; }
.coluna-corpo { display: flex; flex-direction: column; gap: 10px; }
.cartao { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.04); cursor: grab; }
.cartao:hover { text-decoration: none; border-color: #b9c4d3; }
.cartao.movendo { opacity: .45; }
.cartao-titulo { font-weight: 600; margin-bottom: 2px; }
.cartao-rodape { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
[hidden] { display: none !important; }
.subnav { margin-top: -6px; }
a.card.atalho { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; transition: border-color .15s; }
a.card.atalho:hover { border-color: var(--laranja); }
.recursos .tag { margin: 0 4px 6px 0; display: inline-block; }
details.mais { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
details.mais > summary { cursor: pointer; color: var(--azul, #011035); font-weight: 600; list-style: none; margin-bottom: 10px; }
details.mais > summary::before { content: "+ "; }
details.mais[open] > summary::before { content: "− "; }
details.mais > .form { padding: 0; }
.passos ol { margin: 0 0 10px; padding-left: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 32px; }
@media (max-width: 900px) { .passos ol { grid-template-columns: 1fr; } }
.passos li span { display: block; font-size: 13px; }
.passos li.feito a strong { text-decoration: line-through; color: var(--muted); }
.passos li.feito::marker { color: var(--laranja); }

/* Ajuda: botão, painel lateral, tour e textos (app/services/ajuda.py, static/ajuda.js) */
.ajuda-botao { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px; padding: 10px 16px; font: 600 14px var(--sans);
  box-shadow: 0 4px 14px rgba(1, 16, 53, .25); cursor: pointer; }
.ajuda-botao:hover { background: #0a1f55; }
.ajuda-botao.tem-novidade::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--laranja);
  box-shadow: 0 0 0 2px var(--brand); margin-left: 2px; }
.ajuda-gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 50; background: var(--card);
  border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0, 0, 0, .08); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s ease; }
.ajuda-gaveta.aberta { transform: none; }
.ajuda-gaveta-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--line); font-size: 16px; }
.ajuda-fechar { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.ajuda-gaveta-corpo { padding: 16px 18px; overflow-y: auto; flex: 1; }
.ajuda-gaveta-rodape { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); }
.ajuda-texto { line-height: 1.6; }
.ajuda-texto h2 { font-size: 17px; margin: 18px 0 6px; }
.ajuda-texto h3 { font-size: 15px; margin: 14px 0 4px; }
.ajuda-texto h4, .ajuda-texto h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 14px 0 4px; }
.ajuda-texto > :first-child { margin-top: 0; }
.ajuda-texto ul, .ajuda-texto ol { padding-left: 22px; margin: 6px 0 10px; }
.ajuda-texto li { margin: 3px 0; }
.ajuda-texto code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.ajuda-texto .dica { border-left: 3px solid var(--laranja); background: #fff6f2; padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 10px 0; }
.ajuda-nav { display: flex; justify-content: space-between; margin: 8px 2px 24px; }
.sidebar a.item.tour-destaque { position: relative; z-index: 61; outline: 2px solid var(--laranja); outline-offset: 2px;
  background: rgba(239, 70, 28, .18); border-radius: 6px; }
.tour-balao { position: fixed; z-index: 62; width: 320px; background: var(--card); border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tour-balao::before { content: ""; position: absolute; left: -7px; top: 18px; width: 12px; height: 12px; background: var(--card);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.tour-balao p { margin: 0; color: var(--ink); line-height: 1.5; }
.tour-rodape { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.tour-rodape div { display: flex; gap: 6px; }
.tour-convite { position: fixed; right: 20px; bottom: 74px; z-index: 39; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--laranja); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tour-convite span { flex: 1 1 100%; line-height: 1.5; }
@media (max-width: 760px) { .tour-balao { left: 12px !important; right: 12px; width: auto; } .tour-balao::before { display: none; } }
