Stealth has always been kind of problematic - it's either near useless against a given enemy (because you get spotted immediately) or completely overpowered (because you can't get spotted at all, allowing the sneaking target to attack without retaliation).
I'd propose that stealth should work as follows:
While sneaking, every turn there is a chance to be spotted by nearby enemies, based on AMBUSHER vs OBSERVER skill plus the unit's visual profile, status conditions, whether they are moving, and a random skill roll. Units that have been spotted, if still within viewing range of a target, have a much harder time re-stealthing without moving out of view range, but HIDE interactions bypass this. (This is probably how it works already)
Attacking from stealth gives a major penalty to remaining stealthed from the attacked target. Units with extreme stealth level relative to their target can remain in stealth while attacking, BUT...
It is also possible at any time to lash out with an melee attack at nothing. AI will use this at random if they are being attacked by an enemy they cannot see. If there is a unit on the targeted tile, the attack may connect with a random body part (adjusted by difficulty in hitting that part) of a random unit. Of course the chances of connecting would be much lower than usual, but it would be mostly unaffected by relative AMBUSHER vs OBSERVER skill, making it possible, if unlikely, for a unit to land a lucky hit even on a master sneaker. Landing a hit would give a major penalty to the target trying to remain in stealth.
This could also be used by blind units to make blindness a little less game ending.
Another (less important) stealth-related possibility: talking to a unit grants a stealth penalty to that unit for all units that can hear the speaking unit. This means that if you are spotted by an enemy and that enemy shouts something like "Identify yourself!" all other enemies have a much higher chance of spotting you. It also means that allies would have to be programmed not to tell you about random megabeasts when you are trying to sneak.