I am trying to make a T-flip-flop circuit with a relay, which would:
- toggle on a button press (12 V) [default state: off]
 - allow control from an external micro-controller (optocouplers)
 - allow switching between standalone button control and external control [if possible by signal rather than an SPDT switch]
 - allow the button to be read by the micro-controller
 - have very low-power consumption
 - bonus: after switching 
external->standalone, the status is remembered - bonus: simple, cheap, circuit with a n-MOSFET for driving the relay, embeddable many times on a PCB
 
However, I am having trouble with designing a real-life working circuit.
The first version I worked with didn't have the button connected to 12 V on one side, as it switched the two sides of the flip-flop.
My modified second version does work in theory in the simulator, however, it does not work in reality, which, I suppose is the result of non-ideal and complex workings of transistors.
I am also considering usage of IC flip-flops, however, I also had trouble designing something which would fulfill all the points.
For referring to the components:
Note: this is a WIP drawing, the button and the relay will not be located on the PCB, etc...

