/*
  PORQUE EXISTE: painel de chat — mensagens, prompt e controlos no rodapé.
*/
.seletor-pc {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.seletor-pc label {
  font-size: 11px;
  font-weight: 650;
  color: var(--texto-fraco);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.seletor-pc select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--raio-sm);
  background: var(--fundo-editor);
  color: var(--texto);
  border: 1px solid var(--borda);
  font-size: 12px;
}
.inv-h3 {
  margin: 12px 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texto-fraco);
}
.inv-corpo { overflow-y: auto; max-height: 55vh; }
.seletor-janela {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.seletor-janela label {
  font-size: 11px; font-weight: 650; flex-shrink: 0;
  color: var(--texto-fraco); letter-spacing: 0.04em; text-transform: uppercase;
}
.seletor-janela select {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--raio-sm);
  background: var(--fundo-editor); color: var(--texto);
  border: 1px solid var(--borda); font-size: 12px;
  transition: border-color var(--trans);
}
.seletor-janela select:hover { border-color: var(--borda-forte); }

.status-chat {
  padding: 6px 14px; font-size: 11px; color: var(--texto-fraco);
  border-bottom: 1px solid var(--borda); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.status-chat.ok { color: var(--ok); }
.status-chat.aviso { color: var(--aviso); }

.chat-abas {
  display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto;
  border-bottom: 1px solid var(--borda); flex-shrink: 0;
  min-height: 40px; align-items: center;
}
.abas-vazio {
  font-size: 12px; color: var(--texto-fraco); padding: 4px 6px; white-space: nowrap;
}
.aba-agente {
  padding: 6px 12px; border-radius: var(--raio-sm); font-size: 12px;
  background: var(--fundo-caixa); color: var(--texto-fraco); cursor: pointer;
  white-space: nowrap; border: 1px solid transparent;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.aba-agente:hover { color: var(--texto); }
.aba-agente.ativa {
  color: var(--texto);
  border-color: color-mix(in srgb, var(--destaque) 45%, transparent);
  background: color-mix(in srgb, var(--destaque) 10%, var(--fundo-caixa));
}

.abas-acoes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.btn-novo-chat,
.btn-historico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--borda-forte);
  background: color-mix(in srgb, var(--destaque) 12%, var(--fundo-caixa));
  color: var(--destaque);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.btn-historico { font-size: 18px; font-weight: 600; }
.btn-novo-chat:hover,
.btn-historico:hover {
  box-shadow: 0 0 14px color-mix(in srgb, var(--destaque) 35%, transparent);
}
.btn-novo-chat:disabled,
.btn-historico:disabled { opacity: 0.45; cursor: default; }

.chat-conversa {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
  max-width: 100%;
}

.msg-usuario {
  align-self: flex-end; max-width: 92%;
  background: linear-gradient(145deg, var(--fundo-caixa), color-mix(in srgb, var(--destaque-2) 8%, var(--fundo-caixa)));
  border: 1px solid var(--borda-forte);
  border-radius: 12px 12px 4px 12px;
  padding: 11px 13px; line-height: 1.5; font-size: 13.5px;
}
.msg-agente {
  color: var(--texto); font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-width: min(100%, 640px);
}
.msg-agente strong { font-weight: 650; color: #fff; }
.msg-agente code {
  font-family: var(--fonte-mono); font-size: 12px;
  background: var(--fundo-caixa); padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--borda);
}
.msg-status { color: var(--texto-fraco); font-size: 13px; line-height: 1.45; }

.caixa-prompt {
  flex-shrink: 0; margin: 0 12px 12px; padding: 12px;
  background: color-mix(in srgb, var(--fundo-caixa) 85%, transparent);
  border: 1px solid var(--borda-forte);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  transition: border-color var(--trans);
}
.caixa-prompt:focus-within {
  border-color: color-mix(in srgb, var(--destaque) 50%, var(--borda));
}
.caixa-prompt textarea {
  width: 100%; border: none; outline: none; resize: none;
  background: transparent; color: var(--texto); font-family: var(--fonte-ui);
  font-size: 14.5px; min-height: 26px; max-height: 140px; line-height: 1.45;
}
.caixa-prompt textarea:focus { outline: none; }
.caixa-prompt textarea::placeholder { color: var(--texto-apagado); }

.prompt-rodape {
  display: flex; align-items: center; justify-content: space-between; margin-top: 10px;
}
.prompt-esquerda { display: flex; gap: 4px; }
.seletor {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; background: transparent; color: var(--texto-fraco);
  font-size: 12px; padding: 5px 8px; border-radius: var(--raio-sm); cursor: pointer;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.seletor:hover {
  background: var(--fundo-hover); color: var(--texto);
  border-color: var(--borda);
}
.seletor svg { width: 13px; height: 13px; }
.prompt-direita { display: flex; align-items: center; gap: 6px; }

.btn-circulo {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--texto-fraco); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background var(--trans), color var(--trans), transform var(--trans);
}
.btn-circulo svg { pointer-events: none; width: 18px; height: 18px; }
.btn-circulo:hover { background: var(--fundo-hover); color: var(--texto); }
.btn-circulo:active { transform: scale(0.94); }
.btn-circulo.gravando {
  background: var(--erro); color: #fff;
  animation: pulso-mic 1.2s ease-in-out infinite;
}
@keyframes pulso-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 108, 108, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(224, 108, 108, 0); }
}

.caixa-prompt.arrastar-anexo {
  border-color: color-mix(in srgb, var(--destaque) 60%, var(--borda));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--destaque) 25%, transparent);
}

.anexos-barra, .audio-gravado {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--borda);
  background: var(--fundo-caixa); flex-shrink: 0;
}
.anexo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: var(--raio-sm);
  background: var(--fundo-editor); border: 1px solid var(--borda); font-size: 12px;
}
.anexo-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.anexo-chip .btn-icone { width: 22px; height: 22px; font-size: 14px; }
.audio-gravado audio { flex: 1; min-width: 0; height: 32px; }
