/* HITL validación + ejecución en vivo. Paleta de las capturas adm_2 / adm_7.
   Solo lo enlazan validacion.html y admin/agentes_live.html. */
:root{
  --hitl-navy:#0B3954;
  --hitl-teal:#16A39A;
  --hitl-teal-d:#0f857d;
  --hitl-red:#E05252;
  --hitl-red-d:#c74343;
  --hitl-amber-bg:#fff4dc;
  --hitl-amber:#946200;
  --hitl-line:#dde3e8;
  --hitl-muted:#6b7a88;
  --hitl-ease:180ms ease;
  --hitl-radius:14px;
  --hitl-shadow:0 1px 3px rgba(11,57,84,.08);
}

.hitl-wrap{max-width:100%}
.hitl-card{
  background:#fff;border-radius:var(--hitl-radius);box-shadow:var(--hitl-shadow);
  padding:14px 16px;margin:.4rem 0 1rem;
}
.hitl-head{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;
  gap:.65rem .9rem;margin:0 0 .35rem;
}
.hitl-head h1{
  margin:0;color:var(--hitl-navy);font-size:17px;font-weight:700;
  display:flex;align-items:center;gap:.45rem;flex-wrap:wrap;
}
.hitl-badge{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:1.55rem;padding:2px 8px;border-radius:20px;
  background:var(--hitl-amber-bg);color:var(--hitl-amber);
  font-size:12px;font-weight:700;line-height:1.35;
  animation:hitl-count 280ms ease both;
}
.hitl-lead{margin:.15rem 0 .45rem;color:var(--hitl-muted);font-size:12.5px}
.hitl-docmeta{margin:0 0 .55rem;color:#5b6b78;font-size:.88em}
.hitl-kpis{display:flex;flex-wrap:wrap;gap:.4rem;margin:0 0 .6rem}
.hitl-kpi{
  background:#f4f7f9;border:1px solid var(--hitl-line);border-radius:10px;
  padding:.28rem .6rem;font-size:.75em;color:var(--hitl-muted);
  transition:background var(--hitl-ease);
}
.hitl-kpi:hover{background:#eef6f5}
.hitl-kpi b{color:var(--hitl-navy);font-size:1rem;margin-right:.28rem}
.hitl-kpi.big b{color:var(--hitl-teal-d)}
.hitl-filters{display:flex;flex-wrap:wrap;gap:.3rem;align-items:center;margin:0 0 .7rem}
.hitl-filters .pill{transition:background var(--hitl-ease),border-color var(--hitl-ease),color var(--hitl-ease)}
.hitl-sep{color:#b7c2cb;margin:0 .15rem}
.hitl-lote{display:inline-flex;align-items:center;gap:.45rem;margin-left:auto}
.hitl-conf{flex-direction:row;align-items:center;gap:.3rem;font-size:12px;color:var(--hitl-muted);margin:0}
.hitl-conf input[name="min_conf"]{width:4.2em;padding:.2rem .35rem}
.hitl-btn-all{
  background:transparent;color:var(--hitl-teal);border:1.5px solid var(--hitl-teal);
  border-radius:10px;padding:5px 12px;font-size:13px;font-weight:600;cursor:pointer;
  transition:background var(--hitl-ease),color var(--hitl-ease);
}
.hitl-btn-all:hover{background:#e3f5f3;transform:none}

.hitl-table{width:100%}
.hitl-cols,.hitl-row{
  display:grid;width:100%;align-items:start;
  grid-template-columns:minmax(0,2.4fr) minmax(128px,.95fr) minmax(118px,.85fr) minmax(108px,.7fr) minmax(0,1.35fr) 112px;
}
.hitl-cols span,.hitl-cell{
  min-width:0;padding:8px;border-bottom:1px solid var(--hitl-line);
}
.hitl-cols span{
  background:#f4f7f9;color:#4a5b69;font-weight:600;font-size:13px;
}
.hitl-row:hover .hitl-cell{background:#fafcfd;transition:background var(--hitl-ease)}
.hitl-cell{min-width:0}
.hitl-row textarea[name="texto"]{
  width:100%;min-height:4.4em;resize:vertical;font:inherit;margin:0;
  border:1px solid #cfd6de;border-radius:8px;padding:.4rem .5rem;
  transition:border-color var(--hitl-ease),box-shadow var(--hitl-ease);
}
.hitl-row textarea[name="texto"]:focus,
.hitl-row select:focus,
.hitl-row input[type="text"]:focus{
  outline:none;border-color:var(--hitl-teal);box-shadow:0 0 0 3px #16A39A22;
}
.hitl-row select,.hitl-row input[type="text"]{width:100%;margin:0}
.hitl-origen{margin-top:.25rem;color:var(--hitl-muted);font-size:12.5px}
.hitl-reg{
  width:100%;max-width:140px;background:#fff;color:#1d2b36;cursor:default;
}
.hitl-cite{
  margin:0;border-left:3px solid var(--hitl-teal);background:#f3faf9;
  border-radius:6px;padding:4px 10px;font-size:13px;
}
.hitl-cite summary{
  cursor:pointer;color:var(--hitl-navy);font-weight:600;list-style:none;
}
.hitl-cite summary::-webkit-details-marker{display:none}
.hitl-cite blockquote{
  margin:.35rem 0 .2rem;padding:0;border:0;background:transparent;
  color:#33414c;font-style:italic;font-size:12.5px;
}
.hitl-cite-meta{color:var(--hitl-muted);font-size:12px;font-weight:400;line-height:1.4}
.hitl-actions{display:flex;flex-direction:column;gap:4px;align-items:stretch}
.hitl-actions .st{align-self:flex-start;margin-bottom:2px}
.hitl-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:5px 10px;border-radius:8px;border:0;cursor:pointer;
  font:inherit;font-weight:600;font-size:13px;color:#fff;white-space:nowrap;
  transition:background var(--hitl-ease);
}
.hitl-btn:hover{transform:none}
.hitl-btn.approve{background:var(--hitl-teal)}
.hitl-btn.approve:hover{background:var(--hitl-teal-d)}
.hitl-btn.reject{background:var(--hitl-red)}
.hitl-btn.reject:hover{background:var(--hitl-red-d)}
.hitl-btn.reopen{background:#fff;color:#3c4d5c;border:1px solid #cfd6de}
.hitl-btn.reopen:hover{background:#f4f7f9}
.hitl-more{margin-top:.35rem;font-size:12px;color:var(--hitl-muted)}
.hitl-more summary{cursor:pointer;color:var(--hitl-teal-d);font-weight:600}
.hitl-more label{margin-top:.3rem}
.hitl-empty{color:var(--hitl-muted);padding:.6rem .15rem}
.hitl-done{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin-top:1rem;padding:.8rem 0 0;border-top:1px solid #E2E8EC}
.hitl-done p{flex:1;min-width:180px;margin:0;color:var(--hitl-muted)}

.hitl-count{animation:hitl-count 280ms ease both}
@keyframes hitl-count{from{opacity:.35;transform:translateY(4px)}to{opacity:1;transform:none}}

/* ---- Ejecución en vivo ---- */
.hitl-live{margin-top:.15rem}
.hitl-live-head{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;
}
.hitl-live-head h1{margin:.2rem 0 .35rem;color:var(--hitl-navy);font-size:1.35rem}
.hitl-mode{
  background:#fff;border:1px solid var(--hitl-line);border-radius:999px;
  padding:.28rem .75rem;font-size:12.5px;color:var(--hitl-muted);font-weight:600;
}
.hitl-live .live-bar{
  display:flex;align-items:center;gap:.7rem;flex-wrap:wrap;
  padding:.75rem 1rem;border-radius:var(--hitl-radius);
  background:var(--hitl-navy);color:#fff;
  box-shadow:0 6px 20px rgba(11,57,84,.22);margin:.45rem 0 .8rem;
}
.hitl-live .live-dot{
  width:11px;height:11px;border-radius:50%;background:#4ADE80;flex:none;
  box-shadow:0 0 0 3px rgba(74,222,128,.25);animation:hitl-pulse 1s infinite;
}
.hitl-live .live-dot.err{background:#F87171;box-shadow:0 0 0 3px rgba(248,113,113,.25);animation:none}
.hitl-live .steps{display:flex;gap:.35rem;flex-wrap:wrap}
.hitl-live .step{
  padding:.2rem .6rem;border-radius:999px;background:#ffffff18;font-size:.75rem;
  opacity:.55;border:1px solid #ffffff22;
  transition:background var(--hitl-ease),opacity var(--hitl-ease);
}
.hitl-live .step.done{opacity:.95;background:#16A39A;border-color:#16A39A}
.hitl-live .step.cur{opacity:1;background:#105a6e;border-color:#16A39A;animation:hitl-pulse 1.2s infinite}
.hitl-live .live-time{margin-left:auto;font-variant-numeric:tabular-nums;opacity:.9;font-weight:600}
.hitl-live .live-grid{display:grid;grid-template-columns:40% 1fr;gap:.85rem}
.hitl-live .panel{
  background:#fff;border:1px solid var(--hitl-line);border-radius:var(--hitl-radius);
  overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--hitl-shadow);
}
.hitl-live .panel.console{background:var(--hitl-navy);border-color:#082c42;color:#DCE8F2}
.hitl-live .panel h3{
  margin:0;padding:.6rem .95rem;font-size:.78rem;letter-spacing:.04em;
  border-bottom:1px solid var(--hitl-line);color:#3D5566;background:#F2F4F7;
}
.hitl-live .panel.console h3{background:#082f45;color:#9DB9D4;border-bottom-color:#0f3d58}
.hitl-live .pbody{overflow-y:auto;max-height:60vh;padding:.55rem .8rem;font-size:.8rem}
.hitl-live #conLog{
  font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.73rem;line-height:1.55;
  background:transparent;color:#DCE8F2;max-height:60vh;overflow-y:auto;padding:.65rem .85rem;
}
.hitl-live #conLog .ct{color:#7FA3C0;font-variant-numeric:tabular-nums}
.hitl-live #conLog .cp{font-weight:700}
.hitl-live #conLog .build_graph .cp{color:#7BE3A0}
.hitl-live #conLog .plan .cp{color:#9DB9FF}
.hitl-live #conLog .dispatch .cp{color:#7BE3D9}
.hitl-live #conLog .merge .cp{color:#FFD59E}
.hitl-live .fin-banner{
  margin-top:.9rem;padding:1rem 1.15rem;border-radius:var(--hitl-radius);
  background:#E3F4E4;border:1px solid #7BC67E;
  animation:hitl-fade 220ms ease;
}
.hitl-live .fin-banner.err{background:#FEECEC;border-color:var(--hitl-red)}
.hitl-live .fin-kpis{display:flex;gap:.55rem;flex-wrap:wrap;margin:.6rem 0}
.hitl-live .fin-kpi{
  background:#fff;border:1px solid #CBE3CC;border-radius:10px;padding:.5rem .9rem;text-align:center;
  transition:background var(--hitl-ease);
}
.hitl-live .fin-kpi:hover{background:#f7fbf7}
.hitl-live .fin-kpi b{display:block;font-size:1.25rem;color:var(--hitl-navy)}

@keyframes hitl-pulse{50%{opacity:.35}}
@keyframes hitl-fade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

@media (max-width:900px){
  .hitl-live .live-grid{grid-template-columns:1fr}
  .hitl-lote{margin-left:0}
  .hitl-cols{display:none}
  .hitl-row{
    display:block;border:1px solid var(--hitl-line);border-radius:10px;
    margin-bottom:.55rem;padding:.15rem;
  }
  .hitl-cell{display:block;border-bottom:0}
  .hitl-actions{flex-direction:row;flex-wrap:wrap}
  .hitl-btn{width:auto}
}
@media (prefers-reduced-motion:reduce){
  .hitl-count,.hitl-live .live-dot,.hitl-live .step.cur,.hitl-live .fin-banner{animation:none}
}
