/* ===========================================================================
   CHAMADOS DE SUPORTE
   Duas colunas: a fila de chamados e a conversa. O mesmo desenho serve ao
   super admin e à barbearia, porque é a mesma conversa vista dos dois lados.
   =========================================================================== */

.ch-app {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 190px);
  min-height: 480px;
}

/* --- A fila ------------------------------------------------------------- */
.ch-lateral {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.ch-lateral-topo { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ch-abrir { width: 100%; justify-content: center; }

.ch-busca { position: relative; display: flex; align-items: center; }
.ch-busca svg { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.ch-busca input {
  width: 100%; padding: 9px 12px 9px 34px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: 13px; color: var(--text);
}
.ch-busca input:focus { outline: none; border-color: var(--orange); background: var(--surface); }

.ch-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ch-filtro {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: 12.5px; color: var(--text); cursor: pointer;
}

.ch-numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ch-numero {
  padding: 9px 6px; border-radius: var(--r-sm); text-align: center;
  background: var(--surface-2); border: 1px solid var(--line);
}
.ch-numero strong { display: block; font-size: 17px; line-height: 1.1; }
.ch-numero span { font-size: 10.5px; color: var(--text-3); }
.ch-numero--aberto strong { color: #B45309; }
.ch-numero--em_andamento strong { color: #1D4ED8; }
.ch-numero--nota strong { color: #047857; }

.ch-itens { flex: 1; overflow-y: auto; min-height: 0; }
.ch-item {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; cursor: pointer;
  border-left: 3px solid transparent;
}
.ch-item:hover { background: var(--surface-2); }
.ch-item.ativo { background: var(--blue-soft); border-left-color: var(--orange); }
.ch-item.nao-lido .ch-item-titulo { font-weight: 700; }
.ch-item.nao-lido::after {
  content: ""; position: absolute; /* o ponto acompanha o número do chamado */
}
.ch-item-topo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ch-item-titulo { font-size: 13.5px; color: var(--text); line-height: 1.35; }
.ch-item-detalhe {
  font-size: 12px; color: var(--text-3); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ch-item-rodape { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); flex-wrap: wrap; }
.ch-esperando { color: var(--orange); font-weight: 600; }
.ch-nota-mini { display: inline-flex; align-items: center; gap: 3px; color: #047857; font-weight: 600; }
.ch-nota-mini svg { color: #F59E0B; }

.ch-numero-chamado { font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: .02em; }
.ch-numero-chamado.grande { font-size: 13px; }

.ch-pill {
  padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap;
}
.ch-pill--aberto { background: rgba(245, 158, 11, .16); color: #B45309; }
.ch-pill--em_andamento { background: rgba(37, 99, 235, .13); color: #1D4ED8; }
.ch-pill--finalizado { background: rgba(16, 185, 129, .14); color: #047857; }

.ch-prio { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.ch-prio--urgente { background: rgba(220, 38, 38, .12); color: #B91C1C; }
.ch-prio--alta { background: rgba(245, 158, 11, .14); color: #B45309; }
.ch-prio--normal { background: var(--surface-2); color: var(--text-3); }
.ch-prio--baixa { background: var(--surface-2); color: var(--text-3); }

/* --- A conversa --------------------------------------------------------- */
.ch-conversa {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.ch-nenhum {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-3); font-size: 13.5px;
}

.ch-cab { padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ch-cab-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-cab h3 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; margin: 0 0 8px; }
.ch-cab-rodape { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }
.ch-org, .ch-dono { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ch-dono--vago { color: var(--text-3); font-style: italic; }
.ch-cat { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); }
.ch-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.ch-linha { flex: 1; overflow-y: auto; padding: 20px; min-height: 0; background: var(--surface-2); }

.ch-msg { display: flex; gap: 12px; margin-bottom: 18px; }
.ch-msg--minha { flex-direction: row-reverse; }
.ch-msg--minha .ch-msg-topo { flex-direction: row-reverse; }
.ch-msg--minha .ch-balao { background: var(--blue-soft); border-color: rgba(245, 158, 11, .3); }
.ch-msg-corpo { max-width: 74%; min-width: 0; }
.ch-msg-topo { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; color: var(--text-3); }
.ch-msg-topo strong { font-size: 13px; color: var(--text); }
.ch-balao {
  padding: 11px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.6; color: var(--text); word-wrap: break-word;
}
.ch-msg--interna .ch-balao {
  background: rgba(245, 158, 11, .08);
  border: 1px dashed rgba(245, 158, 11, .5);
}
.ch-selo {
  padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: rgba(37, 99, 235, .12); color: #1D4ED8;
}
.ch-selo--interno { background: rgba(245, 158, 11, .16); color: #B45309; }
.ch-anexo {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  padding: 6px 10px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); font-size: 12.5px; color: var(--text-2); text-decoration: none;
}
.ch-anexo:hover { border-color: var(--orange); color: var(--orange); }
.ch-email-falhou { margin: 6px 0 0; font-size: 11.5px; color: #B91C1C; }
.ch-anexo-acao { margin-left: auto; font-size: 11px; opacity: .7; }
.ch-anexo small { opacity: .65; font-size: 11px; }

/* A imagem aparece como imagem, e não como o nome do arquivo. */
.ch-anexo-foto {
  display: block; margin-top: 8px; padding: 0; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface-2); line-height: 0;
}
.ch-anexo-foto img { max-width: 260px; max-height: 220px; width: auto; height: auto; display: block; }
.ch-anexo-foto:hover { border-color: var(--orange); }

/* O áudio toca aqui mesmo: baixar para ouvir é um passo a mais em cima de
   quem já está com problema. */
.ch-anexo-audio {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 8px; max-width: 320px;
}
.ch-anexo-audio-nome { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.ch-anexo-audio audio { width: 100%; height: 34px; }

/* O prazo de resposta, dito antes de a pessoa escrever. */
.ch-prazo {
  display: flex; align-items: center; gap: 8px; margin: 0 0 16px;
  padding: 10px 13px; border-radius: var(--r-sm);
  background: var(--blue-soft); border: 1px solid rgba(245, 158, 11, .25);
  font-size: 12.5px; line-height: 1.5; color: var(--text-2);
}
.ch-prazo svg { flex: none; color: var(--orange); }
.ch-prazo--aguardando { margin: 0 0 10px; }

.ch-anexar-botao { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.ch-anexar-botao input { display: none; }

.ch-evento {
  margin: 0 0 16px; text-align: center; font-size: 11.5px; color: var(--text-3);
}
.ch-evento span { opacity: .7; }

.ch-avatar {
  flex: none; border-radius: 50%; object-fit: cover; display: inline-block;
  background: var(--surface-2);
}
.ch-avatar--letra {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--orange); color: #FFF; font-weight: 700;
}

/* --- Avaliação ---------------------------------------------------------- */
.ch-avaliacao {
  margin: 8px 0 4px; padding: 18px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); text-align: center;
}
.ch-avaliacao > strong { font-size: 15px; }
.ch-avaliacao > p { margin: 4px 0 14px; font-size: 12.5px; color: var(--text-3); }
.ch-notas { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.ch-nota {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background .12s, color .12s, border-color .12s;
}
.ch-nota:hover { border-color: var(--orange); color: var(--orange); }
.ch-nota.escolhida { background: var(--orange); border-color: var(--orange); color: #FFF; }
.ch-avaliacao textarea { margin-bottom: 12px; resize: vertical; }

.ch-avaliacao--feita { display: flex; align-items: center; gap: 16px; text-align: left; }
.ch-nota-selo {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; align-content: center;
  background: rgba(16, 185, 129, .14); color: #047857; font-size: 21px; font-weight: 800;
}
.ch-nota-selo small { font-size: 10px; font-weight: 600; opacity: .8; }
.ch-avaliacao--feita p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }

/* --- Responder ---------------------------------------------------------- */
.ch-responder { padding: 14px 20px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.ch-aviso-reabre { margin: 0 0 10px; font-size: 12px; color: var(--text-3); }
.ch-escrever { display: flex; flex-direction: column; gap: 10px; }
.ch-escrever textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 62px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); font-size: 14px; line-height: 1.55; color: var(--text);
  font-family: inherit;
}
.ch-escrever textarea:focus { outline: none; border-color: var(--orange); background: var(--surface); }
.ch-escrever-acoes { display: flex; align-items: center; gap: 12px; }
.ch-escrever-acoes .btn-primary { margin-left: auto; }
.ch-clipe {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); cursor: pointer;
}
.ch-clipe:hover { border-color: var(--orange); color: var(--orange); }
.ch-clipe input { display: none; }
.ch-interno { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.ch-anexo-escolhido {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2);
}
.ch-anexo-escolhido button {
  margin-left: auto; border: 0; background: transparent; color: var(--orange);
  font-size: 12px; cursor: pointer; text-decoration: underline;
}

.ch-vazio { padding: 28px 20px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.6; }

/* --- Telas estreitas ---------------------------------------------------- */
@media (max-width: 900px) {
  .ch-app { grid-template-columns: 1fr; height: auto; }
  .ch-lateral { max-height: 46vh; }
  .ch-conversa { min-height: 60vh; }
  .ch-msg-corpo { max-width: 84%; }
}
