/* Zap — wireframe navegavel (sindicancia 117 / tarefa #2144). Tudo no navegador, sem backend. */
:root {
  --verde: #16a34a;
  --verde-zap: #25d366;
  --verde-escuro: #075e54;
  --verde-teal: #128c7e;
  --verde-claro: #dcfce7;
  --fundo: #f6f7f9;
  --card: #ffffff;
  --borda: #e5e7eb;
  --texto: #111827;
  --cinza: #6b7280;
  --escuro: #0f172a;
  --amarelo: #f59e0b;
  --vermelho: #ef4444;
  --azul: #3b82f6;
  --roxo: #8b5cf6;
  --raio: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 14px;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* Botoes e Chips com area de toque minima para acessibilidade (44px) */
.btn {
  border: 1px solid var(--borda);
  background: #fff;
  color: var(--texto);
  border-radius: 9px;
  padding: 10px 16px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.prim { background: #15803d; border-color: #15803d; color: #fff; }
.btn.prim:hover { background: #166534; }
.btn.peq { padding: 6px 12px; font-size: 13px; min-height: 44px; }
.btn.alt { background: transparent; border-color: transparent; color: var(--cinza); }
.btn.alt:hover { background: #f1f5f9; color: var(--texto); }
.btn:disabled { opacity: 0.5; cursor: default; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  background: #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}
.chip.ok { background: var(--verde-claro); color: #14532d; }
.chip.breve { background: #fef3c7; color: #78350f; }
.chip.azul { background: #dbeafe; color: #1e3a8a; }
.chip.verm { background: #fee2e2; color: #7f1d1d; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #052e16, #14532d 55%, #15803d); padding: 16px; }
.login .caixa { background: #fff; border-radius: 18px; padding: 34px; width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.marca .logo { width: 36px; height: 36px; border-radius: 10px; background: #15803d; display: grid; place-items: center; color: #fff; font-size: 20px; }
.login label { display: block; font-size: 13px; font-weight: 600; color: var(--cinza); margin: 14px 0 4px; }
.login input { width: 100%; padding: 11px 12px; border: 1px solid var(--borda); border-radius: 9px; font-size: 14px; min-height: 44px; }
.login .btn { width: 100%; margin-top: 18px; padding: 12px; min-height: 46px; }
.login small { display: block; margin-top: 12px; color: var(--cinza); text-align: center; font-size: 13px; }

/* Casca e Navegacao */
.casca { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--escuro) 240px, transparent 240px); }
.lateral { background: var(--escuro); color: #cbd5e1; padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral .marca { color: #fff; font-size: 19px; padding: 4px 8px 16px; }
.lateral .grupo { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: #cbd5e1; margin: 16px 10px 6px; font-weight: 700; }
.lateral a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; min-height: 44px; }
.lateral a:hover { background: #1e293b; color: #fff; }
.lateral a.ativo { background: #15803d; color: #fff; font-weight: 600; }
.lateral a .ic { width: 22px; text-align: center; font-size: 16px; }

.topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 20; }
.topo .busca { flex: 1; max-width: 380px; padding: 9px 12px; border: 1px solid var(--borda); border-radius: 9px; background: var(--fundo); min-height: 44px; font-size: 13px; }
.topo .direita { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #fde68a; display: grid; place-items: center; font-weight: 800; cursor: pointer; user-select: none; }
.hamb { display: none; border: 0; background: none; font-size: 24px; min-width: 44px; min-height: 44px; cursor: pointer; color: var(--texto); align-items: center; justify-content: center; }

.conteudo { padding: 24px 26px 80px; min-width: 0; max-width: 1400px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.sub { color: #475569; margin: 0 0 18px; font-size: 13.5px; }

/* Grid e Cards */
.grade { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 18px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* KPIs */
.kpi { display: flex; flex-direction: column; justify-content: space-between; }
.kpi .r { font-size: 13px; color: #475569; }
.kpi .n { font-size: 26px; font-weight: 800; margin: 4px 0; color: var(--texto); }
.kpi .up { color: #15803d; font-weight: 700; }
.kpi .down { color: #b91c1c; font-weight: 700; }

/* Tabelas e Wrappers responsivos */
.tabela-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--borda); font-size: 13px; vertical-align: middle; }
th { color: var(--cinza); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
.barra { height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 4px 0; }
.barra i { display: block; height: 100%; background: var(--verde); border-radius: 99px; }

/* Funcoes do Catalogo */
.funcoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.funcao { border: 1px solid var(--borda); border-radius: 10px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.funcao b { font-size: 13.5px; }
.funcao span { font-size: 13px; color: #475569; line-height: 1.35; flex: 1; }

/* Setores / Modelos de Negocio */
.setores { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.setor { border: 2px solid var(--borda); border-radius: 12px; padding: 12px 8px; text-align: center; background: #fff; cursor: pointer; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: all 0.15s; }
.setor .em { font-size: 26px; line-height: 1.2; }
.setor b { font-size: 13px; line-height: 1.2; margin-top: 4px; color: var(--texto); }
.setor.sel { border-color: var(--verde); background: #f0fdf4; box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2); }
.mods { display: flex; flex-wrap: wrap; gap: 6px; }
.fluxo-pronto { border-left: 4px solid var(--verde); padding: 12px 14px; background: #f8fafc; border-radius: 8px; margin-bottom: 10px; }

/* Passos / Wizard */
.passos { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.passo { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--borda); font-size: 13px; color: #475569; min-height: 44px; display: flex; align-items: center; }
.passo b { display: block; color: var(--texto); font-size: 13px; }
.passo.at { border-color: var(--verde); background: #f0fdf4; font-weight: 700; }
.passo.feito b::after { content: " ✓"; color: var(--verde); }
.solta { border: 2px dashed #cbd5e1; border-radius: 14px; padding: 28px 16px; text-align: center; background: #fff; }
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.campo label { font-size: 13px; color: #475569; font-weight: 600; }
.campo input, .campo select, .campo textarea { padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; font: inherit; background: #fff; min-height: 44px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
.vars { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.vars button { border: 1px solid var(--borda); background: #f8fafc; border-radius: 99px; padding: 6px 12px; font-size: 13px; min-height: 44px; font-weight: 600; }

/* Celular Mockup */
.celular { width: 310px; max-width: 100%; border: 10px solid #111; border-radius: 32px; background: #efeae2; margin: 0 auto; overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,0.15); }
.celular .cab-cel { background: #075e54; color: #fff; padding: 10px 12px; font-weight: 600; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.celular .msgs { padding: 12px; min-height: 330px; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bal { max-width: 85%; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; box-shadow: 0 1px 1px rgba(0,0,0,0.1); white-space: pre-wrap; word-break: break-word; }
.bal.ent { background: #fff; align-self: flex-start; }
.bal.sai { background: #d9fdd3; align-self: flex-end; }
.bal .hora { display: block; text-align: right; font-size: 13px; color: #475569; margin-top: 3px; }
.opcs { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.opcs button { background: #fff; border: 1px solid #cfe9dd; color: #0369a1; border-radius: 16px; padding: 8px 12px; font-size: 13px; font-weight: 600; min-height: 44px; }
.audio-bal { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.audio-bal .onda { flex: 1; height: 22px; background: repeating-linear-gradient(90deg, #8696a0 0 2px, transparent 2px 5px); opacity: 0.7; border-radius: 3px; }

/* Editor de Fluxo */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; max-width: 100%; }
.tela-fluxo { position: relative; height: 600px; background: #fff radial-gradient(#e5e7eb 1.5px, transparent 1.5px) 0 0/20px 20px; border: 1px solid var(--borda); border-radius: var(--raio); overflow: auto; max-width: 100%; }
.tela-fluxo .plano { position: relative; width: 1180px; height: 900px; }
.tela-fluxo svg { position: absolute; inset: 0; pointer-events: none; }
.no { position: absolute; width: 200px; background: #fff; border: 2px solid var(--borda); border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.06); cursor: grab; user-select: none; }
.no.sel { border-color: var(--verde); box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15); }
.no .t { padding: 8px 12px; border-radius: 10px 10px 0 0; font-size: 13px; font-weight: 800; color: #fff; display: flex; justify-content: space-between; }
.no .c { padding: 9px 12px; font-size: 13px; line-height: 1.35; }
.no .op { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 12px; border-top: 1px solid #f1f5f9; color: #0369a1; }
.no.inicio .t { background: #0f172a; }
.no.pergunta .t { background: #1d4ed8; }
.no.mensagem .t { background: #15803d; }
.no.acao .t { background: #6d28d9; }
.no.condicao .t { background: #b45309; }
.no.humano .t { background: #b91c1c; }
.no.espera .t { background: #475569; }
.paleta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.paleta button { border: 1px solid var(--borda); background: #fff; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; min-height: 44px; }
.lado { display: flex; flex-direction: column; gap: 14px; max-width: 100%; min-width: 0; }

/* Inbox Multiatendente */
.inbox { display: grid; grid-template-columns: 290px minmax(0, 1fr) 260px; height: calc(100vh - 160px); min-height: 540px; border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; background: #fff; max-width: 100%; }
.inbox .lista { border-right: 1px solid var(--borda); overflow-y: auto; }
.conv { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; cursor: pointer; display: flex; gap: 10px; align-items: center; min-height: 64px; }
.conv:hover, .conv.sel { background: #f0fdf4; }
.conv .av { width: 40px; height: 40px; border-radius: 50%; background: #e2e8f0; color: #1e293b; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 14px; }
.conv.sel .av { background: #15803d; color: #ffffff; }
.conv .meio { flex: 1; min-width: 0; }
.conv .meio b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .meio span { display: block; font-size: 13px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox .chat { display: flex; flex-direction: column; background: #efeae2; min-width: 0; }
.inbox .chat .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.inbox .escrever { display: flex; gap: 8px; padding: 10px 12px; background: #f0f2f5; align-items: center; }
.inbox .escrever button { min-width: 44px; min-height: 44px; padding: 8px 12px; font-size: 14px; }
.inbox .escrever input { flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--borda); min-height: 44px; font-size: 13.5px; min-width: 0; }
.inbox .ficha { border-left: 1px solid var(--borda); padding: 16px; overflow-y: auto; }

/* Abas e Gravador */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin-bottom: 14px; overflow-x: auto; }
.abas button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: #475569; border-bottom: 2px solid transparent; white-space: nowrap; min-height: 44px; font-size: 13px; }
.abas button.at { color: #15803d; border-color: #15803d; font-weight: 700; }
.gravador { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--borda); border-radius: 12px; background: #f8fafc; }
.rec { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--vermelho); color: #fff; font-size: 22px; min-height: 54px; min-width: 54px; display: grid; place-items: center; }
.rec.on { animation: pulso 1s infinite; }
@keyframes pulso { 50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0.25); } }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 100; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); font-weight: 500; pointer-events: none; }

/* Estado Vazio */
.estado-vazio { text-align: center; padding: 40px 16px; background: #fff; border: 2px dashed var(--borda); border-radius: var(--raio); margin: 14px 0; }
.estado-vazio .ico { font-size: 42px; margin-bottom: 10px; }
.estado-vazio h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.estado-vazio p { color: var(--cinza); margin: 0 0 16px; font-size: 13px; max-width: 440px; margin-left: auto; margin-right: auto; line-height: 1.4; }

/* Modal */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 110; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-caixa { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 40px rgba(0,0,0,0.25); }
.modal-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-topo h3 { margin: 0; font-size: 17px; }
.modal-fechar { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--cinza); min-height: 44px; min-width: 44px; display: grid; place-items: center; }

/* Responsividade Mobile (390x844 e tablets) */
.mob-nav { display: none; }
@media (max-width: 900px) {
  .casca { grid-template-columns: minmax(0, 1fr); background: none; max-width: 100vw; overflow-x: hidden; }
  .lateral { position: fixed; left: -270px; width: 260px; z-index: 40; transition: left 0.2s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 4px 0 20px rgba(0,0,0,0.2); visibility: hidden; pointer-events: none; }
  .lateral.aberta { left: 0; visibility: visible; pointer-events: auto; }
  .hamb { display: inline-flex; }
  .topo { padding: 10px 14px; max-width: 100vw; overflow-x: hidden; }
  .topo .busca { display: none; }
  .topo .direita .chip.azul { display: none; }
  .conteudo { padding: 14px 12px 90px; max-width: 100vw; overflow-x: hidden; }
  .card { max-width: 100%; }
  .tabela-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .solta { max-width: 100%; word-break: break-word; }
  .solta b, .solta p { word-break: break-word; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3, .g2 { grid-template-columns: 1fr; }
  .editor { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
  .tela-fluxo { height: 440px; max-width: 100%; }
  .lado { max-width: 100%; min-width: 0; }
  .paleta { max-width: 100%; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; max-width: 100%; }
  .inbox .ficha { display: none; }
  .inbox .lista { max-height: 240px; max-width: 100%; }
  .inbox .chat { min-height: 400px; max-width: 100%; }
  .mob-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--borda); z-index: 30; justify-content: space-around; padding: 4px 2px; }
  .mob-nav a { display: flex; flex-direction: column; align-items: center; font-size: 13px; color: #475569; gap: 2px; min-height: 44px; min-width: 44px; flex: 1; justify-content: center; padding: 0 2px; }
  .mob-nav a.ativo { color: #15803d; font-weight: 700; }
  .mob-nav a .ic { font-size: 19px; }
  .passo { min-width: 0; flex: 1 1 45%; font-size: 13px; }
  .passo b { font-size: 13px; }
}
