{# Bill Brief card (ADR 0020). A self-contained, glanceable view of a bill: the LLM executive summary on top, then the deterministic fact pack (always shown, even before a summary is generated). HTMX-swappable: the generate form POSTs here and replaces this whole
. Context: facts (BriefFacts|None), brief (BriefView|None), brief_error (str|None), bill ({congress, bill_type, bill_number}). #}

Brief

{# -- Executive summary (the only AI-generated part) ------------------ #}
Executive summary AI-generated
{% if brief_error %}

{{ brief_error }}

{% endif %} {% if brief %} {% if brief.stale %}

The underlying data changed since this summary was generated — regenerate for an up-to-date version.

{% endif %} {% if brief.lens %}

Tailored for: “{{ brief.lens }}”

{% endif %}
{{ brief.executive_summary }}

Generated {{ brief.generated_at|humanize_age }} · model {{ brief.model }} · AI-generated; the facts below are from the record.

{% elif not brief_error %}

No executive summary yet — generate one to distill the facts below into a few sentences.

{% endif %}
{# -- Deterministic fact pack (always shown) -------------------------- #} {% if facts %}
Sponsor
{{ facts.sponsor_display_name or "—" }}
Policy area
{{ facts.policy_area or "—" }}
Introduced
{{ facts.introduced_date or "—" }}
Chamber
{{ facts.origin_chamber }}
Status
{% if facts.latest_action_date %}{{ facts.latest_action_date }} — {% endif %} {{ facts.latest_action_text or "—" }}
Coalition
{{ facts.cosponsor_count }} cosponsor{{ "" if facts.cosponsor_count == 1 else "s" }} ({{ facts.original_cosponsor_count }} original{% if facts.withdrawn_cosponsor_count %}, {{ facts.withdrawn_cosponsor_count }} withdrawn{% endif %}) {% for party, n in facts.cosponsor_party_counts|dictsort %} {{ party }} {{ n }} {% endfor %}
{{ facts.action_count }} action{{ "" if facts.action_count == 1 else "s" }} on file {{ facts.vote_count }} recorded vote{{ "" if facts.vote_count == 1 else "s" }}
{% if facts.subjects %}
Subjects
{% for s in facts.subjects %} {{ s }} {% endfor %}
{% endif %} {% if facts.latest_summary_text %}
Latest CRS summary — {{ facts.latest_summary_stage or "—" }}{% if facts.latest_summary_date %} · {{ facts.latest_summary_date }}{% endif %}

{{ facts.latest_summary_text }}

{% else %}
No CRS summary available for this bill.
{% endif %}
{% endif %} {# -- Generate / tailor form ------------------------------------------ #}
Generating…
{# Indicator CSS lives inside the swapped section so an outerHTML regenerate replaces it rather than accumulating copies. #}