{% macro event_row(e, now) %}
{% set p = pl(e) %}
{% set meta = kind_meta.get(e.kind) or act_meta.get(e.kind) or ('•', e.kind) %}
{{ meta[0] }}
{{ meta[1] }}{{ e.module }}
{% if e.actor != 'user' %}{{ e.actor }}{% endif %}
{#- the retroactive log wears its lateness: this row's ts is when it happened, the
badge says it was told to us later (hover for exactly when). -#}
{% if p.backdated %}↶ logged later{% endif %}
{% if e.delta_seconds %}{{ e.delta_seconds|sdur }}{% endif %}
{% if e.xp %}+{{ e.xp }} xp{% endif %}
{#- a hidden lock printed its own sentence here and then announced that the timer was hidden -#}
{%- if e.kind == 'lock' %}{% if p.hidden %}base hidden · hidden timer{% else %}base {{ p.base_seconds|dur }}{% endif %}{% if p.note %} · {{ p.note }}{% endif %}
{%- elif e.kind == 'unlock' %}{{ 'early — emergency key' if p.early else 'clean run' }} · locked {{ p.elapsed|dur }}
{%- elif e.kind == 'spin' %}{{ p.label }}{% if p.task_title %} → {{ p.task_title }}{% endif %}
{%- elif e.kind in ('task_assigned', 'task_verified', 'task_failed') %}{{ p.title }}{% if p.reason %} · {{ p.reason }}{% endif %}{% if p.note %} · “{{ p.note }}”{% endif %}
{%- elif e.kind == 'freeze' %}{% if p.until %}until {{ p.until|local }}{% else %}indefinite{% endif %}{% if p.reason %} · {{ p.reason }}{% endif %}
{%- elif e.kind == 'note' %}{{ p.text }}
{%- elif e.kind == 'photo' %}{{ p.caption or 'check-in' }}
{%- elif e.kind in ('reflection', 'checkin') %}{% if p.prompt %}{{ p.prompt }} · {% endif %}{{ p.excerpt }}{% if p.chars and p.chars > 140 %}…{% endif %}
{%- elif e.kind in ('mantra', 'affirmation') %}{{ p.prompt }}
{%- elif e.kind == 'meditation' %}{{ p.duration_seconds|dur }}{% if p.prompt %} · {{ p.prompt[:60] }}{% endif %}
{%- elif e.kind == 'reflection_missed' %}no reflection on {{ p.day }}{% if not p.applied %} · not locked, no penalty{% endif %}
{%- elif e.kind == 'undo' %}{{ p.target_kind }} #{{ p.target_event_id }}{% if p.reverted_delta %} · {{ p.reverted_delta|sdur }} back{% endif %}{% if p.reason %} · {{ p.reason }}{% endif %}
{%- elif p.reason %}{{ p.reason }}{% endif %}
{# old task_verified payloads carry no media_kind, so Undefined falls to the else branch and renders exactly as before #}
{% if p.media_id %}{% if p.media_kind == 'voice' %}
{% else %}{% endif %}{% endif %}