
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given that the function $f(x)$ is a quadratic function, and the solution set of the inequality $f(x) < 0$ is $(-2, 1)$, and $f(0) = -2$.
(1) Find the expression of $f(x)$;
(2) If the inequality $$f(\cos\theta) \leq \sqrt{2}\sin\left(\theta + \frac{\pi}{4}\right) + m\sin\theta$$ always holds for $\theta \in \mathbb{R}$, find the range of the real number $m$.

Present the answer in LaTex format: \boxed{Your answer}
user