I presume that you did not eat any berries.
In my view the symptoms you present may very well be all connected and it is highly likely that you have an infection that needs treating. In the meantime, should you bring up any more phlegm, put it into a container so that the doctor can send it to be analysed.
Make an urgent appointment to see your doctor.
Uhmmm....GROSS. Anyway, coughing up brown mucus can actually be caused by old blood or dried blood, which can change in color due to a hemoglobin loss. The brown phlegm takes on this characteristic color due to these changes in hue once blood has dried out or gotten old. Most of the time, when blood is present in the mucus, it will present itself as such or as brown phlegm. However sometimes, the presence of blood in mucus can result in a black appearance as well. You should see your doctor, especially if you're having fever and weight loss.