/* ══════════════════════════════════════════════════════════════
   Camada 23 · Treinamento — quem vai receber o material

   Blocos que abrem e fecham. Fechado, cada um diz no subtitulo O QUE foi
   escolhido — e e so isso: sem contador, sem numero de passo, sem resumo no
   topo. Eram tres formas de dizer a mesma coisa, e o bloco ficava pesado numa
   tela que ja tem titulo, setor, tipo, URL e descricao.

   ESCOPO: as regras nasceram presas a #cap-unit-group ("Quem vai receber").
   Em 10/09/2026 o passo dos departamentos saiu de la e virou o campo "Setor /
   Departamento", que fica fora daquele bloco — e a lista apareceu crua, com
   as caixas de marcar sem estilo nenhum. O escopo passou a ser o modal
   inteiro (#modal-cap-add), que e onde as classes .tg-* existem.
   ═════════════════════════════════════════════════════════════ */

#modal-cap-add .tg-opt {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft, #7e8474);
  margin-left: 6px;
}

/* ── bloco ──────────────────────────────────────────────────── */
#modal-cap-add details.tg-passo {
  border: 1px solid var(--line, #e0e7d4);
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--surface, #fff);
  padding: 0;
}

#modal-cap-add summary.tg-passo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
  user-select: none;
}
#modal-cap-add summary.tg-passo-head::-webkit-details-marker { display: none; }
#modal-cap-add summary.tg-passo-head::marker { content: ''; }
#modal-cap-add summary.tg-passo-head:hover { background: var(--surface-2, #f6f8f1); }
#modal-cap-add summary.tg-passo-head:focus-visible {
  outline: 2px solid var(--primary, #6f8a3a);
  outline-offset: -2px;
}

#modal-cap-add .tg-passo-head > div { flex: 1; min-width: 0; }

#modal-cap-add .tg-passo-head strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #212717);
  line-height: 1.3;
}

/* O que foi escolhido: e a informacao que importa com o bloco fechado, entao
   ganha a cor do texto normal. Enquanto e so instrucao, fica apagado. */
#modal-cap-add .tg-passo-head small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-soft, #9aa08e);
  line-height: 1.4;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#modal-cap-add .tg-passo-head small.tg-escolhidos {
  color: var(--primary-dark, #47601f);
  font-weight: 600;
}

#modal-cap-add .tg-seta {
  flex-shrink: 0;
  color: var(--ink-soft, #9aa08e);
  transition: transform .18s ease;
}
#modal-cap-add details[open] > summary .tg-seta { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  #modal-cap-add .tg-seta { transition: none; }
}

#modal-cap-add .tg-passo-body {
  padding: 12px 13px 13px;
  border-top: 1px solid var(--line, #e0e7d4);
}

/* ── chips de unidade ───────────────────────────────────────── */
#modal-cap-add .tg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#modal-cap-add .tg-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line, #e0e7d4);
  background: #fff;
  color: var(--ink-soft, #4d5243);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
#modal-cap-add .tg-chip:hover { border-color: var(--primary, #6f8a3a); }
#modal-cap-add .tg-chip.on {
  background: var(--primary, #6f8a3a);
  border-color: var(--primary, #6f8a3a);
  color: #fff;
}
#modal-cap-add .tg-chip:focus-visible {
  outline: 2px solid var(--primary-dark, #384622);
  outline-offset: 2px;
}

/* ── listas de marcar ───────────────────────────────────────── */
#modal-cap-add .tg-busca { width: 100%; margin-bottom: 8px; }

#modal-cap-add .tg-todos {
  margin-bottom: 8px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-dark, #47601f);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Sem moldura por item: com 20 departamentos, 20 caixas desenhadas viram uma
   grade pesada. A marcacao ja e o sinal. */
#modal-cap-add .tg-lista {
  display: flex;
  flex-direction: column;
  max-height: 200px;
  overflow-y: auto;
}

#modal-cap-add .tg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 6px;
}
#modal-cap-add .tg-item:hover { background: var(--surface-2, #f6f8f1); }

#modal-cap-add .tg-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary, #6f8a3a);
  cursor: pointer;
}

#modal-cap-add .tg-item-txt {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink, #212717);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#modal-cap-add .tg-item.on .tg-item-txt { font-weight: 600; }

/* A unidade de origem aparece na MESMA linha, apagada: o mesmo codigo de
   departamento existe em varias unidades (ATD em 4, REC em 2), e sem esta
   marca a lista mostra linhas identicas. */
#modal-cap-add .tg-item-txt small {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-soft, #9aa08e);
  margin-left: 6px;
}

#modal-cap-add .tg-vazio {
  padding: 10px 4px;
  font-size: 12px;
  color: var(--ink-soft, #9aa08e);
}


/* ── dicas dos campos (23/09/2026) ─────────────────────────────
   Texto que so EXPLICA o campo ("o treinamento vai so para os setores
   marcados...") deixou de ficar fixo embaixo dele: aparece ao passar o mouse
   no campo ou ao entrar nele pelo teclado/toque (:focus-within). Alertas e
   status (setor herdado, tamanho do arquivo, link do modelo) seguem fixos —
   eles nao sao explicacao, sao coisa que a pessoa precisa ver.
   O "i" ao lado do rotulo avisa que ha dica ali. */
#modal-cap-add .au-fld { position: relative; }
#modal-cap-add .au-fld > .au-hint.cap-dica {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 40;
  max-width: min(360px, 100%);
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ink, #2b3024);
  color: var(--surface, #fff);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, visibility .12s ease;
}
#modal-cap-add .au-fld > .au-hint.cap-dica strong { color: inherit; }
#modal-cap-add .au-fld:hover > .au-hint.cap-dica,
#modal-cap-add .au-fld:focus-within > .au-hint.cap-dica {
  opacity: 1;
  visibility: visible;
}
#modal-cap-add .au-fld:has(> .au-hint.cap-dica) > label { cursor: help; }
#modal-cap-add .au-fld:has(> .au-hint.cap-dica) > label::after {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font: italic 700 9px/1 Georgia, serif;
  opacity: .55;
  vertical-align: 1px;
}
