/* ============================================================
   Painel de atendimento
   Petróleo para a estrutura; a cor de cada status marca a fila.
   ============================================================ */
:root {
    --petroleo: #123a36;
    --petroleo-2: #1d5049;
    --papel: #f1f4f2;
    --branco: #ffffff;
    --texto: #1a2927;
    --suave: #5d6f6b;
    --linha: #d6dedb;
    --aguardando: #c9731d;
    --aguardando-fundo: #fbefe2;
    --andamento: #2a68a8;
    --andamento-fundo: #e6eff8;
    --resolvido: #3a8558;
    --resolvido-fundo: #e5f2ea;
    --erro: #b3372c;
    --raio: 10px;
    --fonte: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--fonte);
    font-size: 15px;
    line-height: 1.5;
    color: var(--texto);
    background: var(--papel);
}
a { color: var(--petroleo-2); }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.secao { font-size: 1.05rem; font-weight: 700; margin: 2rem 0 .75rem; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.discreto, .ajuda { color: var(--suave); }
.ajuda { margin: .25rem 0 1rem; max-width: 70ch; }
:focus-visible { outline: 3px solid var(--andamento); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.lateral {
    background: var(--petroleo);
    color: #d9e6e3;
    display: flex;
    flex-direction: column;
    padding: 1.4rem 1rem;
    position: sticky; top: 0; height: 100vh;
}
.marca { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; color: #fff; margin: 0 .5rem 2rem; }
.marca-escura { color: var(--petroleo); margin: 0 0 1.5rem; }
.marca-ponto { width: 12px; height: 12px; border-radius: 50%; background: var(--aguardando); box-shadow: 0 0 0 4px rgba(201,115,29,.25); }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a { color: #d9e6e3; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; font-weight: 600; }
.lateral nav a:hover { background: rgba(255,255,255,.06); }
.lateral nav a.ativo { background: var(--petroleo-2); color: #fff; }
.nav-grupo { font-size: .8rem; color: #8fb0aa; margin: 1.25rem .75rem .35rem; }
.quem { margin-top: auto; padding: 1rem .75rem 0; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; }
.quem-nome { color: #fff; font-weight: 700; text-decoration: none; }
.quem-setor { font-size: .85rem; color: #8fb0aa; }
.link-sair { background: none; border: 0; color: #d9e6e3; padding: .5rem 0 0; cursor: pointer; font: inherit; text-decoration: underline; }

.conteudo { padding: 2rem clamp(1rem, 3vw, 2.75rem); max-width: 1180px; width: 100%; }
.topo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* ---------- avisos ---------- */
.aviso { padding: .7rem 1rem; border-radius: var(--raio); margin: 0 0 1rem; font-weight: 600; }
.aviso-ok { background: var(--resolvido-fundo); color: #245a3b; }
.aviso-erro { background: #f8e3e1; color: var(--erro); }

/* ---------- contadores ---------- */
.contadores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.contador {
    text-decoration: none; color: var(--texto);
    background: var(--branco); border-radius: var(--raio);
    padding: 1rem 1.25rem; border: 1px solid var(--linha);
    display: flex; align-items: baseline; gap: .6rem;
}
.contador strong { font-size: 2rem; font-weight: 800; line-height: 1; }
.contador span { color: var(--suave); font-weight: 600; }
.contador-aguardando strong { color: var(--aguardando); }
.contador-andamento strong { color: var(--andamento); }
.contador-resolvido strong { color: var(--resolvido); }

/* ---------- fila: a borda grossa diz o status ---------- */
.fila { display: flex; flex-direction: column; gap: .5rem; }
.item-fila {
    display: grid; grid-template-columns: 150px 1fr auto; gap: 1.25rem; align-items: center;
    background: var(--branco); color: var(--texto); text-decoration: none;
    border: 1px solid var(--linha); border-left: 6px solid var(--linha);
    border-radius: var(--raio); padding: .85rem 1.1rem;
}
.item-fila:hover { border-color: var(--petroleo-2); border-left-color: inherit; }
.item-fila.status-aberto { border-left-color: var(--aguardando); }
.item-fila.status-em_atendimento { border-left-color: var(--andamento); }
.item-fila.status-finalizado { border-left-color: var(--resolvido); }
.item-tempo { display: flex; flex-direction: column; }
.item-tempo strong { font-size: 1.05rem; font-weight: 800; }
.status-aberto .item-tempo strong { color: var(--aguardando); }
.item-tempo span, .item-meta { color: var(--suave); font-size: .85rem; }
.item-cliente { display: flex; flex-direction: column; min-width: 0; }
.item-descricao { color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; }
.etiqueta { background: var(--papel); border: 1px solid var(--linha); padding: 0 .5rem; border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--petroleo-2); }
.vazio { background: var(--branco); border: 1px dashed var(--linha); border-radius: var(--raio); padding: 1.5rem; color: var(--suave); margin: 0; }

.abas { display: flex; gap: .25rem; background: #e3e9e6; padding: 4px; border-radius: 999px; }
.abas a { text-decoration: none; color: var(--suave); font-weight: 700; padding: .35rem .9rem; border-radius: 999px; }
.abas a.ativa { background: var(--branco); color: var(--texto); }
.filtro { margin-bottom: 1rem; }
.filtro label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }

/* ---------- botões e formulários ---------- */
.botao {
    display: inline-flex; align-items: center; justify-content: center;
    font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
    padding: .55rem 1.1rem; border-radius: 8px;
    border: 1px solid var(--linha); background: var(--branco); color: var(--texto);
}
.botao:hover { border-color: var(--petroleo-2); }
.botao-principal { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.botao-principal:hover { background: var(--petroleo-2); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--petroleo-2); text-decoration: underline; cursor: pointer; }

.formulario { display: flex; flex-direction: column; gap: 1rem; }
.formulario-estreito { max-width: 520px; background: var(--branco); padding: 1.5rem; border-radius: var(--raio); border: 1px solid var(--linha); }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.formulario label.caixa { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], select, textarea {
    font: inherit; color: var(--texto); background: var(--branco);
    border: 1px solid var(--linha); border-radius: 8px; padding: .55rem .7rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--petroleo-2); outline: none; box-shadow: 0 0 0 3px rgba(29,80,73,.15); }
.linha { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ---------- tabelas ---------- */
.tabela-rolagem { overflow-x: auto; background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th { text-align: left; font-size: .85rem; color: var(--suave); font-weight: 700; padding: .75rem 1rem; border-bottom: 1px solid var(--linha); }
.tabela td { padding: .75rem 1rem; border-bottom: 1px solid var(--linha); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tr.inativo td { color: var(--suave); }
.acoes { display: flex; gap: 1rem; justify-content: flex-end; }
.acoes form { margin: 0; }

/* ---------- chat ---------- */
.conteudo-chat { display: flex; flex-direction: column; height: 100vh; padding-bottom: 1rem; }
.chat-topo {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
    padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--linha);
}
.voltar { font-size: .9rem; font-weight: 600; }
.chat-dados { margin: .25rem 0 0; color: var(--suave); display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.chat-acoes { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.chat-acoes form { margin: 0; }
.estado { font-weight: 700; padding: .3rem .8rem; border-radius: 999px; font-size: .9rem; }
.status-aberto .estado { background: var(--aguardando-fundo); color: var(--aguardando); }
.status-em_atendimento .estado { background: var(--andamento-fundo); color: var(--andamento); }
.status-finalizado .estado { background: var(--resolvido-fundo); color: var(--resolvido); }

.mensagens {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem;
    padding: 1rem; background: #e8ede9; border-radius: var(--raio);
}
.msg { max-width: min(70ch, 78%); padding: .55rem .8rem; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg small { display: block; font-size: .75rem; color: var(--suave); margin-top: .2rem; }
.msg-cliente { background: var(--branco); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-atendente { background: #d3e7e2; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-atendente strong { display: block; font-size: .8rem; color: var(--petroleo-2); }
.msg-sistema { align-self: center; background: transparent; color: var(--suave); font-size: .85rem; padding: .1rem .5rem; }

.resposta { display: flex; gap: .5rem; margin-top: .75rem; }
.resposta textarea { flex: 1; resize: vertical; min-height: 48px; }
.transferir { margin-top: .75rem; color: var(--suave); }
.transferir summary { cursor: pointer; font-weight: 600; }
.transferir form { margin-top: .5rem; }

/* ---------- login ---------- */
.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--petroleo); }
.login-caixa { background: var(--branco); padding: 2rem; border-radius: 14px; width: min(400px, 100%); }
.login-caixa h1 { font-size: 1.35rem; margin-bottom: 1.25rem; }

/* ---------- celular ---------- */
@media (max-width: 800px) {
    .app { grid-template-columns: 1fr; }
    .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; }
    .marca { margin: 0 1rem 0 0; }
    .lateral nav { flex-direction: row; flex-wrap: wrap; }
    .nav-grupo { display: none; }
    .quem { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; gap: .75rem; align-items: center; }
    .quem-setor { display: none; }
    .link-sair { padding: 0; }
    .contadores { grid-template-columns: 1fr; }
    .item-fila { grid-template-columns: 1fr; gap: .4rem; }
    .item-meta { flex-direction: row; align-items: center; gap: .75rem; }
    .conteudo-chat { height: auto; min-height: calc(100vh - 60px); }
    .mensagens { min-height: 50vh; }
    .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
