.n8n-badge-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 8px;
  vertical-align: top;
}

.n8n-badge {
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  color: #fff;
}

.n8n-badge--active { background: #1f6b52; }
.n8n-badge--inactive { background: #6b7280; }
.n8n-badge--failed { background: #b42318; }
.n8n-badge--warning { background: #b7791f; }
.n8n-badge--pending { background: #0b5cad; }
.n8n-badge--unknown { background: #9ca3af; }

.n8n-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(320px, 78vw);
  z-index: 70;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(18, 32, 39, 0.16);
  padding: 10px;
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
}

.n8n-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.n8n-pill--active { background: rgba(31,107,82,.14); color: #1f6b52; }
.n8n-pill--inactive { background: rgba(107,114,128,.14); color: #4b5563; }
.n8n-pill--failed { background: rgba(180,35,24,.14); color: #9f1d35; }
.n8n-pill--warning { background: rgba(183,121,31,.15); color: #8a5a00; }
.n8n-pill--pending { background: rgba(11,92,173,.14); color: #0b5cad; }
.n8n-pill--unknown { background: rgba(156,163,175,.2); color: #4b5563; }

.module-automation-bar {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0;
  width: fit-content;
  margin: 8px 0 12px auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.module-automation-wrap {
  margin-left: 0;
}

.module-automation-popover {
  width: min(380px, 88vw);
  display: none;
}

@media (max-width: 1024px) {
  .module-automation-bar { margin-top: 6px; }
}

.module-automation-wrap:hover .module-automation-popover {
  display: grid;
}

.module-automation-wrap:focus-within .module-automation-popover {
  display: none;
}

.module-automation-icon {
  width: 47px;
  height: 22px;
  padding: 3px 5px;
  border-width: 1px;
  border-style: solid;
}

.module-automation-icon svg {
  width: 35px;
  height: 14px;
  display: block;
}

.module-automation-icon svg circle,
.module-automation-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* blanco con fondo rojo: n8n en fallo */
.module-automation-icon--failed {
  background: #d93866;
  color: #ffffff;
  border-color: #d93866;
}

/* blanco con fondo negro: sin automatizacion */
.module-automation-icon--inactive,
.module-automation-icon--unknown {
  background: #101010;
  color: #ffffff;
  border-color: #101010;
}

/* negro con fondo blanco: warning / pending */
.module-automation-icon--warning,
.module-automation-icon--pending {
  background: #ffffff;
  color: #111111;
  border-color: #d7dbe2;
}

/* rojo con fondo blanco: ok active */
.module-automation-icon--active {
  background: #ffffff;
  color: #d93866;
  border-color: #d7dbe2;
}
