    {% for user_type, user_report in report.results.items() %}
    <h3>Instances used by {{ user_type.upper() }}</h3>

    <table id="results_table">
        <tr>
            <th rowspan="2">User</th>
            {% for cloud_provider in report.cloud_providers %}
            <th colspan="3">{{ cloud_provider.upper() }}</th>
            {% endfor %}
        </tr>
        <tr>
            {% for _ in report.cloud_providers %}
                {% for state in ["On-demand: running", "Spot: running", "Stopped"] %}
            <th>{{ state }}</th>
                {% endfor %}
            {% endfor %}
            <th>Keep alive</th>
            <th>Projected daily cost</th>
        </tr>
        {% for user, stat in user_report|dictsort %}
        <tr>
            <td>{{ user }}</td>
            {% for cloud_provider in report.cloud_providers %}
            <td>{{ stat[cloud_provider].num_running_instances_on_demand }}</td>
            <td>{{ stat[cloud_provider].num_running_instances_spot }}</td>
            <td>{{ stat[cloud_provider].num_stopped_instances }}</td>
            {% endfor %}
            <td>{{ stat["num_instances_keep_alive"] }}</td>
            {% if stat["projected_daily_cost"] > 50 %}
                <td><span class="red fbold">{{ "%.1f"|format(stat["projected_daily_cost"]) }}</span></td>
            {% elif stat["projected_daily_cost"] == 0 %}
                <td>{{ stat["projected_daily_cost"] }}</td>
            {% else %}
                <td>{{  "%.1f"|format(stat["projected_daily_cost"]) }}</td>
            {% endif %}
        </tr>
        {% endfor %}
    </table>
    {% endfor %}

{% if report.crs %}
    <h3>Active Capacity Reservations (AWS)</h3>
    <table id="results_table">
        <tr>
            <th>User</th>
            <th>Region</th>
            <th>Instance Type</th>
            <th>Capacity total</th>
            <th>Capacity available</th>
            <th>Start Time</th>
            <th>id</th>
        </tr>
        {% for cr in report.crs %}
            <tr>
                <td>{{ cr.user }}</td>
                <td>{{ cr.region }}</td>
                <td>{{ cr.instance_type }}</td>
                <td>{{ cr.capacity_total }}</td>
                {% if cr.is_unused %}
                    <td><span class="red fbold">{{ cr.capacity_available }}</span></td>
                {% else %}
                    <td>{{ cr.capacity_available }}</td>
                {% endif %}
                <td>{{ cr.start_time }}</td>
                <td>{{ cr.id }}</td>
            </tr>
        {% endfor %}
    </table>
{% endif %}
