/* Pipeline de agentes · modal centrado, canvas oscuro, corrida real. */

.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: 24px 16px;
  background: rgba(8, 28, 40, .72);
  backdrop-filter: blur(5px);
}
.kpipe-ov {
  position: relative;
  width: min(1040px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
  background: #071f2e;
  color: #e7f4f2;
  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: 0 2px 8px;
  flex: none;
}

.kpipe-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}

.kpipe-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: #9db8c6;
}

.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-steps {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 0 10px;
  overflow-x: auto;
  flex: none;
}
.kpipe-st {
  flex: 1 1 0;
  min-width: 96px;
  background: #0e4a68;
  border-radius: 10px;
  padding: 7px 8px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e7f4f2;
  opacity: .4;
  border: 1px solid transparent;
  white-space: nowrap;
}
.kpipe-st b {
  display: block;
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #8ee0d8;
  margin-bottom: 2px;
  font-weight: 700;
}
.kpipe-st.is-on {
  opacity: 1;
  border-color: #16A39A;
  background: #105a6e;
  box-shadow: inset 0 0 0 1px #16A39A;
}
.kpipe-st.is-done {
  opacity: 1;
  border-color: #7BC67E;
  background: #0e4a68;
}

.kpipe-err {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #3a1520;
  color: #fecaca;
  font-size: 13px;
  flex: none;
}
.kpipe-err[hidden] { display: none !important; }

.kpipe-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpipe-stage {
  position: relative;
  flex: 1;
  min-height: 260px;
  background: #071f2e;
  border-radius: 12px;
  overflow: hidden;
}
.kpipe-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.kpipe-log {
  flex: none;
  height: 112px;
  background: #082c40;
  border-radius: 10px;
  padding: 8px 10px;
  overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.35;
  color: #9db0bc;
}
.kpipe-log div { margin: 3px 0; }
.kpipe-log .who {
  color: #7dd3cc;
  font-weight: 700;
  letter-spacing: .04em;
}

.kpipe-foot {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.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.is-paused {
  background: #E8590C;
  border-color: #E8590C;
  color: #fff;
}

.kpipe-foot-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}
.kpipe-stat {
  font-size: 12.5px;
  color: #9db8c6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpipe-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #8ee0d8;
  background: #0e4a68;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  min-width: 72px;
  text-align: center;
  flex: none;
}

.kpipe-validar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16A39A;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  flex: none;
}
.kpipe-validar[hidden] { display: none !important; }

.kpipe-hitl {
  height: 100%;
  overflow: auto;
  background: #f3f6f8;
  border-radius: 12px;
  color: #0B3954;
}
.kpipe-hitl .hitl-card { box-shadow: none; }

body.kpipe-lock { overflow: hidden; }

@media (max-width: 720px) {
  .kpipe-ov { padding: 10px; }
  .kpipe-title { font-size: 17px; }
  .kpipe-st { min-width: 88px; font-size: 11.5px; }
  .kpipe-log { height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .kpipe-stage canvas { scroll-behavior: auto; }
}
