/* =======================================================================
   ATHENAS.CSS — página do agente Athenas (Acervo + Instruções).
   Só TOKENS do Design System (styles.css) — nada de hex solto. Reusa
   .hist-subnav (abas), .btn, .modal/.modal-wide (modal empilhado), .muted.
   Mobile-first: sem rolagem horizontal a 375 px (códigos quebram/rolam
   dentro do próprio bloco).
   ======================================================================= */

.ath-head h1 { margin-bottom: 4px; }
.ath-head p { max-width: 70ch; color: var(--text-secondary); }
.ath-abas { margin-top: 4px; }
.ath-painel:focus { outline: none; }
.ath-painel:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* --- topo do acervo (mesma largura da lista: botão alinhado com ela) --- */
.ath-acervo { max-width: 760px; }
.ath-topo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ath-topo-tit h2 { font-size: 1.15rem; color: var(--text-primary); margin: 0 0 2px; }
.ath-topo-tit p { margin: 0; }
.ath-add { white-space: nowrap; }
.ath-busca-linha { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ath-busca { flex: 1 1 220px; min-width: 0; max-width: 420px; }
.ath-contagem { font-size: .85rem; }
.ath-vazio { padding: 18px 4px; }

/* --- lista limpa: designação + versão; o resto fica nos Detalhes --- */
.ath-lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); }
.ath-item { display: flex; align-items: center; border-top: 1px solid var(--border); position: relative; }
.ath-item:first-child { border-top: 0; }
.ath-item-main { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  background: transparent; border: 0; padding: 12px 8px 12px 14px; cursor: pointer; text-align: left; color: var(--text-primary); font: inherit; }
.ath-item-main:hover { background: var(--surface-hover); }
.ath-item-fixo { cursor: default; padding-right: 14px; }
.ath-item-fixo:hover { background: transparent; }
.ath-item-main:focus-visible, .ath-kebab:focus-visible, .ath-menu button:focus-visible, .ath-drop:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ath-desig { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ath-ver { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ath-acoes { position: relative; padding-right: 6px; }
.ath-kebab { background: transparent; border: 0; border-radius: var(--radius-sm); width: 34px; height: 34px; cursor: pointer;
  color: var(--text-secondary); font-size: 1.15rem; line-height: 1; }
.ath-kebab:hover { background: var(--surface-hover); color: var(--text-primary); }
.ath-menu { position: absolute; right: 6px; top: calc(100% + 2px); z-index: 30; min-width: 150px; padding: 4px;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.ath-menu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-primary); font: inherit; }
.ath-menu button:hover { background: var(--surface-hover); }
.ath-menu .ath-menu-perigo { color: var(--danger); }

/* --- alertas --- */
.ath-alerta { border-radius: var(--radius-md); padding: 10px 12px; margin: 8px 0; font-size: .92rem; border: 1px solid transparent; }
.ath-alerta-info { background: var(--info-bg); color: var(--info-fg); }
.ath-alerta-aviso { background: var(--warning-bg); color: var(--warning-fg); }
.ath-alerta-erro { background: var(--danger-bg); color: var(--danger-fg); }
.ath-alerta-ok { background: var(--success-bg); color: var(--success-fg); }
.ath-nota { font-size: .86rem; margin: 8px 0; }

/* --- modal de inclusão --- */
.ath-oculto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ath-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 170px; padding: 18px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); cursor: pointer; color: var(--text-primary); }
.ath-drop:hover, .ath-drop-sobre { border-color: var(--accent); background: var(--accent-soft); }
.ath-drop-ic { font-size: 2rem; }
.ath-arq { font-weight: 600; word-break: break-word; margin: 0 0 8px; }
.ath-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 10px 0; }
.ath-campo { display: flex; flex-direction: column; min-width: 0; }
.ath-campo:last-child { grid-column: 1 / -1; }
.ath-label { font-size: .84rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.ath-ident-prev { font-size: .9rem; margin: 6px 0; color: var(--text-secondary); }
.ath-modal-rodape { justify-content: flex-end; margin-top: 14px; }

/* --- progresso --- */
.ath-prog-box { margin: 10px 0 6px; }
.ath-prog-tit { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ath-prog { height: 12px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.ath-prog-barra { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width .25s ease; }
.ath-prog-det { font-size: .9rem; color: var(--text-secondary); margin: 6px 0 0; min-height: 1.3em; }
.ath-fases { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .86rem; }
.ath-fase-feita { color: var(--success); }
.ath-fase-atual { color: var(--text-primary); font-weight: 700; }
.ath-fase-pendente { color: var(--text-muted); }
.ath-resumo { margin: 8px 0; padding-left: 18px; }
.ath-resumo li { margin: 3px 0; }

/* --- envio em lote (vários PDFs): lista de conferência + fila --- */
.ath-lote-resumo { font-size: .92rem; color: var(--text-secondary); margin: 0 0 6px; }
.ath-lote-resumo b { color: var(--text-primary); }
.ath-lote-geral { font-size: .88rem; color: var(--text-secondary); margin: 2px 0 8px; }
.ath-lote-lista { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ath-lote-item { padding: 10px 12px; border-top: 1px solid var(--border); }
.ath-lote-item:first-child { border-top: 0; }
.ath-lote-lin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ath-lote-chk { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); margin: 0; }
.ath-lote-info { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ath-lote-desig { font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.ath-lote-arq { font-size: .8rem; overflow-wrap: anywhere; }
.ath-lote-msg { font-size: .84rem; color: var(--text-secondary); margin: 6px 0 0; overflow-wrap: anywhere; }
.ath-lote-form { margin: 10px 0 2px; }
.ath-chip { display: inline-flex; align-items: center; white-space: nowrap; font-size: .78rem; font-weight: 700; padding: 3px 9px;
  border-radius: var(--radius-pill); border: 1px solid transparent; }
.ath-chip-ok { background: var(--success-bg); color: var(--success-fg); }
.ath-chip-info { background: var(--info-bg); color: var(--info-fg); }
.ath-chip-aviso { background: var(--warning-bg); color: var(--warning-fg); }
.ath-chip-erro { background: var(--danger-bg); color: var(--danger-fg); }
.ath-chip-neutro { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }

/* --- vigência: etiqueta na lista, aviso, confirmação, detalhes --- */
.ath-item-dir { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.ath-vig { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ath-vig-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 10px; }
.ath-vig-lista { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ath-vig-item { padding: 10px 12px; border-top: 1px solid var(--border); }
.ath-vig-item:first-child { border-top: 0; }
.ath-vig-lin { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.ath-vig-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.ath-vig-info b { color: var(--text-primary); overflow-wrap: anywhere; }
.ath-vig-mud { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-secondary); }
.ath-vig-det { font-size: .85rem; color: var(--text-secondary); margin: 6px 0 0 28px; overflow-wrap: anywhere; }
.ath-vig-evid { font-size: .84rem; margin: 4px 0 0 28px; overflow-wrap: anywhere; }
.ath-det-vig { margin: 0 0 8px; }

/* --- detalhes --- */
.ath-det-tit { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 1.1rem; }
.ath-det-titulo { margin: 4px 0 6px; }
.ath-badge-vig { display: inline-block; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 3px 10px; margin: 2px 0 8px; color: var(--text-secondary); }
.ath-dl { margin: 6px 0; }
.ath-dl-l { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.ath-dl-l dt { color: var(--text-secondary); font-size: .88rem; }
.ath-dl-l dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ath-hash { font-family: var(--font-mono); font-size: .78rem; overflow-wrap: anywhere; }
.ath-det-acoes { margin-top: 12px; }

/* --- instruções --- */
.ath-inst { max-width: 860px; }
.ath-inst h2 { font-size: 1.2rem; color: var(--text-primary); margin: 0 0 6px; }
.ath-inst-sec { margin: 18px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.ath-inst-sec h3 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; margin: 0 0 8px; color: var(--text-primary); }
.ath-inst-n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-size: .85rem; font-weight: 700; flex: 0 0 auto; }
.ath-lista-txt { padding-left: 20px; margin: 6px 0; }
.ath-lista-txt li { margin: 4px 0; }
.ath-inst code, .ath-cred code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.ath-code { border: 1px solid var(--border); border-radius: var(--radius-md); margin: 8px 0; background: var(--surface-2); overflow: hidden; }
.ath-code-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--border); font-size: .82rem; color: var(--text-secondary); }
.ath-code pre { margin: 0; padding: 10px 12px; overflow-x: auto; max-width: 100%; font-family: var(--font-mono); font-size: .82rem;
  white-space: pre; color: var(--text-primary); background: transparent; }
.ath-code pre code { background: transparent; padding: 0; font-size: inherit; }
.ath-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: .9rem; }
.ath-check input { width: auto; }
.ath-creds { list-style: none; padding: 0; margin: 10px 0; }
.ath-cred { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.ath-cred-nome { flex: 1 1 220px; min-width: 0; }
.ath-cred-meta { font-size: .82rem; flex: 1 1 260px; }
.ath-cred-inativa { opacity: .6; }
.ath-cred-acoes { margin: 0; gap: 6px; }
/* Instruções › rotina: situação (status, execuções, credenciais de serviço) */
.ath-rot { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); padding: 10px 12px; margin: 10px 0; }
.ath-rot-tit { margin: 0 0 4px; font-size: .95rem; color: var(--text-primary); }
.ath-rot .ath-creds { margin-bottom: 0; }
.ath-teste-linha { display: flex; gap: 8px; flex-wrap: wrap; }
.ath-teste-linha input { flex: 1 1 260px; min-width: 0; font-family: var(--font-mono); }
.ath-det-ferr { margin: 8px 0; }
.ath-det-ferr summary { cursor: pointer; font-weight: 600; }

@media (max-width: 600px) {
  .ath-form { grid-template-columns: minmax(0, 1fr); }
  .ath-dl-l { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ath-topo { align-items: stretch; }
  .ath-add { width: 100%; }
}
.ath-alvos { margin: 4px 0 14px; }
