:root {
  --tinta: #141414;      /* escuro da marca Uni.Destrava (topo/login) */
  --polvo: #f2b705;      /* dourado da marca (destaque em superfícies escuras) */
  --polvo-escuro: #b37f00; /* dourado legível sobre branco */
  --coral: #d92d20;      /* ação destrutiva (VibeUX) */
  --verde: #2e9e2b;      /* sucesso / ação secundária */
  --fundo: #f9fafb;      /* neutro VibeUX */
  --card: #ffffff;
  --borda: #eaecf0;
  --texto: #1d2939;
  --suave: #667085;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fundo); color: var(--texto); line-height: 1.5;
}
a { color: var(--polvo-escuro); text-decoration: none; }
a:hover { text-decoration: underline; }
.logo-mark { width: 26px; height: 26px; display: block; }
.logo-mark-grande { width: 46px; height: 46px; display: block; margin: 0 auto 6px; }

/* ---- Sidebar (VibeUX: sidebar para 4+ itens; Untitled UI: fundo claro, borda sutil) ---- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 232px; z-index: 100;
  background: var(--card); border-right: 1px solid var(--borda);
  display: flex; flex-direction: column;
}
/* Bloco da marca escuro: eco do login e da identidade Uni.Destrava, flat */
.sidebar-marca {
  background: var(--tinta); color: #fff; font-weight: 700; font-size: 1.12rem;
  letter-spacing: .3px; display: flex; align-items: center; gap: 9px; padding: 15px 18px;
  flex: 0 0 auto;
}
.sidebar-marca span { color: var(--polvo); }
/* O texto da marca é um span próprio (pra sumir no trilho); ele fica branco, só o "pus" interno é dourado */
.sidebar-marca .marca-texto { color: #fff; }
/* Botão recolher/expandir: ícone de painel na borda superior, ao lado da marca
   (padrão Untitled UI / Notion / Linear — se reconhece sem ler nada) */
.sb-alternar {
  margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px;
  background: none; color: rgba(255,255,255,.55); cursor: pointer;
}
.sb-alternar:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 10px; }
.sidebar-rodape { flex: 0 0 auto; border-top: 1px solid var(--borda); padding: 6px 10px 12px; }
/* Rótulo de grupo: pequeno, maiúsculo, discreto (600 — nada de negrito pesado) */
.menu-grupo {
  font-size: .67rem; text-transform: uppercase; letter-spacing: .7px;
  color: #98a2b3; font-weight: 600; margin: 16px 10px 4px;
}
.sidebar-rodape .menu-grupo { margin-top: 8px; }
.menu-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 13px; margin: 1px 0; border-radius: 8px;
  color: var(--texto); font-size: .9rem; font-weight: 500; line-height: 1.3;
}
.menu-item:hover { background: #f3f4f6; text-decoration: none; }
.menu-item .mi-ico { flex: 0 0 18px; color: var(--suave); }
.menu-item:hover .mi-ico { color: var(--texto); }
.mi-rotulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Item ativo sempre destacado (VibeUX): fundo dourado-claro + barra à esquerda */
.menu-item.ativo { background: #fdf7e6; color: var(--tinta); font-weight: 600; }
.menu-item.ativo .mi-ico { color: var(--polvo-escuro); }
.menu-item.ativo::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 3px; background: var(--polvo);
}
.menu-item.sair, .menu-item.sair .mi-ico { color: var(--coral); }
.menu-item.sair:hover { background: #fde8e6; }
.sair-nome {
  margin-left: auto; font-size: .74rem; font-weight: 500; color: var(--suave);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px;
}
/* Badge de pendência no menu (nº de conversas não lidas) */
.badge-menu {
  background: var(--polvo); color: #141414; font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 20px; vertical-align: 2px;
}
.menu-item .badge-menu { margin-left: auto; vertical-align: 0; }

/* Conteúdo ao lado da sidebar; min-width:0 deixa filhos largos (kanban) rolarem por dentro.
   position:relative ancora o selo de módulo no canto superior direito. */
.conteudo { min-height: 100vh; position: relative; }
.conteudo.com-sidebar { margin-left: 232px; min-width: 0; }

/* Topo mobile + véu do overlay (só aparecem abaixo de 900px) */
.topo-mobile { display: none; }
.veu { display: none; }
@media (max-width: 900px) {
  .topo-mobile {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 90;
    background: var(--tinta); color: #fff; padding: 10px 14px;
  }
  .topo-mobile .marca-mini { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
  .topo-mobile .marca-mini span { color: var(--polvo); }
  .btn-menu { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; display: flex; }
  .conteudo.com-sidebar { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  body.menu-aberto .sidebar { transform: none; box-shadow: 0 0 44px rgba(0,0,0,.3); }
  body.menu-aberto .veu { display: block; position: fixed; inset: 0; z-index: 95; background: rgba(20,20,20,.45); }
}

.container { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
/* Tipografia leve (Untitled UI): títulos 600 com tracking justo, nada de negrito pesado */
h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
h2, h3 { font-weight: 600; }
b, strong { font-weight: 600; }
.sub { color: var(--suave); margin-bottom: 26px; font-size: .9rem; }

/* Cards de funcionalidade */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--borda); border-radius: 12px;
  padding: 18px 20px; transition: border-color .12s, box-shadow .12s;
}
/* Hover leve (Untitled UI): borda um tom acima + sombra rasa — sem "pular" */
.card:hover { border-color: #d0d5dd; box-shadow: 0 2px 8px rgba(16,24,40,.06); }
.card .modulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--polvo-escuro); font-weight: 600; }
.card h3 { font-size: 1.02rem; margin: 6px 0 4px; }
.card p { font-size: .85rem; color: var(--suave); }
/* Ação do card: link discreto com seta (terciário) — a tela não vira um mar de botões */
.card-link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 12px;
  font-size: .84rem; font-weight: 600; color: var(--polvo-escuro);
}
.card-link svg { transition: transform .12s ease; }
.card:hover .card-link svg { transform: translateX(2px); }

/* ---- KPIs do painel (Untitled UI: número grande e FINO, rótulo pequeno acima,
   muito respiro — nada de negrito pesado nem borda gritando) ---- */
.kpi-grade {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 16px; margin: 4px 0 36px;
}
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--borda); border-radius: 12px;
  padding: 20px; color: inherit; transition: border-color .12s, box-shadow .12s;
}
.kpi:hover { text-decoration: none; border-color: #d0d5dd; box-shadow: 0 2px 8px rgba(16,24,40,.06); }
.kpi-rotulo { font-size: .8rem; font-weight: 500; color: var(--suave); }
.kpi-numero {
  font-size: 2.1rem; font-weight: 400; letter-spacing: -.02em; line-height: 1.2;
  color: var(--texto); font-variant-numeric: tabular-nums;
}
.kpi-numero.kpi-alerta { color: var(--coral); }
.kpi-desc { font-size: .8rem; color: var(--suave); line-height: 1.45; }

/* Rótulo de seção do painel: separa os KPIs da grade de funcionalidades */
.secao-rotulo {
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .7px;
  color: var(--suave); margin: 0 0 12px;
}

/* Login */
.login-tela { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--tinta); }
.login-caixa { background: #fff; padding: 34px 30px; border-radius: 16px; width: 100%; max-width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-caixa .logo { text-align: center; font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; color: var(--tinta); }
.login-caixa .logo span { color: var(--polvo); }
.login-caixa .tag { text-align: center; color: var(--suave); font-size: .85rem; margin-bottom: 22px; }

label { display: block; font-size: .82rem; color: #475467; margin: 12px 0 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; font-size: .95rem;
}
input:focus, select:focus { outline: none; border-color: var(--polvo); }
.btn {
  width: 100%; margin-top: 18px; padding: 11px; border: 0; border-radius: 8px;
  background: var(--polvo); color: #141414; font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: background .1s, box-shadow .1s;
}
.btn:hover { background: #d9a600; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.btn-mini { width: auto; margin: 0; padding: 7px 14px; font-size: .82rem; }
/* Botão secundário: contorno, sem preenchimento (VibeUX) */
.btn-sec { background: #fff; color: var(--texto); border: 1px solid var(--borda); }
.btn-sec:hover { background: #f3f4f6; box-shadow: none; }
/* Botão destrutivo: vermelho + texto branco (VibeUX) */
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { background: #b42318; }
.erro { background: #fde8e6; color: #b3382c; padding: 9px 12px; border-radius: 8px; font-size: .85rem; margin-bottom: 8px; }

/* Tabelas */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--borda); }
th, td { text-align: left; padding: 10px 14px; font-size: .875rem; border-bottom: 1px solid var(--borda); }
/* Cabeçalho de tabela leve (Untitled UI): cinza suave, sem caixa alta gritada */
th { background: #f9fafb; color: var(--suave); font-size: .76rem; font-weight: 600;
     text-transform: none; letter-spacing: .2px; }
td { line-height: 1.5; }
tr:last-child td { border-bottom: 0; }
.tag-papel { font-size: .72rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.tag-admin { background: #e0f2f1; color: var(--polvo-escuro); }
.tag-suporte { background: #eef2f7; color: #64748b; }
.pilula { font-size: .72rem; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.on { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.off { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
/* Badges de status de funcionalidade (painel) */
.badge { font-size: .68rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.badge-pronto { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-breve { background: #f3f4f6; color: #667085; border: 1px solid #e5e7eb; }
.card-off { opacity: .62; }

.painel { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 18px 20px; margin-top: 18px; }
.painel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.linha-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.linha-form > div { flex: 1; min-width: 140px; }
.check-linha { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .9rem; }
.check-linha input { width: auto; }
.aviso { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 14px; border-radius: 8px; font-size: .85rem; margin-bottom: 14px; }

/* ---- Grupos colapsáveis da sidebar (clique no rótulo; estado por grupo em localStorage) ---- */
/* O rótulo vira botão mas mantém o visual de .menu-grupo; só ganha o chevron e a área de clique */
button.grupo-rotulo {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: calc(100% - 20px); background: none; border: 0; padding: 0;
  font-family: inherit; text-align: left; cursor: pointer;
}
button.grupo-rotulo:hover, button.grupo-rotulo:hover .chev { color: var(--texto); }
.grupo-rotulo .chev { flex: 0 0 12px; color: var(--suave); transition: transform .15s ease; }
/* Grupo fechado: chevron aponta pro lado e os itens somem (classe g-*-off no <html>) */
html.g-atendimento-off .grupo-rotulo[data-grupo="atendimento"] .chev,
html.g-whatsapp-off .grupo-rotulo[data-grupo="whatsapp"] .chev,
html.g-crescimento-off .grupo-rotulo[data-grupo="crescimento"] .chev,
html.g-config-off .grupo-rotulo[data-grupo="config"] .chev { transform: rotate(-90deg); }
html.g-atendimento-off .grupo-itens[data-grupo="atendimento"],
html.g-whatsapp-off .grupo-itens[data-grupo="whatsapp"],
html.g-crescimento-off .grupo-itens[data-grupo="crescimento"],
html.g-config-off .grupo-itens[data-grupo="config"] { display: none; }

/* ---- Modo trilho (sb-mini no <html>): sidebar de 56px só com ícones — desktop apenas;
   no celular a sidebar segue como overlay completo ---- */
@media (min-width: 901px) {
  .sidebar { transition: width .18s ease; }
  .conteudo.com-sidebar { transition: margin-left .18s ease; }
  html.sb-mini .sidebar { width: 56px; }
  html.sb-mini .conteudo.com-sidebar { margin-left: 56px; }
  /* No trilho a marca vira coluna: logo em cima, botão de expandir logo abaixo —
     o botão continua no MESMO canto de sempre (não some, não muda de lugar) */
  html.sb-mini .sidebar-marca { flex-direction: column; gap: 8px; padding: 12px 0 10px; }
  html.sb-mini .sb-alternar { margin-left: 0; }
  html.sb-mini .marca-texto { display: none; }
  html.sb-mini .sidebar-nav { padding: 12px 6px; }
  html.sb-mini .sidebar-rodape { padding: 6px 6px 8px; }
  /* Some texto e rótulos; nomes seguem acessíveis pelo title (tooltip nativo) */
  html.sb-mini .mi-rotulo, html.sb-mini .sair-nome, html.sb-mini .grupo-rotulo { display: none; }
  /* No trilho os grupos ficam sempre "expandidos" (só os ícones); vence o g-*-off por especificidade */
  html.sb-mini .sidebar .grupo-itens[data-grupo] { display: block; }
  html.sb-mini .menu-item { justify-content: center; padding: 9px 0; }
  /* Badge de não lidas vira pontinho dourado sobre o ícone do Inbox */
  html.sb-mini .menu-item .badge-menu {
    position: absolute; top: 4px; right: 12px; margin: 0;
    width: 10px; height: 10px; padding: 0; border-radius: 50%;
    font-size: 0; line-height: 0; overflow: hidden; border: 2px solid var(--card);
  }
}
@media (max-width: 900px) {
  /* No celular o menu é overlay: recolher em trilho não se aplica */
  .sb-alternar { display: none; }
}

/* ---- Selo de módulo: pílula discreta no canto superior direito de toda tela ---- */
.selo-modulo {
  position: absolute; top: 12px; right: 16px; z-index: 5; pointer-events: none;
  font-size: .68rem; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--suave); background: var(--card); border: 1px solid var(--borda);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
@media (max-width: 900px) { .selo-modulo { top: 8px; right: 10px; } }

/* ---- Rodapé da sidebar enxuto: um único item "Configurações" (engrenagem) que
   expande os itens administrativos, + "Sair". Fechado por padrão (Krug:
   progressive disclosure — o eventual fica escondido até precisar). ---- */
button.menu-item.config-toggle {
  width: 100%; background: none; border: 0; font-family: inherit; font-size: .9rem;
  font-weight: 500; cursor: pointer;
}
.menu-item.config-toggle .chev {
  margin-left: auto; flex: 0 0 12px; color: var(--suave); transition: transform .15s ease;
}
html.g-config-off .menu-item.config-toggle[data-grupo="config"] .chev { transform: rotate(-90deg); }
/* Itens internos levemente recuados: lê-se como "dentro de Configurações" */
.grupo-itens.grupo-config .menu-item { padding-left: 24px; }
@media (min-width: 901px) {
  /* No trilho (sb-mini) o toggle segue visível como ícone e continua mandando:
     este seletor (2 classes) vence o "grupo-itens sempre visíveis" do modo mini */
  html.sb-mini .menu-item.config-toggle { justify-content: center; padding: 9px 0; }
  html.sb-mini .menu-item.config-toggle .chev { display: none; }
  html.sb-mini.g-config-off .sidebar .grupo-itens[data-grupo="config"] { display: none; }
  html.sb-mini .grupo-itens.grupo-config .menu-item { padding-left: 0; }
}
