Is this line detector safe?
Note the amount of power that R3 needs to dissipate:

$$\frac{V_{RMS}^2}{R} = \frac{90^2 V}{2700 \Omega} = 3 W$$

33 mA is rather more than you need to operate the optocoupler. 5 mA would probably be enough, so raise R3 to 18 k&Omega; and it only needs to dissipate 450 mW. Use a 1W unit. Also, you can raise the value of R1 to about 4700 &Omega;

Even with a worst-case current transfer ratio of 0.2, this still gives you 1 mA(RMS) pull-down current at the output. Raise R2 to about 10 k&Omega; to give you a reliable low at the input to the inverter.



As an aside, most people would connect C1 between the signal and ground (rather than Vcc), but it really doesn't make that much difference.