/* Laboratório de Testes — paleta da Central/site: azul-marinho + laranja; verde estilo WhatsApp só nos aparelhos. */
:root {
  --navy: #102a43; --navy-2: #0b1d30; --navy-3: #06121f;
  --laranja: #f2741c; --laranja-2: #a94b07;
  --fundo: #f4f6f9; --cartao: #ffffff; --linha: #e0e6ed; --texto: #142334; --suave: #5b6b7d;
  --ok: #0f8a5f; --alerta: #b7791f; --perigo: #c0392b;
  --wa-cab: #0f5c4c; --wa-fundo: #0e1a20; --wa-entra: #1f2c33; --wa-sai: #005c4b; --wa-texto: #e9edef; --wa-suave: #8696a0;
  --raio: 14px;
  --sombra: 0 10px 30px rgba(11, 29, 48, .10);
  --f-titulo: "Archivo", system-ui, sans-serif;
  --f-texto: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --fundo: #08131f; --cartao: #0f1f30; --linha: #1e3247; --texto: #e6edf4; --suave: #93a5b8; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fundo); color: var(--texto); font: 15px/1.5 var(--f-texto); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-titulo); letter-spacing: -.01em; margin: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--suave); }
.pequeno { font-size: 12.5px; }
.erro { color: var(--perigo); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.rotulo { font: 500 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--laranja); }

/* botões */
.btn { font: 600 13.5px var(--f-texto); display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--linha); background: var(--cartao); color: var(--texto);
  border-radius: 10px; padding: 8px 13px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: #b9c6d3; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.laranja { background: var(--laranja); border-color: var(--laranja); color: #fff; }
.btn.laranja:hover { background: #e0650f; }
.btn.perigo { color: var(--perigo); }
.btn.perigo:hover { border-color: var(--perigo); }
.btn.fantasma { background: transparent; }
.btn.pequeno { padding: 5px 10px; font-size: 12.5px; }
.btn.largo { width: 100%; justify-content: center; }
.icone { background: none; border: 0; color: inherit; padding: 6px; cursor: pointer; border-radius: 8px; }
input, textarea, select { font: inherit; color: inherit; background: var(--cartao); border: 1px solid var(--linha); border-radius: 10px; padding: 9px 11px; width: 100%; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--laranja); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; margin-bottom: 12px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 80% -10%, #1d4466 0, transparent 60%), linear-gradient(160deg, var(--navy-2), var(--navy-3)); }
.login-card { width: min(400px, 100%); background: var(--cartao); border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card .marca { margin-bottom: 14px; color: var(--texto); }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; }

/* estrutura */
.app { display: grid; grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: 60px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topo { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 18px; background: var(--navy-2); color: #fff; border-bottom: 1px solid #13314d; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca img { width: 34px; height: 34px; }
.marca b { display: block; font: 700 15.5px var(--f-titulo); line-height: 1.1; }
.marca small { display: block; font: 500 10.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.agente { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  padding: 6px 12px 6px 6px; border-radius: 999px; max-width: 46vw; }
.agente #agenteTxt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agente .plug { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #4b5d70; transition: background .3s; }
.agente .plug svg { width: 15px; height: 15px; }
.agente.on .plug { background: var(--ok); box-shadow: 0 0 0 4px rgba(15,138,95,.25); }
.agente.alerta .plug { background: var(--alerta); }
.usuario { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.usuario .btn { color: #fff; border-color: rgba(255,255,255,.25); }

.lateral { background: var(--cartao); border-right: 1px solid var(--linha); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.busca { margin-top: 4px; }
.lista-titulo { font: 500 10.5px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--suave); margin-top: 10px; }
.sessoes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sessoes li { border: 1px solid var(--linha); border-radius: 11px; padding: 10px 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.sessoes li:hover { border-color: #b9c6d3; }
.sessoes li.atual { border-color: var(--laranja); background: rgba(242,116,28,.06); }
.sessoes li b { display: block; font-size: 13.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessoes li small { color: var(--suave); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sessoes .vazia { border-style: dashed; color: var(--suave); font-size: 12.5px; cursor: default; }
.ponto { width: 7px; height: 7px; border-radius: 50%; background: #9aa8b6; display: inline-block; }
.ponto.ativa { background: var(--ok); box-shadow: 0 0 0 3px rgba(15,138,95,.18); }
.ponto.pausada { background: var(--alerta); }

.principal { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.vazio { flex: 1; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.vazio-card { max-width: 620px; background: var(--cartao); border: 1px solid var(--linha); border-radius: 18px; padding: 30px; box-shadow: var(--sombra); }
.vazio-card h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; margin: 8px 0 14px; }
.vazio-card ol { padding-left: 20px; margin: 0 0 14px; }
.vazio-card li { margin: 7px 0; }

/* sessão */
.sessao { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sessao-topo { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 16px 20px 10px; flex-wrap: wrap; }
.sessao-titulo { min-width: 0; flex: 1 1 320px; }
.sessao-titulo h1 { font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.chip { font: 500 11.5px var(--f-mono); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--linha); color: var(--suave); background: var(--cartao); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: rgba(15,138,95,.35); background: rgba(15,138,95,.07); }
.chip.alerta { color: var(--alerta); border-color: rgba(183,121,31,.4); background: rgba(183,121,31,.08); }
.chip.fim { color: var(--suave); }
.acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.menu-exportar { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--cartao); border: 1px solid var(--linha); border-radius: 12px; box-shadow: var(--sombra);
  padding: 6px; display: flex; flex-direction: column; z-index: 20; min-width: 200px; }
.menu a, .menu button { font: inherit; font-size: 13.5px; text-align: left; padding: 9px 11px; border-radius: 8px; color: var(--texto); text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--fundo); }

.palco-barra { display: flex; gap: 10px; padding: 0 20px 10px; flex-wrap: wrap; align-items: center; }
.segmentos { display: inline-flex; background: var(--cartao); border: 1px solid var(--linha); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmentos button { font: 600 12.5px var(--f-texto); border: 0; background: none; color: var(--suave); padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.segmentos button.ativo { background: var(--navy); color: #fff; }
.so-estreito { display: none; }

.corpo-sessao { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; border-top: 1px solid var(--linha); }
.palco { min-width: 0; min-height: 0; display: flex; gap: 22px; justify-content: center; align-items: stretch; padding: 18px;
  background: radial-gradient(900px 400px at 50% 0, rgba(16,42,67,.07), transparent 70%), var(--fundo); overflow: auto; }

/* aparelhos */
.aparelho { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; transition: flex-basis .35s ease, max-width .35s ease; }
.aparelho.phone { flex: 0 1 360px; max-width: 360px; }
.aparelho.pc { flex: 1 1 520px; max-width: 640px; }
.ap-moldura { position: relative; width: 100%; flex: 1; min-height: 460px; max-height: 760px; display: flex; flex-direction: column; background: var(--wa-fundo);
  border: 9px solid #172532; border-radius: 34px; box-shadow: 0 24px 50px rgba(6,18,31,.28), inset 0 0 0 1px #2a3b4b; overflow: hidden; transition: border-radius .35s, border-width .35s; }
.pc .ap-moldura { border-radius: 12px; border-width: 1px; border-color: #2a3b4b; }
.ap-barra { display: none; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: #1b2a37; color: #8ea2b4; font-size: 11.5px; }
.ap-barra i { width: 10px; height: 10px; border-radius: 50%; background: #3a4c5c; }
.ap-barra i:nth-child(1) { background: #f26b5b; } .ap-barra i:nth-child(2) { background: #f4bf4f; } .ap-barra i:nth-child(3) { background: #61c454; }
.ap-barra span { margin-left: 8px; }
.pc .ap-barra { display: flex; }
.ap-entalhe { width: 90px; height: 22px; background: #172532; border-radius: 0 0 14px 14px; margin: -1px auto 0; flex: none; }
.pc .ap-entalhe { display: none; }
.ap-cabeca { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--wa-cab); color: #fff; flex: none; }
.ap-cabeca b { display: block; font-size: 14px; line-height: 1.2; }
.ap-cabeca small { display: block; font-size: 11.5px; color: #b6e3d6; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--f-titulo); flex: none; }
.avatar.ana { background: var(--laranja); color: #fff; }
.avatar.cli { background: #dfe7ee; color: var(--navy); }
.ap-conversa { flex: 1; overflow-y: auto; padding: 14px 10px 8px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth;
  background-color: var(--wa-fundo); background-image: radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px); background-size: 18px 18px; }
.dia { align-self: center; font-size: 11px; color: var(--wa-suave); background: #182229; padding: 3px 10px; border-radius: 7px; margin: 8px 0; }
.balao { max-width: 82%; padding: 6px 9px 4px; border-radius: 9px; color: var(--wa-texto); font-size: 13.5px; line-height: 1.42; background: var(--wa-entra);
  align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; position: relative; animation: entrar .25s ease both; box-shadow: 0 1px 1px rgba(0,0,0,.25); }
.balao.sai { background: var(--wa-sai); align-self: flex-end; }
.balao + .balao { margin-top: 2px; }
.balao .quem { display: block; font-size: 11px; font-weight: 600; color: #f6a26a; margin-bottom: 1px; }
.balao .meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 10.5px; color: rgba(233,237,239,.6); margin-top: 2px; }
.balao .doc { display: flex; align-items: center; gap: 9px; background: rgba(0,0,0,.18); border-radius: 7px; padding: 8px; margin-bottom: 4px; color: inherit; text-decoration: none; }
.balao .doc .ico { width: 30px; height: 36px; border-radius: 4px; background: #e44d3a; color: #fff; display: grid; place-items: center; font: 700 9px var(--f-mono); flex: none; }
.balao .doc b { font-size: 12.5px; font-weight: 600; display: block; }
.balao .doc small { font-size: 11px; color: var(--wa-suave); }
.balao img.midia { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; }
.ap-status { min-height: 0; font-size: 11.5px; color: #a6e8d5; padding: 0 12px; background: var(--wa-fundo); transition: min-height .2s; }
.ap-status.vis { min-height: 22px; padding: 3px 12px; }
.ap-status .pontos::after { content: "…"; animation: pontos 1.2s steps(4) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
.ap-entrada { display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: #1b262d; flex: none; }
.ap-entrada textarea { background: #2a3942; border: 0; border-radius: 20px; color: var(--wa-texto); padding: 9px 14px; resize: none; height: 40px; max-height: 120px; font-size: 13.5px; overflow-y: hidden; scrollbar-width: thin; }
.ap-entrada textarea.alta { overflow-y: auto; }
.ap-entrada textarea::placeholder { color: var(--wa-suave); }
.ap-entrada textarea:disabled { opacity: .55; }
.enviar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.enviar:disabled { background: #3b4a54; cursor: not-allowed; }
.ap-legenda { font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--suave); }
@keyframes entrar { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pontos { from { width: 0; } to { width: 1.2em; } }

/* painel lateral direito */
.painel { border-left: 1px solid var(--linha); background: var(--cartao); display: flex; flex-direction: column; min-height: 0; }
.abas { display: flex; border-bottom: 1px solid var(--linha); flex: none; }
.abas button { flex: 1; font: 600 12.5px var(--f-texto); padding: 11px 4px; border: 0; background: none; color: var(--suave); border-bottom: 2px solid transparent; cursor: pointer; }
.abas button.ativa { color: var(--texto); border-bottom-color: var(--laranja); }
.aba { padding: 14px; overflow-y: auto; flex: 1; }
.bloco { border: 1px solid var(--linha); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.bloco h3 { font-size: 13.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.estado-orc { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--f-mono); padding: 3px 9px; border-radius: 999px; background: var(--fundo); }
.dados { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12.5px; margin: 0; }
.dados dt { color: var(--suave); }
.dados dd { margin: 0; overflow-wrap: anywhere; }
.proposta { border: 1px dashed #d8a37c; background: rgba(242,116,28,.05); border-radius: 11px; padding: 10px; margin-top: 8px; }
.proposta .topo-p { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.proposta b { font-family: var(--f-mono); font-size: 13px; }
.proposta .total { font: 700 16px var(--f-titulo); }
.proposta ul { margin: 6px 0; padding-left: 18px; font-size: 12.5px; }
.proposta .botoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.selo-sim { font: 600 10px var(--f-mono); letter-spacing: .08em; color: #b00; border: 1px solid #b00; border-radius: 5px; padding: 1px 5px; }
.linha-tempo { list-style: none; margin: 0; padding: 0; }
.linha-tempo li { position: relative; padding: 0 0 12px 18px; font-size: 12.5px; }
.linha-tempo li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #9aa8b6; }
.linha-tempo li::after { content: ""; position: absolute; left: 7px; top: 15px; bottom: 0; width: 1px; background: var(--linha); }
.linha-tempo li.orcamento::before { background: var(--laranja); }
.linha-tempo li.atencao::before { background: var(--perigo); }
.linha-tempo li.operador::before { background: #2563a8; }
.linha-tempo time { display: block; font: 500 10.5px var(--f-mono); color: var(--suave); }
.metricas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metrica { border: 1px solid var(--linha); border-radius: 10px; padding: 9px; }
.metrica small { display: block; color: var(--suave); font-size: 11.5px; }
.metrica b { font: 700 17px var(--f-titulo); }

/* diálogo e avisos */
.dialogo { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--cartao); color: var(--texto); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.dialogo::backdrop { background: rgba(6,18,31,.55); backdrop-filter: blur(3px); }
.dialogo form { padding: 22px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.dialogo h2 { font-size: 19px; margin-bottom: 14px; }
.limites { border: 1px solid var(--linha); border-radius: 12px; padding: 10px 12px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 10px; }
.limites legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.limites label { font-size: 12px; }
.dialogo-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.aviso-flutuante { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy-2); color: #fff; padding: 10px 16px; border-radius: 11px;
  font-size: 13.5px; box-shadow: 0 12px 30px rgba(0,0,0,.3); z-index: 50; max-width: calc(100vw - 32px); }
.aviso-flutuante.erro-t { background: var(--perigo); }
.veu { display: none; }
.so-celular { display: none; }

/* tela cheia: só o palco */
.sessao:fullscreen { background: var(--fundo); }
.sessao:fullscreen .painel { display: none; }
.sessao:fullscreen .corpo-sessao { grid-template-columns: 1fr; }

/* responsivo */
@media (max-width: 1250px) {
  .corpo-sessao { grid-template-columns: 1fr; grid-template-rows: minmax(520px, 1fr) auto; overflow-y: auto; }
  .painel { border-left: 0; border-top: 1px solid var(--linha); }
  .aba { max-height: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .so-celular { display: inline-flex; }
  .lateral { position: fixed; z-index: 30; top: 60px; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .25s; box-shadow: var(--sombra); }
  .app.menu-on .lateral { transform: none; }
  .app.menu-on .veu { display: block; position: fixed; inset: 60px 0 0; background: rgba(6,18,31,.4); z-index: 25; }
  .usuario span { display: none; }
  .marca small { display: none; }
  .agente { max-width: 40vw; }
  .so-estreito { display: inline-flex; }
  .so-largo { display: none; }
  #modos { display: none; }
  .sessao-topo, .palco-barra { padding-left: 16px; padding-right: 16px; }
  .palco { padding: 12px 10px; gap: 10px; }
  .palco[data-vista="cliente"] #apAna, .palco[data-vista="ana"] #apCliente { display: none; }
  .palco[data-vista="ambos"] { flex-direction: column; align-items: stretch; }
  .aparelho.phone, .aparelho.pc { flex: 1 1 auto; max-width: none; width: 100%; }
  .ap-moldura { min-height: 62dvh; max-height: 72dvh; border-width: 6px; border-radius: 24px; }
  .palco[data-vista="ambos"] .ap-moldura { min-height: 46dvh; }
  .ap-entalhe { display: none; }
  .limites { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topo { gap: 8px; padding: 0 10px; }
  .marca b { font-size: 14px; }
  .agente { padding-right: 8px; }
  .acoes .btn span { display: none; }
  .acoes .btn { padding: 8px 10px; }
}

/* impressão / PDF: conversa em lista simples */
@media print {
  .topo, .lateral, .palco-barra, .acoes, .painel, .ap-entrada, .ap-status, .ap-entalhe, .ap-barra, #apAna { display: none !important; }
  .app { display: block; height: auto; }
  .palco { display: block; padding: 0; background: none; overflow: visible; }
  .ap-moldura { border: 0; box-shadow: none; max-height: none; background: #fff; }
  .ap-conversa { background: #fff; overflow: visible; }
  .balao { color: #111; background: #f1f3f5; box-shadow: none; animation: none; break-inside: avoid; }
  .balao.sai { background: #dcf3ea; }
  .balao .meta { color: #555; }
  .corpo-sessao, .sessao, .principal { display: block; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
