If a caster typically uses a spellcasting focus to cast spells and loses it, and they are in a dungeon or other location where they cannot purchase a new one (or even purchase special materials for a new one), can they craft a makeshift focus, and if so how?
The relevant rules (PHB p. 151):
Arcane Focus. An arcane focus is a special item -- an orb, a crystal, a rod, a specially constructed staff, a wand-like length of wood, or some similar item -- designed to channel the power of arcane spells. A sorcerer, warlock, or wizard can use such an item as a spellcasting focus as described in chapter 10.
Druidic Focus. A druidic focus might be a sprig of mistletoe or holly, a wand or scepter made of yew or another special wood, a staff drawn whole out of a living tree, or a totem object incorporating feathers, fur, bones and teeth from sacred animals. A druid can use such an item as a spellcasting focus as described in chapter 10.
Holy Symbol A holy symbol is a representation of a god or pantheon. It might be an amulet depicting a symbol representing a deity, the same symbol carefully engraved or inlaid as an emblem on a shield, or a tiny box holding a fragment of a sacred relic. [...] A cleric or paladin can use a holy symbol as a spellcasting focus as described in chapter 10. To use the symbol in this way, the caster must hold it in hand, wear it visibly, or bear it on a shield.
Regarding use (PHB p. 203)
A character can use a component pouch or spellcasting focus (found in chapter 5, "Equipment") in place of the components specified for a spell. But if a cost is indicated for a component, a character must have the specific component before he or she can cast the spell.
A couple of drudic foci (sprig of mistletoe or totem) are available for 1gp. Arcane foci and holy symbols start at 5gp. This suggests a certain level of craftsmanship and/or quality materials. Thus is seems that a wizard can't just pick up any old wooden branch, peel off the bark, and declare that wand-like length of wood to be his new arcane focus.
It's less clear whether a druid can just pick up some other natural item, say a flower or mushroom, and use it in place of a sprig of mistletoe. Given that a sprig of mistletoe is being sold for 1gp, that suggests that it must either be somewhat rare, or perhaps specially preserved? (Lore from older versions suggest that it must be harvested only on Midsummer night, which would account for the rarity.)
I can't find specific rules for crafting non-magical items, other than that a Dexterity check might be used to "craft a small or detailed object" and that proficiency with a relevant set of artisan's tools would allow one to add one's proficiency bonus to the check. Is there any precedent in the rules that would suggest how long such an endeavor would take, and how difficult (DC) it would be?
I have posted a companion question here that deals with the question of using an improvised focus.