7. Given $\theta \in\left(\frac{\pi}{4}, \frac{\pi}{2}\right)$, the quadratic equation
$$
\left(\tan ^{2} \theta+\sec ^{2} \theta\right) x^{2}+2\left(\tan ^{2} \theta-\sin ^{2} \theta\right) x-\cos 2 \theta=0
$$

has a repeated root. Then the value of $\cos \theta$ is . $\qquad$
7. $\sqrt{\frac{3-\sqrt{5}}{2}}$.

Since the equation has a repeated root, $\Delta=0$, i.e., $\left(\tan ^{2} \theta-\sin ^{2} \theta\right)^{2}+\cos 2 \theta\left(\tan ^{2} \theta+\sec ^{2} \theta\right)=0$. Let $d=\cos ^{2} \theta$. Then $\left(\frac{1-d}{d}+d-1\right)^{2}+(2 d-1)\left(\frac{1-d}{d}+\frac{1}{d}\right)=0$. Therefore, $\left(d^{2}-3 d+1\right)^{2}=0$.
Solving for $d$, we get $d=\frac{3 \pm \sqrt{5}}{2}$.
Since $\theta \in\left(\frac{\pi}{4}, \frac{\pi}{2}\right)$, we have $d<\frac{1}{2}$.
Thus, $d=\frac{3-\sqrt{5}}{2}$.
Therefore, $\cos \theta=\sqrt{\frac{3-\sqrt{5}}{2}}$.