/* Pipeline multi-agente overlay · RCA Aucha (sala /agentes) */

.pipe-demo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin: .55rem 0 1rem;
}
.pipe-demo-bar button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.kpipe-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  background: rgba(6, 23, 34, .38);
}
.kpipe-ov {
  position: relative;
  width: min(1080px, calc(100vw - 56px));
  height: min(760px, calc(100vh - 64px));
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
  background: #061722;
  color: #e4eef3;
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  box-sizing: border-box;
  border-radius: 16px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.kpipe-ov *,
.kpipe-ov *::before,
.kpipe-ov *::after { box-sizing: border-box; }

.kpipe-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 8px;
  flex: none;
}

.kpipe-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}

.kpipe-title .bolt { color: #F2B53A; margin-right: 6px; }

.kpipe-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: #8aa3b3;
}

.kpipe-go {
  background: #16A39A;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.kpipe-go:disabled { opacity: .65; cursor: default; }
.kpipe-x {
  background: transparent;
  color: #cfe8e6;
  border: 1px solid #3d6a80;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.kpipe-x:hover { background: #0e4a68; }

.kpipe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 2px 10px;
  flex: none;
}

.kpipe-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.kpipe-st {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: #0c3348;
  border: 1px solid #1a4a63;
  color: #9db8c6;
  font-size: 12.5px;
  font-weight: 600;
  opacity: .55;
}
.kpipe-st b {
  display: inline-flex;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: #16384c;
  color: #cfe8e6;
}
.kpipe-st.is-on {
  opacity: 1;
  background: #16A39A;
  border-color: #16A39A;
  color: #fff;
}
.kpipe-st.is-on b { background: #0e7d76; color: #fff; }
.kpipe-st.is-done {
  opacity: 1;
  background: #0c3348;
  border-color: #2f6a4a;
  color: #d5eee0;
}
.kpipe-st.is-done b { background: #3E9B45; color: #fff; }

.kpipe-ctrl {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.kpipe-ctrl button {
  background: transparent;
  color: #cfe8e6;
  border: 1px solid #3d6a80;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.kpipe-ctrl button:hover { background: #0e4a68; }
.kpipe-ctrl button.is-act {
  background: #16A39A;
  color: #fff;
  border-color: #16A39A;
}
.kpipe-ctrl button.kpipe-pause.is-paused,
.kpipe-ctrl #kpipe-pause.is-paused {
  background: #E8590C;
  border-color: #E8590C;
  color: #fff;
}

.kpipe-hitl {
  height: 100%;
  overflow: auto;
  background: #f3f6f8;
  border-radius: 12px;
  color: #0B3954;
}
.kpipe-hitl .hitl-card { box-shadow: none; }
.kpipe-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 10px;
}

.kpipe-stage {
  background: linear-gradient(180deg, #f4f8fb 0%, #e7f1f4 100%);
  border-radius: 16px;
  padding: 14px 14px 10px;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 158px minmax(260px, 1fr);
  grid-template-rows: 1fr auto;
  gap: 10px 14px;
  color: #0B3954;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.kpipe-cubes {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 268px;
  align-self: start;
  margin-top: 4px;
  border-radius: 12px;
}
.kpipe-cube {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(11, 57, 84, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: #062430;
  will-change: transform, opacity;
}
.kpipe-cube.is-drop { filter: grayscale(.85); }

.kpipe-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  min-width: 0;
}
.kpipe-hub-cap {
  font-size: 11px;
  font-weight: 700;
  color: #3D5566;
  margin-bottom: 8px;
  text-align: center;
  min-height: 16px;
}
.kpipe-glm {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #2dd4c8 0%, #16A39A 46%, #0e7d76 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(22, 163, 154, .16), 0 10px 24px rgba(11, 57, 84, .18);
  flex: none;
}
.kpipe-glm strong { font-size: 22px; letter-spacing: .04em; line-height: 1; }
.kpipe-glm span { font-size: 10px; opacity: .92; margin-top: 3px; text-align: center; line-height: 1.2; }
.kpipe-glm.is-live { animation: kpipePulse 1.4s ease-in-out infinite; }

.kpipe-cand-lab {
  margin-top: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #7a8b98;
}
.kpipe-cands {
  position: relative;
  width: 132px;
  height: 92px;
  margin-top: 6px;
}
.kpipe-mini {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}

.kpipe-lanes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow: auto;
  justify-content: flex-start;
}
.kpipe-lane {
  background: #fff;
  border-radius: 12px;
  padding: 7px 10px 6px;
  border: 1px solid #d7e3ea;
  box-shadow: 0 1px 2px rgba(11, 57, 84, .06);
  flex: 1 1 auto;
}
.kpipe-lane.is-run {
  border-color: #16A39A;
  box-shadow: 0 0 0 1px #16A39A inset;
}
.kpipe-lane.is-done { border-color: #7BC67E; }
.kpipe-lane-h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0B3954;
}
.kpipe-lane-h small { font-weight: 600; color: #6b7c89; }
.kpipe-dots { display: flex; gap: 4px; margin: 5px 0 3px; min-height: 8px; }
.kpipe-dot { width: 8px; height: 8px; border-radius: 50%; }
.kpipe-lane-cur {
  font-size: 11.5px;
  color: #4a5d6b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}
.kpipe-bar {
  height: 4px;
  background: #e4ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.kpipe-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: #7BC67E;
  border-radius: 4px;
}

.kpipe-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 11px;
  color: #3D5566;
  padding-top: 4px;
  border-top: 1px solid #d5e2e8;
}
.kpipe-legend b { font-weight: 800; margin-right: 4px; }
.kpipe-lg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kpipe-lg i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.kpipe-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.kpipe-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  flex: none;
}
.kpipe-kpi {
  background: #0c3348;
  border-radius: 12px;
  padding: 9px 11px 8px;
  min-height: 64px;
}
.kpipe-kpi b {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.kpipe-kpi span {
  display: block;
  font-size: 11.5px;
  color: #8aa3b3;
  margin-top: 2px;
}
.kpipe-kpi.is-rel b { color: #5ee0d6; }
.kpipe-kpi.is-cand b { color: #7dd3cc; }
.kpipe-kpi.is-dup b { color: #F87171; }
.kpipe-kpi.is-req b { color: #7BC67E; }

.kpipe-log {
  flex: 1;
  min-height: 120px;
  background: #071f2e;
  border-radius: 12px;
  padding: 8px 10px;
  overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #9db0bc;
}
.kpipe-log div { margin: 2px 0; }
.kpipe-log .t { color: #7FA3C0; }
.kpipe-log .who { color: #7dd3cc; font-weight: 700; }

.kpipe-validar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16A39A;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  flex: none;
}
.kpipe-validar[hidden] { display: none !important; }

.kpipe-err {
  margin: 0 2px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #3a1520;
  color: #fecaca;
  font-size: 13px;
  flex: none;
}
.kpipe-err[hidden] { display: none !important; }

@keyframes kpipePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 8px rgba(22, 163, 154, .16), 0 10px 24px rgba(11, 57, 84, .18); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(22, 163, 154, .22), 0 10px 24px rgba(11, 57, 84, .18); }
}

body.kpipe-lock { overflow: hidden; }

@media (max-width: 980px) {
  .kpipe-body { grid-template-columns: 1fr; }
  .kpipe-stage { grid-template-columns: 1fr 140px; }
  .kpipe-lanes { grid-column: 1 / -1; max-height: 220px; }
  .kpipe-side { max-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
  .kpipe-glm.is-live { animation: none; }
  .kpipe-cube, .kpipe-mini, .kpipe-bar > i, .kpipe-kpi b {
    transition: none !important;
  }
}
