Where is careless attention (ayonisomanasikāro) in Dependent Origination? AN 10.61 says:

Thus not associating with good persons, becoming full, fills up not
hearing the good Dhamma. Not hearing the good Dhamma, becoming full,
fills up lack of faith. Lack of faith, becoming full, fills up
careless attention (ayonisomanasikāro). Careless attention, becoming full, fills up lack
of mindfulness and clear comprehension. Lack of mindfulness and clear
comprehension, becoming full, fills up non-restraint of the sense
faculties. Non-restraint of the sense faculties, becoming full, fills
up the three kinds of misconduct.
AN 10.61

Since careless or improper attention (ayonisomanasikāro) results in non-restraint of the sense faculties, it appears this ayonisomanasikāro arises before sense contact in Dependent Origination. Is this true?
If the above is true, where do we think careless or improper attention (ayonisomanasikāro) should be placed within the standard teaching of the twelve conditions of Dependent Origination?
MN 148 (my emphasis added) ...


  Mind consciousness arises dependent on the mind and thoughts. The meeting of the three is contact. Contact is a condition for what is felt as pleasant, painful, or neutral. When you experience a pleasant feeling, if you don’t approve, welcome, and keep clinging to it, the underlying tendency to greed does not underlie that. When you experience a painful feeling, if you don’t sorrow or wail or lament, beating your breast and falling into confusion, the underlying tendency to repulsion does not underlie that. When you experience a neutral feeling, if you truly understand that feeling’s origin, ending, gratification, drawback, and escape, the underlying tendency to ignorance does not underlie that. Mendicants, after giving up the underlying tendency to greed for pleasant feeling, after dispelling the underlying tendency to repulsion towards painful feeling, after eradicating ignorance in the case of neutral feeling, after giving up ignorance and giving rise to knowledge, it’s totally possible to make an end of suffering in the present life.


... so maybe unwise attention happens at the "feeling" stage (and the converse is "guarding the senses").

You could probably say it's associated with other nidanas too, e.g. ignorance (which is arguably the "root"); and/or namarupa (per the definition you referenced here, i.e. that nama includes "Feeling, perception, intention, contact and attention").

Also MN 2 says that the "thicket of views" associated with self-views arises when attending inappropriately -- and MN 148 (quoted above) also says it's possible (but wrong) to identify with eye, eye-object, eye-consciousness, contact, feeling, craving, etc. -- so maybe that would be some inappropriate attention associated with all of these nidanas.

But because AN 10.6 says it results in "restraint of the sense faculties" I think that's talking about "guarding the senses" and therefore e.g. not delighting in feeling.

Maybe not "before" sense contact though -- before and after. I think the DO relationship is more complicated than strictly chronological e.g. "once around the clock, clockwise".