/* ═══════════════════════════════════════════════════════════════════
   PGR — Estilos do módulo (versão planilha + tabela de medidas)
   Arquivo: pgr.css
   ═══════════════════════════════════════════════════════════════════ */

.pgr-wrap { padding: 0; }

.pgr-loading,
.pgr-erro {
  padding: 50px 30px;
  text-align: center;
  font-size: 11pt;
  color: #5a7a8a;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e3e9ef;
  margin-bottom: 16px;
}

.pgr-erro {
  background: #fff5f5;
  border: 1px solid #f0c4c4;
  color: #A32D2D;
}

/* ── CABEÇALHO ───────────────────────────────────────────────── */

.pgr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e3e9ef;
  flex-wrap: wrap;
  gap: 12px;
}

.pgr-titulo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pgr-titulo h2 { margin: 0; color: #1e3a5f; font-size: 14pt; font-weight: 700; }

.pgr-modo-badge {
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── RESUMO ──────────────────────────────────────────────────── */

.pgr-resumo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.pgr-resumo-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
}

.pgr-resumo-item::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 100%;
  background: linear-gradient(135deg, transparent, rgba(30, 58, 95, 0.04));
  pointer-events: none;
}

.pgr-resumo-num { font-size: 28pt; font-weight: 800; color: #1e3a5f; line-height: 1; }
.pgr-resumo-lbl { font-size: 10pt; color: #2c3e50; font-weight: 600; }

/* ── INVENTÁRIO ──────────────────────────────────────────────── */

.pgr-arvore {
  background: #fff;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.pgr-arvore h3 {
  color: #1e3a5f;
  margin: 0 0 16px 0;
  font-size: 11.5pt;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pgr-arvore h3::before { content: '🏢'; font-size: 13pt; }

.pgr-vazio {
  background: #fffbe6;
  border: 1px dashed #c46a00;
  border-radius: 8px;
  padding: 36px 24px;
  text-align: center;
  color: #5a4a20;
}
.pgr-vazio p { margin: 0 0 6px 0; font-size: 10.5pt; font-weight: 500; }
.pgr-vazio-hint { font-size: 9.5pt; color: #888; margin-top: 8px; font-weight: 400; }

/* ── GHE ─────────────────────────────────────────────────────── */

.pgr-ghe {
  border: 1px solid #dde4ec;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.pgr-ghe:hover { border-color: #c5d3e0; }
.pgr-ghe-aberto { border-color: #1e3a5f; }

.pgr-ghe-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.pgr-ghe-header:hover { background: #eef3f8; }
.pgr-ghe-aberto .pgr-ghe-header { background: #f0f5fa; border-bottom: 1px solid #dde4ec; }

.pgr-ghe-toggle { color: #1e3a5f; width: 12px; font-size: 9pt; font-weight: bold; }
.pgr-ghe-numero {
  font-weight: 700;
  color: #1e3a5f;
  background: #e8eef5;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 9pt;
  letter-spacing: 0.3px;
  border: 1px solid #c5d3e0;
}
.pgr-ghe-local { flex: 0 0 auto; font-weight: 500; color: #2c3e50; font-size: 10pt; }
.pgr-ghe-funcoes {
  flex: 1;
  font-weight: 400;
  color: #5a7a8a;
  font-size: 9.5pt;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.pgr-ghe-badge {
  background: #1e3a5f;
  color: #fff;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 8.5pt;
  font-weight: 700;
}

/* Botão "PCMSO" no header de cada GHE — lógica do módulo PCMSO virá depois.
   Cor verde discreta pra associar à saúde ocupacional sem competir com o badge azul. */
.pgr-ghe-btn-pcmso {
  margin-left: auto;
  background: #fff;
  color: #3d8b37;
  border: 1.5px solid #3d8b37;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pgr-ghe-btn-pcmso:hover {
  background: #3d8b37;
  color: #fff;
}

/* Botão "GFIP" no header de cada GHE — define o código de aposentadoria
   especial (S-2240/eSocial) para todo o GHE. Cor dourada (associa com
   "código previdenciário" sem competir com PCMSO verde nem badge azul). */
.pgr-ghe-btn-gfip {
  margin-left: 6px;
  background: #fff;
  color: #7a5a00;
  border: 1.5px solid #7a5a00;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pgr-ghe-btn-gfip:hover {
  background: #7a5a00;
  color: #fff;
}

/* Estado "GFIP definida" — botão preenchido com dourado, ✓ visível.
   Indica visualmente que o especialista já configurou o código (S-2240). */
.pgr-ghe-btn-gfip-definida {
  background: #7a5a00;
  color: #fff;
}
.pgr-ghe-btn-gfip-definida:hover {
  background: #5a4400;
  color: #fff;
}

.pgr-ghe-corpo {
  background: #fff;
  padding: 14px 14px;
}

/* ── TABELA DE RISCOS (planilha) ─────────────────────────────── */

.pgr-tabela-wrap {
  overflow-x: auto;
  border: 1px solid #dde4ec;
  border-radius: 6px;
}

.pgr-tabela {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 7.5pt;        /* 8 → 7.5 (limite confortável) */
  background: #fff;
}

.pgr-tabela thead th {
  background: #f0f5fa;
  color: #1e3a5f;
  font-weight: 700;
  padding: 5px 5px;        /* 6x6 → 5x5 */
  text-align: center;
  border-bottom: 2px solid #c5d3e0;
  font-size: 7.5pt;
  white-space: nowrap;
}

.pgr-th-grupo { width: 72px; }
.pgr-th-agente { width: 110px; }
.pgr-th-exp { width: 50px; text-align: center !important; }
.pgr-th-aval { width: 50px; text-align: center !important; }
.pgr-th-acoes { width: 124px; min-width: 124px; }

/* Colunas com conteúdo curto: encolher pra não desperdiçar largura */
.pgr-th-exposicao    { width: 70px; }
.pgr-th-probabilidade{ width: 74px; }
.pgr-th-severidade   { width: 56px; }
.pgr-th-classificacao{ width: 74px; text-align: center !important; }
.pgr-th-epi          { width: 48px;  text-align: center !important; }
.pgr-th-plano        { width: 48px;  text-align: center !important; }

/* Colunas de texto livre: largura fixa + quebra de linha (em vez de empurrar a tabela) */
.pgr-th-fontes   { width: 110px; }
.pgr-th-trajetos { width: 140px; }
.pgr-th-danos    { width: 140px; }

.pgr-td-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
}

.pgr-tabela tbody td {
  padding: 4px 5px;        /* 5x6 → 4x5 */
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
  text-align: center;
  color: #2c3e50;
}

.pgr-tabela tbody tr:last-child td { border-bottom: none; }

.pgr-linha-vazia td {
  text-align: center;
  color: #8a98a5;
  font-style: italic;
  padding: 24px 12px !important;
  background: #fafbfc;
}

.pgr-linha-persistida {
  background: #fff;
}
.pgr-linha-persistida:hover {
  background: #fafbfc;
}

.pgr-linha-nova {
  background: #fffbf2;
  border-left: 3px solid #c46a00;
}

.pgr-cel-grupo {
  padding: 8px 10px !important;
  text-align: center;
  font-size: 8.5pt;
  letter-spacing: 0.3px;
}

.pgr-cel-grupo-edit {
  padding: 4px !important;
}

.pgr-cel-agente {
  font-weight: 500;
}

.pgr-cel-center { text-align: center; }
.pgr-cel-disabled { color: #b0bcc8; font-style: italic; font-size: 8.5pt; }

/* Célula vazia aguardando seleção do grupo */
.pgr-cel-aguardando {
  display: inline-block;
  width: 100%;
  height: 28px;
  background: repeating-linear-gradient(
    -45deg,
    #fafbfc,
    #fafbfc 6px,
    #f4f6f9 6px,
    #f4f6f9 12px
  );
  border-radius: 3px;
  opacity: 0.4;
}

.pgr-cel-acoes {
  white-space: nowrap;
  text-align: center;
  padding: 6px 8px !important;
}

/* GGR pill */
.pgr-ggr-pill {
  color: #fff;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 9pt;
  letter-spacing: 0.3px;
  display: inline-block;
}

/* Inputs da linha em edição */
.pgr-input-select,
.pgr-input-text {
  width: 100%;
  padding: 6px 26px 6px 10px;
  border: 1px solid #dde4ec;
  border-radius: 4px;
  font-size: 9pt;
  font-family: inherit;
  color: #2c3e50;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.12s;
}

.pgr-input-text {
  padding: 6px 10px;
}

.pgr-input-select:focus,
.pgr-input-text:focus {
  outline: none;
  border-color: #1e3a5f;
}

.pgr-input-sm {
  text-align: center;
  font-weight: 700;
}

.pgr-cel-grupo-edit .pgr-input-select {
  background: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

/* Botões */
.pgr-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 9.5pt;
  transition: background 0.15s;
  font-family: inherit;
}
.pgr-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pgr-btn-primary { background: #3d8b37; color: #fff; }
.pgr-btn-primary:hover:not(:disabled) { background: #347730; }

.pgr-acoes-tabela {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Grupo de botões alinhado à direita da barra de ações.
   Usado pelos botões "+ LTCAT sem PGR" e "+ LTIP sem PGR" que só aparecem
   quando o GHE está vazio. Em telas pequenas, com flex-wrap, eles caem
   pra próxima linha de forma natural. */
.pgr-acoes-direita {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.pgr-btn-add-linha {
  background: #1e3a5f;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.pgr-btn-add-linha:hover { background: #162d4a; }

/* Botão "+ LTCAT sem PGR" — uso pra clientes que compraram só o LTCAT.
   Estilo dourado/âmbar pra diferenciar do "+ Adicionar linha" azul padrão. */
.pgr-btn-add-ltcat-only {
  background: #fff;
  color: #7a5a00;
  border: 1.5px solid #c46a00;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-left: 4px;
}
.pgr-btn-add-ltcat-only:hover {
  background: #c46a00;
  color: #fff;
}

/* Botão "+ LTIP sem PGR" — mesmo estilo do LTCAT-only (família "laudo avulso") */
.pgr-btn-add-ltip-only {
  background: #fff;
  color: #7a5a00;
  border: 1.5px solid #c46a00;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-left: 4px;
}
.pgr-btn-add-ltip-only:hover {
  background: #c46a00;
  color: #fff;
}

/* Separador visual entre grupos de botões na barra de ações.
   Divide "ações primárias de criar" (adicionar/LTCAT/LTIP) de "extras" (importar/plano/treinamento). */
.pgr-acoes-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: #c5d3e0;
  margin: 0 6px;
  vertical-align: middle;
  align-self: center;
}

/* Linha "incompleta" — risco criado via LTCAT-only, PGR ainda não preenchido.
   Borda lateral âmbar discreta avisa visualmente que precisa de atenção. */
.pgr-linha-incompleta td:first-child {
  position: relative;
}
.pgr-linha-incompleta td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #c46a00;
}
.pgr-linha-incompleta {
  background: #fffbf2;
}

/* Selo "PGR pendente" — aparece ao lado do nome do agente em linhas incompletas */
.pgr-selo-incompleto {
  display: inline-block;
  margin-left: 6px;
  background: #fff5e1;
  color: #c46a00;
  font-size: 7pt;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
  white-space: nowrap;
}

/* Botão "Importar riscos por função" — secundário, ao lado do "+ Adicionar linha" */
.pgr-btn-importar-funcao {
  background: #fff;
  color: #1e3a5f;
  border: 1.5px solid #c5d3e0;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 9pt;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.pgr-btn-importar-funcao:hover {
  background: #f0f5fa;
  border-color: #1e3a5f;
}

/* ── MODAL "IMPORTAR RISCOS POR FUNÇÃO" ──────────────────────── */

.pgr-imp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, 0.6);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: pgrImpFade 0.2s ease;
}

@keyframes pgrImpFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pgrImpSlide {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pgr-imp-modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: pgrImpSlide 0.25s ease;
  overflow: hidden;
}

.pgr-imp-header {
  background: #1e3a5f;
  color: #fff;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 11pt;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pgr-imp-fechar {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18pt;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.pgr-imp-fechar:hover { opacity: 1; }

.pgr-imp-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.pgr-imp-busca-wrap {
  margin-bottom: 16px;
}

.pgr-imp-label {
  display: block;
  font-size: 9.5pt;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 6px;
}

.pgr-imp-busca-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #c5d3e0;
  border-radius: 6px;
  font-size: 10.5pt;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.pgr-imp-busca-input:focus {
  border-color: #1e3a5f;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

/* Linha de busca: input + botão Pesquisar + botão Limpar */
.pgr-imp-busca-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.pgr-imp-busca-row .pgr-imp-busca-input {
  flex: 1;
}

.pgr-imp-btn-buscar {
  background: #1e3a5f;
  color: #fff;
  border: none;
  padding: 0 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10pt;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.pgr-imp-btn-buscar:hover { background: #162d4a; }

.pgr-imp-btn-limpar {
  background: #fff;
  color: #A32D2D;
  border: 1.5px solid #c5d3e0;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12pt;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.pgr-imp-btn-limpar:hover {
  background: #fde8e8;
  border-color: #A32D2D;
}

/* Sugestões clicáveis das funções do GHE atual */
.pgr-imp-sugestoes {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pgr-imp-sugestoes-label {
  font-size: 9pt;
  color: #5a7a8a;
  font-style: italic;
}

.pgr-imp-sugestao-btn {
  background: #f0f5fa;
  color: #1e3a5f;
  border: 1px solid #c5d3e0;
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 9pt;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.pgr-imp-sugestao-btn:hover {
  background: #e0e8f0;
  border-color: #1e3a5f;
}

.pgr-imp-sugestao-ativa {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}
.pgr-imp-sugestao-ativa:hover {
  background: #162d4a;
}

.pgr-imp-vazio {
  text-align: center;
  padding: 30px 14px;
  color: #5a7a8a;
  font-size: 10pt;
}
.pgr-imp-vazio small {
  display: block;
  margin-top: 8px;
  color: #8a98a5;
  font-size: 9pt;
  font-style: italic;
}

.pgr-imp-resultados {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pgr-imp-grupo {
  border: 1px solid #e0e8f0;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pgr-imp-grupo-expandido {
  border-color: #1e3a5f;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.1);
}

.pgr-imp-grupo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.15s;
}
.pgr-imp-grupo-header:hover { background: #eef3f8; }

.pgr-imp-grupo-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pgr-imp-grupo-info strong {
  color: #1e3a5f;
  font-size: 10pt;
}

.pgr-imp-grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pgr-imp-modo-badge {
  color: #fff;
  font-size: 7.5pt;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pgr-imp-grupo-detalhes {
  font-size: 9pt;
  color: #5a7a8a;
}

.pgr-imp-grupo-acoes {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pgr-imp-marcados {
  font-size: 9pt;
  font-weight: 600;
  color: #3d8b37;
  background: #e8f5e6;
  padding: 3px 8px;
  border-radius: 4px;
}

.pgr-imp-arrow {
  font-size: 9pt;
  color: #5a7a8a;
}

.pgr-imp-grupo-corpo {
  background: #fff;
  border-top: 1px solid #e0e8f0;
}

.pgr-imp-grupo-marcar-todos {
  padding: 8px 14px;
  border-bottom: 1px solid #f0f3f7;
  background: #fafbfc;
}

.pgr-imp-btn-marcar-todos {
  background: transparent;
  border: 1px dashed #c5d3e0;
  color: #1e3a5f;
  font-size: 9pt;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.pgr-imp-btn-marcar-todos:hover {
  background: #f0f5fa;
  border-style: solid;
}

.pgr-imp-risco {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f7;
  transition: background 0.1s;
}
.pgr-imp-risco:last-child { border-bottom: none; }
.pgr-imp-risco:hover { background: #f8fafc; }

.pgr-imp-risco-ativo {
  background: #e8f0f8;
}
.pgr-imp-risco-ativo:hover { background: #d8e4f0; }

.pgr-imp-risco-check {
  font-size: 12pt;
  color: #1e3a5f;
}

.pgr-imp-risco-grupo {
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pgr-imp-risco-agente {
  flex: 1;
  font-size: 10pt;
  color: #2c3e50;
}

.pgr-imp-risco-ggr {
  color: #fff;
  font-size: 8.5pt;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
}

.pgr-imp-rodape {
  border-top: 1px solid #e3e9ef;
  background: #f8fafc;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pgr-imp-opcoes {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.pgr-imp-opcao {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5pt;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
}

.pgr-imp-botoes {
  display: flex;
  gap: 10px;
}

.pgr-imp-btn-cancelar {
  padding: 8px 16px;
  background: #fff;
  color: #2c3e50;
  border: 1px solid #c5d3e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10pt;
  font-weight: 600;
  font-family: inherit;
}
.pgr-imp-btn-cancelar:hover { background: #f0f5fa; }

.pgr-imp-btn-confirmar {
  padding: 8px 18px;
  background: #3d8b37;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10pt;
  font-weight: 600;
  transition: background 0.15s;
  font-family: inherit;
}
.pgr-imp-btn-confirmar:hover:not(:disabled) { background: #2d7028; }
.pgr-imp-btn-confirmar:disabled {
  background: #b8c8b5;
  cursor: not-allowed;
  opacity: 0.7;
}

.pgr-btn-icone {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11pt;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.6;
  transition: all 0.15s;
}
.pgr-btn-icone:hover { opacity: 1; background: #f0f3f7; }

/* Botões de ação na linha (Salvar / Excluir com texto) */
.pgr-btn-linha {
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 8.5pt;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  margin-right: 4px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: inline-block;
}
.pgr-btn-linha:last-child { margin-right: 0; }
.pgr-btn-linha:disabled { opacity: 0.5; cursor: not-allowed; }

.pgr-btn-linha-salvar {
  background: #3d8b37;
  color: #fff;
}
.pgr-btn-linha-salvar:hover:not(:disabled) {
  background: #347730;
}

.pgr-btn-linha-excluir {
  background: #fff;
  color: #A32D2D;
  border: 1px solid #e8b8b8;
}
.pgr-btn-linha-excluir:hover:not(:disabled) {
  background: #fff5f5;
  border-color: #A32D2D;
}

/* Botão Editar (linha persistida) */
.pgr-btn-linha-editar {
  background: #fff;
  color: #1e3a5f;
  border: 1px solid #c5d3e0;
}
.pgr-btn-linha-editar:hover:not(:disabled) {
  background: #f0f5fa;
  border-color: #1e3a5f;
}

/* Botão Cancelar (modo edição) */
.pgr-btn-linha-cancelar-edit {
  background: #fff;
  color: #5a7a8a;
  border: 1px solid #dde4ec;
}
.pgr-btn-linha-cancelar-edit:hover:not(:disabled) {
  background: #f8fafc;
  color: #1e3a5f;
  border-color: #1e3a5f;
}

/* Variante compacta — usada quando a linha ainda está vazia (sem agente),
   o botão fica na célula de ações em vez do footer */
.pgr-btn-cancelar-linha-vazia {
  padding: 4px 10px;
  font-size: 8.5pt;
  white-space: nowrap;
}

/* Linha em modo edição — destaque sutil amarelo (igual linha nova) */
.pgr-linha-editando {
  background: #fffbf2;
  border-left: 3px solid #c46a00;
}

/* ── BLOCO DE MEDIDAS INLINE (logo abaixo da linha em edição) ── */

.pgr-linha-medidas-inline {
  background: #fffbf2;
}

.pgr-linha-medidas-inline > td {
  padding: 0 !important;
  border-top: 1px dashed #f0c87a;
  border-bottom: 2px solid #c46a00;
  /* Permite que o dropdown do multi-select escape do td */
  overflow: visible !important;
  position: relative;
}

.pgr-medidas-inline-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px 12px 4px;
  background: #fffefa;
  /* Garante espaço pro dropdown abrir embaixo */
  overflow: visible;
  position: relative;
}

.pgr-medidas-inline-bloco {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Cada bloco precisa permitir overflow pro dropdown sair pra fora */
  overflow: visible;
  position: relative;
}

.pgr-medidas-inline-label {
  font-weight: 600;
  font-size: 8.5pt;
  color: #5a4a20;
  text-align: center;
}

@media (max-width: 768px) {
  .pgr-medidas-inline-wrap {
    grid-template-columns: 1fr;
  }
}

/* ── PLANO DE AÇÃO INLINE (logo abaixo das medidas) ──────────── */

.pgr-plano-inline-wrap {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff8e8;
  border: 1px solid #f0c87a;
  border-radius: 8px;
}

/* Footer com botões Salvar/Cancelar/Excluir do bloco em edição */
.pgr-footer-acoes {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 4px 12px 8px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e0e8f0;
  border-radius: 5px;
}

.pgr-footer-acoes .pgr-btn-linha {
  font-size: 9pt;
  padding: 5px 12px;
  min-width: 80px;
}

.pgr-plano-inline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #f0c87a;
}

.pgr-plano-inline-titulo {
  font-weight: 700;
  font-size: 11pt;
  color: #5a4a20;
}

.pgr-plano-inline-info {
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.pgr-plano-inline-vazio {
  margin: 8px 0 12px;
  color: #8a7a4a;
  font-size: 9.5pt;
  font-style: italic;
}

.pgr-plano-inline-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

/* Linha de uma ação */
.pgr-acao-linha {
  display: grid;
  grid-template-columns: 2.5fr 1.5fr 1fr 1fr 30px;
  gap: 8px;
  align-items: end;
  padding: 8px;
  background: #fff;
  border: 1px solid #ead5a8;
  border-radius: 6px;
}

.pgr-acao-campo {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pgr-acao-campo label {
  font-size: 8pt;
  font-weight: 600;
  color: #5a4a20;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.pgr-input-text-acao,
.pgr-input-select-acao {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #dde4ec;
  border-radius: 4px;
  font-size: 9pt;
  font-family: inherit;
  color: #2c3e50;
  background: #fff;
  box-sizing: border-box;
}

.pgr-input-text-acao:focus,
.pgr-input-select-acao:focus {
  outline: none;
  border-color: #c46a00;
}

.pgr-acao-campo-prazo {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pgr-input-prazo-custom {
  margin-top: 4px;
  width: 100%;
}

.pgr-acao-campo-acoes {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;
}

.pgr-btn-remover-acao {
  background: #fff;
  border: 1px solid #e8b8b8;
  color: #A32D2D;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14pt;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.15s;
}
.pgr-btn-remover-acao:hover {
  background: #fff5f5;
  border-color: #A32D2D;
}

.pgr-btn-add-acao {
  background: #fff;
  border: 1px dashed #c46a00;
  color: #c46a00;
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 9pt;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s;
}
.pgr-btn-add-acao:hover {
  background: #fffbf2;
  border-style: solid;
}

@media (max-width: 1100px) {
  .pgr-acao-linha {
    grid-template-columns: 1fr 1fr;
  }
  .pgr-acao-campo-acao,
  .pgr-acao-campo-resp {
    grid-column: 1 / -1;
  }
}

/* ── ÍCONES DE STATUS NA LINHA PERSISTIDA (EPI/EPC + Plano) ──── */

.pgr-th-status {
  width: 70px;
  text-align: center !important;
}

.pgr-cel-status {
  text-align: center;
  vertical-align: middle;
}

.pgr-icone-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12pt;
  font-weight: 700;
  font-family: Arial, sans-serif;
  cursor: help;
  border: 1.5px solid;
  user-select: none;
}

/* Verde — OK / tudo concluído */
.pgr-icone-ok {
  background: #e8f5e6;
  color: #2d6f28;
  border-color: #a8d4a3;
}

/* Vermelho — sem plano cadastrado */
.pgr-icone-erro {
  background: #fde8e8;
  color: #A32D2D;
  border-color: #e8b8b8;
}

/* Amarelo — em andamento/pendente */
.pgr-icone-pendente {
  background: #fff8e8;
  color: #c46a00;
  border-color: #f0c87a;
}

/* Vermelho piscando — atrasado */
.pgr-icone-atrasado {
  background: #fde8e8;
  color: #A32D2D;
  border-color: #A32D2D;
  font-weight: 900;
  animation: pgr-pulse-atrasado 1.5s ease-in-out infinite;
}

@keyframes pgr-pulse-atrasado {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.08); }
}

/* Cinza — não se aplica (Irrelevante) */
.pgr-icone-na {
  background: #f0f4f9;
  color: #7fa8c8;
  border-color: #c5d3e0;
  font-size: 14pt;
  font-weight: 400;
}

/* ── MODAL DE INPUT (substitui prompt nativo) ────────────────── */

.pgr-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 30, 50, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pgr-fade-in 0.15s ease-out;
}

@keyframes pgr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pgr-modal-caixa {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: pgr-slide-up 0.18s ease-out;
}

@keyframes pgr-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pgr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1e3a5f;
  color: #fff;
}

.pgr-modal-header h3 {
  margin: 0;
  font-size: 11.5pt;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.pgr-modal-fechar {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16pt;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.pgr-modal-fechar:hover {
  background: rgba(255, 255, 255, 0.25);
}

.pgr-modal-corpo {
  padding: 20px;
}

.pgr-modal-label {
  display: block;
  font-weight: 600;
  font-size: 9.5pt;
  color: #2c3e50;
  margin-bottom: 8px;
}

.pgr-modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dde4ec;
  border-radius: 6px;
  font-size: 10.5pt;
  font-family: inherit;
  color: #2c3e50;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pgr-modal-input:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.pgr-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e3e9ef;
}

.pgr-modal-footer .pgr-btn-linha {
  padding: 8px 18px;
  font-size: 9.5pt;
}

/* Variante com 3 botões — cancelar (esquerda), continuar e editar (direita) */
.pgr-modal-footer-3btn {
  flex-wrap: wrap;
}
.pgr-modal-footer-3btn #pgr-dup-cancelar {
  margin-right: auto; /* empurra os outros 2 pra direita */
}
.pgr-modal-footer-3btn #pgr-dup-continuar {
  background: #fff;
  color: #c46a00;
  border: 1.5px solid #c46a00;
}
.pgr-modal-footer-3btn #pgr-dup-continuar:hover {
  background: #fff8eb;
}

/* ── MODAL DE AVISO (variante do modal padrão) ───────────────── */

.pgr-modal-caixa-aviso {
  max-width: 480px;
}

/* Cabeçalho varia por tipo */
.pgr-modal-header-aviso { background: #c46a00; }
.pgr-modal-header-erro { background: #A32D2D; }
.pgr-modal-header-sucesso { background: #3d8b37; }

/* Mensagem principal */
.pgr-modal-mensagem {
  margin: 0 0 12px 0;
  color: #2c3e50;
  font-size: 10pt;
  line-height: 1.5;
}

.pgr-modal-mensagem:last-child {
  margin-bottom: 0;
}

/* Lista de itens (campos faltando, etc) */
.pgr-modal-lista {
  margin: 8px 0 0 0;
  padding: 12px 16px 12px 32px;
  background: #fafbfc;
  border: 1px solid #e3e9ef;
  border-radius: 6px;
  list-style-type: disc;
}

.pgr-modal-lista li {
  color: #1e3a5f;
  font-size: 9.5pt;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
}

.pgr-modal-lista li:last-child {
  margin-bottom: 0;
}

/* Botão cancelar discreto (× quando linha vazia, antes de escolher grupo) */
.pgr-btn-linha-cancelar {
  background: none;
  color: #8a98a5;
  border: 1px solid #dde4ec;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13pt;
  line-height: 1;
  font-weight: 400;
  transition: all 0.15s;
  font-family: inherit;
}
.pgr-btn-linha-cancelar:hover {
  background: #fff5f5;
  color: #A32D2D;
  border-color: #e8b8b8;
}

/* Input de agente "Outro" (digitação manual) */
.pgr-agente-outro-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pgr-agente-outro-wrap input {
  flex: 1;
}
.pgr-btn-voltar-lista {
  background: #f0f3f7;
  border: 1px solid #dde4ec;
  color: #5a7a8a;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11pt;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s;
}
.pgr-btn-voltar-lista:hover {
  background: #dde4ec;
  color: #1e3a5f;
}

/* ── AUTOCOMPLETE ────────────────────────────────────────────── */

.pgr-autocomplete-wrap {
  position: relative;
}

.pgr-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dde4ec;
  border-radius: 5px;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(30, 58, 95, 0.12);
  min-width: 220px;
}

.pgr-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f7;
  transition: background 0.1s;
}
.pgr-ac-item:last-child { border-bottom: none; }
.pgr-ac-item:hover { background: #f8fafc; }

.pgr-ac-ico { font-size: 11pt; }
.pgr-ac-texto {
  flex: 1;
  font-size: 9pt;
  color: #2c3e50;
}

/* ── MEDIDAS DE CONTROLE (chips multi-seleção) ───────────────── */

.pgr-medidas {
  background: #fff;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 20px;
}

.pgr-medidas h3 {
  color: #1e3a5f;
  margin: 0 0 6px 0;
  font-size: 11.5pt;
  font-weight: 700;
}

.pgr-medidas-hint {
  color: #5a7a8a;
  font-size: 9.5pt;
  margin: 0 0 16px 0;
  font-style: italic;
}

.pgr-medidas-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bloco de cada agente */
.pgr-medida-bloco {
  background: #fafbfc;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
  padding: 14px 16px;
}

.pgr-medida-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3e9ef;
}

.pgr-medida-header strong {
  color: #2c3e50;
  font-size: 11pt;
}

.pgr-medida-secao {
  margin-bottom: 10px;
}

.pgr-medida-secao:last-child {
  margin-bottom: 0;
}

.pgr-medida-label {
  display: block;
  font-weight: 600;
  font-size: 9.5pt;
  color: #2c3e50;
  margin-bottom: 6px;
}

/* Pill do grupo (já existia, garantindo) */
.pgr-grupo-pill {
  display: inline-block;
  color: #fff;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Container dos chips dentro do campo */
.pgr-chips-wrap { display: none; } /* legado, não usado mais */

/* ── DROPDOWN MULTI-SELECT (campo compacto) ──────────────────── */

.pgr-ms-wrap {
  position: relative;
}

/* Campo principal — mostra os chips selecionados + setinha */
.pgr-ms-campo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 28px 4px 8px;
  border: 1px solid #dde4ec;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  min-height: 28px;
  transition: border-color 0.15s;
  position: relative;
}

.pgr-ms-campo:hover {
  border-color: #1e3a5f;
}

.pgr-ms-aberto {
  border-color: #1e3a5f;
  border-radius: 6px 6px 0 0;
}

.pgr-ms-placeholder {
  color: #8a98a5;
  font-size: 9pt;
  font-style: italic;
}

/* Chip dentro do campo (item selecionado) */
.pgr-ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1e3a5f;
  color: #fff;
  padding: 3px 4px 3px 9px;
  border-radius: 11px;
  font-size: 8.5pt;
  font-weight: 500;
  white-space: nowrap;
}

.pgr-ms-chip-x {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11pt;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.pgr-ms-chip-x:hover {
  background: rgba(255,255,255,0.4);
}

.pgr-ms-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #5a7a8a;
  font-size: 8pt;
  pointer-events: none;
}

/* Dropdown aberto — usa position fixed pra escapar de containers com overflow */
.pgr-ms-dropdown {
  position: fixed;
  background: #fff;
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.25);
  /* Posição e largura definidas via JS quando abre */
}

/* ── BARRA DE BUSCA NO TOPO DO DROPDOWN ─────────────────────── */

.pgr-ms-busca {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e3e9ef;
  position: sticky;
  top: 0;
  z-index: 2;
}

.pgr-ms-busca-icone {
  font-size: 11pt;
  color: #5a7a8a;
  user-select: none;
}

.pgr-ms-busca-input {
  flex: 1;
  border: 1px solid #c5d3e0;
  background: #fff;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 9.5pt;
  color: #2c3e50;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pgr-ms-busca-input:focus {
  border-color: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.12);
}

.pgr-ms-busca-input::placeholder {
  color: #a8b5c0;
  font-style: italic;
}

.pgr-ms-busca-limpar {
  background: transparent;
  border: 1px solid #d0dae4;
  color: #5a7a8a;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 10pt;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}

.pgr-ms-busca-limpar:hover {
  background: #fde8e8;
  border-color: #e8b8b8;
  color: #A32D2D;
}

/* Estado "nenhum item encontrado" + atalho de adicionar */
.pgr-ms-busca-vazio {
  padding: 18px 14px;
  text-align: center;
}

.pgr-ms-busca-vazio p {
  margin: 0 0 12px;
  color: #5a7a8a;
  font-size: 9.5pt;
  font-style: italic;
}

.pgr-ms-btn-adicionar-busca {
  display: inline-block;
  background: #fff8e8;
  border: 1px dashed #c46a00;
  color: #7a5a00;
  font-size: 9.5pt;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-style 0.15s;
  text-align: left;
  max-width: 100%;
  word-break: break-word;
}

.pgr-ms-btn-adicionar-busca:hover {
  background: #fff0c8;
  border-style: solid;
}

.pgr-ms-vazio {
  color: #8a98a5;
  font-style: italic;
  font-size: 9pt;
  padding: 14px;
  margin: 0;
  text-align: center;
}

/* Aviso suave: agente sem biblioteca, mas "Não há" + busca + Outro continuam disponíveis */
.pgr-ms-vazio-suave {
  color: #5a7a8a;
  font-size: 9pt;
  padding: 12px 14px;
  margin: 0;
  text-align: center;
  background: #f8fafc;
  border-bottom: 1px solid #e3e9ef;
}

.pgr-ms-vazio-suave small {
  color: #8a98a5;
  display: inline-block;
  margin-top: 3px;
}

.pgr-ms-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f7;
  transition: background 0.1s;
  user-select: none;
}

.pgr-ms-item:hover {
  background: #f8fafc;
}

.pgr-ms-item-ativo {
  background: #f0f5fa;
}

.pgr-ms-item-ativo:hover {
  background: #e6eef5;
}

.pgr-ms-check {
  font-size: 12pt;
  color: #1e3a5f;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.pgr-ms-texto {
  flex: 1;
  font-size: 9.5pt;
  color: #2c3e50;
}

.pgr-ms-divisor {
  height: 1px;
  background: #e3e9ef;
  margin: 2px 0;
}

.pgr-ms-divisor-suave {
  height: 1px;
  background: #f0f4f9;
  margin: 4px 8px;
}

/* Cabeçalho de seção dentro do dropdown (Sua biblioteca, Biblioteca geral, etc) */
.pgr-ms-cabecalho {
  padding: 6px 10px 4px;
  font-size: 8.5pt;
  font-weight: 700;
  color: #5a7a8a;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #f8fafc;
  border-bottom: 1px solid #e3e9ef;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pgr-ms-cabecalho:not(:first-child) {
  margin-top: 4px;
}

.pgr-ms-item-outro {
  color: #c46a00;
  font-weight: 600;
}

/* Items da BIBLIOTECA PESSOAL — com botões editar/excluir inline */
.pgr-ms-item-pessoal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-right: 6px;
}

.pgr-ms-item-pessoal .pgr-ms-item-conteudo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  padding: 4px 0;
}

.pgr-ms-item-acoes {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.pgr-ms-btn-editar,
.pgr-ms-btn-excluir {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11pt;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}

.pgr-ms-btn-editar:hover {
  opacity: 1;
  background: #e8f0f8;
}

.pgr-ms-btn-excluir:hover {
  opacity: 1;
  background: #fde8e8;
}

.pgr-ms-item-outro:hover {
  background: #fffbf2;
}

.pgr-ms-item-outro .pgr-ms-check,
.pgr-ms-item-outro .pgr-ms-texto {
  color: #c46a00;
}

/* ── RESPONSIVO ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .pgr-header { flex-direction: column; align-items: flex-start; }
  .pgr-ghe-header { flex-wrap: wrap; }
  .pgr-ghe-local { width: 100%; order: 3; margin-top: 4px; }
}

/* ═══════════════════════════════════════════════════════════════════
   PGR FASE 3 — Ações Independentes + Treinamentos por GHE
   ═══════════════════════════════════════════════════════════════════ */

/* Bloco extra (sob a tabela de riscos) */
.pgr-bloco-extra {
  margin-top: 8px;
  padding: 9px 14px;
  background: #fafbfd;
  border: 1px solid #e3e9ef;
  border-radius: 8px;
}

.pgr-bloco-extra-titulo {
  font-weight: 700;
  font-size: 10.5pt;
  color: #1e3a5f;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pgr-bloco-extra-count {
  background: #1e3a5f;
  color: #fff;
  font-size: 9pt;
  font-weight: 700;
  padding: 1px 9px;
  border-radius: 12px;
}

.pgr-bloco-extra-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Linha individual — card com rótulos visíveis (padrão JRS) */
.pgr-card-extra {
  background: #fff;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  padding: 12px 14px;
  transition: box-shadow 0.15s;
}

.pgr-card-extra:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pgr-card-extra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.pgr-card-extra-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 8.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pgr-card-extra-acoes {
  display: flex;
  gap: 4px;
}

.pgr-card-extra-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Treinamento usa só 2 colunas (Nome + Recorrência) */
.pgr-card-extra .pgr-card-extra-grid:has(.pgr-card-extra-field:nth-child(2):last-child) {
  grid-template-columns: 2fr 1fr;
}

.pgr-card-extra-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pgr-card-extra-field-acao {
  word-break: break-word;
}

.pgr-card-extra-label {
  font-size: 8pt;
  color: #7a8a9a;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.pgr-card-extra-valor {
  font-size: 10pt;
  color: #1a1a1a;
  line-height: 1.4;
  word-break: break-word;
}

.pgr-btn-edit-extra,
.pgr-btn-del-extra {
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 8.5pt;
  font-weight: 600;
  color: #1e3a5f;
  font-family: inherit;
  transition: all 0.15s;
}

.pgr-btn-edit-extra:hover {
  background: #f4f7fa;
  border-color: #1e3a5f;
}

.pgr-btn-del-extra {
  color: #A32D2D;
  border-color: #f5c5c5;
}

.pgr-btn-del-extra:hover {
  background: #fef0f0;
  border-color: #A32D2D;
}

/* Bloco extra vazio — visual discreto pra descobribilidade sem poluir */
.pgr-bloco-extra-vazio {
  background: #fafbfd;
  border: 1px dashed #c5d3e0;
  text-align: center;
  padding: 9px 14px;
}

.pgr-bloco-extra-vazio .pgr-bloco-extra-titulo {
  justify-content: center;
  color: #5a7a8a;
  margin-bottom: 2px;
  font-size: 10pt;
}

.pgr-bloco-extra-hint {
  font-size: 8pt;
  color: #7a8a9a;
  margin: 2px 0 8px;
  font-style: italic;
}

/* Botão de cadastrar dentro do bloco (no rodapé OU centrado se vazio) */
.pgr-btn-add-bloco-extra {
  background: #fff;
  border: 1px solid #1e3a5f;
  color: #1e3a5f;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 9.5pt;
  font-weight: 600;
  font-family: inherit;
  margin-top: 4px;
  transition: all 0.15s;
}

.pgr-btn-add-bloco-extra:hover {
  background: #f4f7fa;
}

.pgr-btn-add-bloco-extra-trein {
  border-color: #7a5a00;
  color: #7a5a00;
}

.pgr-btn-add-bloco-extra-trein:hover {
  background: #fdfaf3;
}

/* Botões antigos da barra (removidos do HTML mas mantemos CSS por compat) */
.pgr-btn-add-independente,
.pgr-btn-add-treinamento {
  display: none;
}

/* Responsivo — em telas estreitas, grid vira coluna única */
@media (max-width: 800px) {
  .pgr-card-extra-grid { grid-template-columns: 1fr; gap: 10px; }
  .pgr-card-extra-header { flex-direction: column; align-items: flex-start; }
  .pgr-card-extra-acoes { width: 100%; justify-content: flex-end; }
}

/* ─── Modal larga (4 colunas de ação) ──────────────────────────── */
.pgr-modal-caixa.pgr-modal-caixa-larga {
  max-width: 1100px;
  width: 95vw;
}

/* Botão "+ Adicionar outra ação" dentro do modal */
.pgr-btn-add-acao-modal {
  background: #fff;
  border: 1px dashed #c46a00;
  color: #c46a00;
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 9.5pt;
  font-weight: 600;
  font-family: inherit;
  margin-top: 8px;
  transition: all 0.15s;
}

.pgr-btn-add-acao-modal:hover {
  background: #fdfaf3;
  border-style: solid;
}

/* Bloco de contexto dentro dos modais (GHE → Setor → Subsetor → Funções) */
.pgr-modal-contexto {
  background: #f4f7fa;
  border-left: 3px solid #1e3a5f;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 9.5pt;
}

.pgr-modal-contexto-linha {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.pgr-modal-contexto-label {
  color: #5a7a8a;
  font-weight: 600;
  min-width: 78px;
  text-transform: uppercase;
  font-size: 8.5pt;
  letter-spacing: 0.3px;
}

.pgr-modal-contexto-linha strong {
  color: #1a1a1a;
  font-weight: 600;
}

/* ── Barra de blocos extras compactos (vazios viram chips) ───── */
.pgr-chips-extras {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.pgr-chip-extra {
  background: #fff; border: 1px solid #d6e0eb; color: #1e3a5f;
  border-radius: 7px; padding: 5px 11px; cursor: pointer;
  font-size: 8.5pt; font-weight: 600; font-family: inherit;
  transition: all .15s;
}
.pgr-chip-extra:hover { background: #f0f5fa; border-color: #1e3a5f; }
.pgr-chip-extra-trein { border-color: #c4a24a; color: #7a5a00; }
.pgr-chip-extra-trein:hover { background: #fdf8ec; border-color: #7a5a00; }

/* ── Blocos extras compactos (botões quando vazios) ──────────── */
.pgr-barra-extras {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e3e9ef;
}
.pgr-blocos-extras-wrap {
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
}
.pgr-blocos-extras-wrap:empty { display: none; }
.pgr-blocos-extras-wrap > .pgr-bloco-extra { margin-top: 8px; }
/* Botão compacto (barra fixa) */
.pgr-chip-extra {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px dashed #c5d3e0; color: #5a7a8a;
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  font-size: 9pt; font-weight: 600; font-family: inherit; transition: all 0.15s;
}
.pgr-chip-extra:hover { border-color: #1e3a5f; color: #1e3a5f; border-style: solid; background: #f6f9fc; }
.pgr-chip-extra-trein { color: #7a5a00; border-color: #d8c48a; }
.pgr-chip-extra-trein:hover { border-color: #7a5a00; color: #7a5a00; background: #faf6ec; }

/* ═══════════════════════════════════════════════════════════════════
   ENQUADRAMENTO LEGAL POR AGENTE — PCMSO · LTIP · LTCAT (mai/26)
   Estrutura inicial: só os botões na linha. Não afeta emissão do PGR.
   ═══════════════════════════════════════════════════════════════════ */

.pgr-th-enq { text-align: center; white-space: nowrap; width: 82px; min-width: 82px; }

.pgr-cel-enq {
  text-align: center;
  padding: 4px 4px;
  width: 96px;
}

/* Os 3 botões empilhados (um embaixo do outro) */
.pgr-btn-enq {
  display: block;
  width: 100%;
  border: 1px dashed #c5d3e0;
  background: #f8fafc;
  color: #5a7a8a;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 7.8pt;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  font-family: inherit;
  margin: 0 0 3px 0;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}
.pgr-btn-enq:last-child { margin-bottom: 0; }

.pgr-btn-enq:hover {
  border-color: #1e3a5f;
  border-style: solid;
  background: #f0f5fa;
  color: #1e3a5f;
}

/* Estado VERDE — preenchido com agente (LTCAT) / preenchido (PCMSO·LTIP placeholder) */
.pgr-btn-enq-ok {
  border: 1px solid #2d6f28;
  background: #3d8b37;
  color: #fff;
}
.pgr-btn-enq-ok:hover {
  background: #347730;
  border-color: #2d6f28;
  color: #fff;
}

/* Estado AZUL — salvo como ausência de agente (LTCAT) */
.pgr-btn-enq-ausencia {
  border: 1px solid #1e3a5f;
  background: #1e3a5f;
  color: #fff;
}
.pgr-btn-enq-ausencia:hover {
  background: #162d4a;
  border-color: #162d4a;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   TELA "EMISSÃO DE DOCUMENTOS" — 4 cards (PGR/PCMSO/LTCAT/LTIP)
   Cada card replica visualmente o padrão dos botões "Visualizar PDF"
   e "Emitir [DOC]" que já existem no módulo PGR. Estados:
     - Habilitado: botões coloridos, hover ativo
     - Desabilitado ('em breve'): cinza, cursor not-allowed, tag flutuante
   Quando cada módulo (PCMSO/LTCAT/LTIP) for finalizado, basta remover
   o atributo `disabled` e plugar a função nos botões data-emit-doc.
   ═══════════════════════════════════════════════════════════════ */

.emit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.emit-card {
  position: relative;
  background: #fff;
  border: 1px solid #dde4ec;
  border-radius: 10px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
}

.emit-card:hover {
  box-shadow: 0 4px 18px rgba(30,58,95,0.08);
  transform: translateY(-1px);
}

/* Barra colorida no topo de cada card (identidade visual por documento) */
.emit-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 10px 10px 0 0;
}
.emit-card-pgr::before   { background: #3d8b37; }
.emit-card-pcmso::before { background: #1e3a5f; }
.emit-card-ltcat::before { background: #7a5a00; }
.emit-card-ltip::before  { background: #a32d2d; }

.emit-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.emit-card-icone {
  font-size: 32pt;
  line-height: 1;
}

.emit-card-titulo {
  margin: 0;
  font-size: 14pt;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: 0.5px;
}

.emit-card-sub {
  margin: 2px 0 0;
  font-size: 8.5pt;
  color: #5a7a8a;
  font-weight: 500;
}

.emit-card-desc {
  margin: 0 0 14px;
  font-size: 9pt;
  color: #4a5a6a;
  line-height: 1.5;
  flex: 1;
}

.emit-card-acoes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.emit-btn {
  font-family: inherit;
  font-size: 9pt;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  border: 1.5px solid transparent;
}

/* Visualizar PDF (secundário) */
.emit-btn-prev {
  background: #fff;
  color: #1e3a5f;
  border-color: #c5d3e0;
}
.emit-btn-prev:not(:disabled):hover {
  background: #f0f5fa;
  border-color: #1e3a5f;
}

/* Emitir DOC (primário) */
.emit-btn-emit {
  background: #1e3a5f;
  color: #fff;
}
.emit-btn-emit:not(:disabled):hover {
  background: #162d4a;
}

/* Ver Histórico (terciário) — tom mais leve, foco em "consulta" e não em "ação" */
.emit-btn-hist {
  background: #fff;
  color: #5a7a8a;
  border-color: #dde4ec;
  border-style: dashed;
}
.emit-btn-hist:not(:disabled):hover {
  background: #f6f9fd;
  border-color: #5a7a8a;
  color: #1e3a5f;
}

/* Estado desabilitado ('em breve') — coerente entre os 2 botões */
.emit-btn:disabled {
  background: #f0f3f7;
  color: #a8b5c2;
  border-color: #e0e6ec;
  cursor: not-allowed;
}

/* Tag "Em breve" no canto do card */
.emit-card-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fff5e1;
  color: #c46a00;
  font-size: 7.5pt;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid #f0d870;
}

/* Responsivo: telas pequenas viram coluna única */
@media (max-width: 700px) {
  .emit-grid { grid-template-columns: 1fr; }
  .emit-card-titulo { font-size: 13pt; }
}

/* Rótulo de seção no menu lateral (não clicável).
   Usado pra "Programas de SST" — substitui o botão collapsible antigo,
   liberando os itens abaixo (PGR e Emitir Docs) pra ficarem no nível principal. */
.det-menu-rotulo {
  padding: 8px 1rem 4px;
  font-size: 9pt;
  font-weight: 600;
  color: #7fa8c8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  cursor: default;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════════════
   AUTOCOMPLETE DO LTCAT — dropdown de sugestões salvas
   Anexado em #ltcat-conclusao e #ltcat-tecmed quando o usuário digita.
   Aparência: estilo Google, com badge "usado Nx" indicando frequência.
   ═══════════════════════════════════════════════════════════════ */
.ltcat-ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: #fff;
  border: 1px solid #c5d3e0;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(15, 39, 68, 0.14);
  max-height: 260px;
  overflow-y: auto;
  z-index: 10002; /* Acima do overlay do modal LTCAT (z-index:10000) */
  font-family: Arial, sans-serif;
}

.ltcat-ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f7;
  font-size: 9.5pt;
  color: #1e3a5f;
  line-height: 1.4;
  transition: background-color 0.1s;
}
.ltcat-ac-item:last-child { border-bottom: none; }
.ltcat-ac-item:hover,
.ltcat-ac-item-sel {
  background: #f0f5fa;
}

.ltcat-ac-texto {
  flex: 1;
  /* Permite que textos longos quebrem em 2 linhas, mas limita pra não inflar */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ltcat-ac-freq {
  flex-shrink: 0;
  font-size: 8pt;
  color: #7a8a9a;
  background: #f6f9fd;
  padding: 2px 7px;
  border-radius: 9px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Botões da linha LTCAT/LTIP avulsa ──────────────────────────────
   Linha incompleta (criada via "+ LTCAT/LTIP sem PGR") tem ações diferentes:
   "Editar LTCAT/LTIP" e "Tornar PGR" no lugar do "Editar" padrão.
*/
.pgr-btn-linha-editar-laudo {
  background: #fff;
  color: #1e3a5f;
  border: 1px solid #c5d3e0;
  font-weight: 600;
}
.pgr-btn-linha-editar-laudo:hover {
  background: #f0f5fa;
  border-color: #1e3a5f;
}

.pgr-btn-linha-tornar-pgr {
  background: #fff;
  color: #3d8b37;
  border: 1px solid #3d8b37;
  font-weight: 600;
}
.pgr-btn-linha-tornar-pgr:hover {
  background: #3d8b37;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════
   VISUALIZAÇÃO RÁPIDA DE PDFs (PGR · PCMSO · LTCAT · LTIP)
   ───────────────────────────────────────────────────────────────────
   Substitui os antigos botões "Visualizar PDF / Emitir / Histórico"
   da barra superior. As ações de EMITIR e HISTÓRICO foram movidas
   pro módulo "Emissão de Documentos" — a tela técnica fica focada
   na gestão das informações.
   ═══════════════════════════════════════════════════════════════════ */
.pgr-visu-rapida {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pgr-visu-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: #5a7a8a;
  margin-right: 4px;
  letter-spacing: 0.3px;
}

.pgr-visu-btn {
  background: #fff;
  color: #1e3a5f;
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  font-family: inherit;
  white-space: nowrap;
}

.pgr-visu-btn:hover:not(:disabled) {
  background: #1e3a5f;
  color: #fff;
  transform: translateY(-1px);
}

.pgr-visu-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pgr-visu-btn-disabled,
.pgr-visu-btn:disabled {
  background: #f3f5f8;
  color: #bcc6cf;
  border-color: #dde4ec;
  cursor: not-allowed;
  opacity: 0.7;
}
