The pretérito imperfeito (PI), estávamos, means the event started before the reference time and continued after the reference time. The pretérito perfeito (PP), estivemos, means the event coincides with or is contained within the reference time. I think this is also the case in Spanish, but you tell me.
In your examples the reference time is “ontem” or yesterday. To facilitate the explanation, let’s suppose yesterday was Tuesday. The first sentence, with estávamos, sounds a bit strange, because strictly it means the two of you were continuously in the kitchen for more than 24 hours, from some time before Tuesday until some time after Tuesday, for instance from 11 pm on Monday until 2 am on Wednesday. The second sentence, with estivemos, means that the whole of your talk in the kitchen took place Tuesday.
Let’s illustrate the use of estávamos with some more plausible examples:
(a) Onde é que eu e a minha avó estávamos ao meio dia? Estávamos na cozinha.
Here the reference time is meio dia, so estávamos implies you and your granny had been in the kitchen from some time before 12 noon and stayed there for some time after 12 noon. If you said instead “estivemos na cozinha ao meio dia” you would mean that you went there and came out again immediately, perhaps to pick up something. Another example:
(b) Ontem a minha avó e eu estávamos falando na cozinha, e de repente chegou o João.
Here the reference time is the moment when João arrives, and the estávamos implies that you were in the kitchen before that moment already, and were still there after that moment. With estivemos the sentence would sound strange, and if heard it I would ask for a clarification.
It should be clear by now that short-term and long-term business is neither here nor there. If the time frame is the same, estávamos implies a longer duration than estivemos, but both can be used for both long and short time spans. For instance:
(c) O Manuel esteve vinte anos na prisão.
(d) O João esteve aqui, mas não mais de dois minutos.
(e) A guerra colonial portuguesa foi de 1961 a 1974. Nesse altura o Manuel estava na prisão.
(f) Ouvi a campainha tocar mas não pôde ir à porta porque estava no banheiro. (Só estive lá um minuto, mas foi o suficiente para não conseguir chegar à porta antes de te ires embora.)
The event coincides with the reference time in (c) (twenty years) and is contained in the time reverence in (d) (two minutes), so you use the pretérito perfeito. In (e) and (f) the pretérito imperfeito implies the opposite, that the event started before the reference time (1961-74 in (e) and when the bell rang in (f)) and continued after it.
A couple of examples more. Let me know if you need explanation:
(g) Na quinta feira passada estávamos em Madrid. Estivemos lá a semana inteira, de domingo a sábado.
(h) No Natal passado estávamos em Angola. Estivemos lá dois anos a trabalhar.
(i) Disseram-me que estiveste em minha casa às sete da tarde. A essa hora eu ainda estava no trabalho.