/* Hábeis — porta da fila (Bitrix): sem digitar até Responder/Encaminhar */

/* Enquanto o composer ainda não montou: some composer, NÃO mostra o gate flutuando */
body.hc-queue-pending .reply-box,
body.hc-queue-pending .reply-box__top,
body.hc-queue-pending .banner--self-assign,
body.hc-queue-pending [data-testid="conversation-reply-box"],
body.hc-queue-pending .prosemirror-editor-wrapper,
body.hc-queue-pending .ProseMirror,
body.hc-queue-pending textarea.input,
body.hc-queue-pending .woot-writer,
body.hc-queue-pending .conversation-footer,
body.hc-queue-pending .mx-2.mb-2.rounded-lg.banner--self-assign {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
}

body.hc-queue-locked .reply-box,
body.hc-queue-locked .reply-box__top,
body.hc-queue-locked .banner--self-assign,
body.hc-queue-locked [data-testid="conversation-reply-box"],
body.hc-queue-locked .prosemirror-editor-wrapper,
body.hc-queue-locked .ProseMirror,
body.hc-queue-locked textarea.input,
body.hc-queue-locked .woot-writer,
body.hc-queue-locked .conversation-footer,
body.hc-queue-locked .mx-2.mb-2.rounded-lg.banner--self-assign {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
}

#hc-queue-gate {
  display: none;
  width: 100%;
  box-sizing: border-box;
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
  background: var(--hc-gate-bg, #17171a);
  font-family: inherit;
  position: relative;
  z-index: 50;
}

/* Só mostra depois de encaixar na coluna da conversa — evita flash no refresh */
body.hc-queue-locked #hc-queue-gate.hc-qg-placed {
  display: block !important;
}

/* Nunca flutuando no body (causava bug visual no carregamento) */
body > #hc-queue-gate {
  display: none !important;
}

body:not(.dark) #hc-queue-gate {
  --hc-gate-bg: #f8faff;
  --hc-gate-text: #0f1b33;
  --hc-gate-muted: #5b6b86;
  --hc-gate-line: #d7e0ef;
  --hc-gate-btn: #1f4fd6;
  --hc-gate-btn-hover: #1639a8;
}

body.dark #hc-queue-gate,
#hc-queue-gate {
  --hc-gate-bg: #17171a;
  --hc-gate-text: #edf0f0;
  --hc-gate-muted: #b0b4ba;
  --hc-gate-line: #26262a;
  --hc-gate-btn: #2781f6;
  --hc-gate-btn-hover: #1f6fe0;
}

#hc-queue-gate .hc-qg-msg {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--hc-gate-muted);
}

#hc-queue-gate .hc-qg-msg strong {
  color: var(--hc-gate-text);
  font-weight: 600;
}

#hc-queue-gate .hc-qg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#hc-queue-gate .hc-qg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}

#hc-queue-gate .hc-qg-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

#hc-queue-gate .hc-qg-btn--primary {
  background: var(--hc-gate-btn);
  color: #fff;
}

#hc-queue-gate .hc-qg-btn--primary:hover:not(:disabled) {
  background: var(--hc-gate-btn-hover);
}

#hc-queue-gate .hc-qg-btn--ghost {
  background: transparent;
  color: var(--hc-gate-text);
  border: 1px solid var(--hc-gate-line);
}

#hc-queue-gate .hc-qg-btn--ghost:hover:not(:disabled) {
  border-color: var(--hc-gate-btn);
  color: var(--hc-gate-btn);
}

#hc-queue-xfer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#hc-queue-xfer.open {
  display: flex;
}

#hc-queue-xfer .hc-qg-modal {
  width: min(420px, 100%);
  max-height: min(80vh, 560px);
  overflow: auto;
  border-radius: 12px;
  background: var(--hc-gate-bg, #17171a);
  border: 1px solid var(--hc-gate-line, #26262a);
  color: var(--hc-gate-text, #edf0f0);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

#hc-queue-xfer .hc-qg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hc-gate-line, #26262a);
}

#hc-queue-xfer .hc-qg-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

#hc-queue-xfer .hc-qg-close {
  background: transparent;
  border: 0;
  color: var(--hc-gate-muted, #b0b4ba);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

#hc-queue-xfer .hc-qg-modal-body {
  padding: 12px 16px 16px;
}

#hc-queue-xfer .hc-qg-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--hc-gate-line, #26262a);
  background: transparent;
  color: inherit;
  font: inherit;
}

#hc-queue-xfer .hc-qg-sec {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hc-gate-muted, #b0b4ba);
}

#hc-queue-xfer .hc-qg-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

#hc-queue-xfer .hc-qg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#hc-queue-xfer .hc-qg-item:hover {
  background: rgba(39, 129, 246, 0.12);
}

#hc-queue-xfer .hc-qg-item[hidden] {
  display: none !important;
}

#hc-queue-xfer .hc-qg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #2781f6;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

#hc-queue-xfer .hc-qg-avatar--team {
  background: #25d366;
  color: #053b1a;
}

#hc-queue-xfer .hc-qg-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#hc-queue-xfer .hc-qg-item-meta strong {
  font-size: 14px;
  font-weight: 600;
}

#hc-queue-xfer .hc-qg-item-meta span {
  font-size: 12px;
  color: var(--hc-gate-muted, #b0b4ba);
}

#hc-queue-xfer .hc-qg-empty {
  font-size: 13px;
  color: var(--hc-gate-muted, #b0b4ba);
  padding: 8px 0;
}

/* Esconde conversas de filas (times) das quais eu não faço parte */
.hc-qg-hide-team { display: none !important; }
