{% if flags.has_stats %}
	{% for stat_type in vars.stats %}
		{% if stat_type.has_non_zero_stat %}

			<div class="category-header">
				<h6>{{ stat_type.title }}</h6>
			</div>

			<div class="row g-3">
				{% for stat in stat_type.stats %}
					{% if not stat.is_zero_stat %}
						{% if stat_type.neutral %}
							{% set tint_class = 'bg-tint-info' %}
							{% set accent_class = 'status-info' %}
							{% set trend_class = 'trend-neutral' %}
						{% elseif stat.diff_colour == 'success' %}
							{% set tint_class = 'bg-tint-good' %}
							{% set accent_class = 'status-good' %}
							{% set trend_class = 'trend-good' %}
						{% elseif stat.diff_colour == 'warning' %}
							{% set tint_class = 'bg-tint-warning' %}
							{% set accent_class = 'status-warning' %}
							{% set trend_class = 'trend-warning' %}
						{% else %}
							{% set tint_class = 'bg-tint-info' %}
							{% set accent_class = 'status-info' %}
							{% set trend_class = 'trend-neutral' %}
						{% endif %}
						<div class="col-lg-3 col-md-4 col-6">
							<div class="stat-card {{ tint_class }}">
								<div class="stat-card-accent {{ accent_class }}"></div>
								<div class="stat-card-body">
									<div class="overline">{{ stat.name }}</div>
									<div class="stat-value">{{ stat.count_current_period }}</div>
									<div class="stat-prev-label">{{ strings.this_period }}</div>
								</div>
								<div class="stat-card-footer">
									<span>{{ strings.previous_period }}: {{ stat.count_previous_period }}</span>
									<span class="stat-trend {{ trend_class }}">
										{{ stat.diff_symbol_svg|raw }}
										{{ stat.diff_symbol_plus_minus }}{{ stat.count_diff_abs }}{% if stat.diff_percentage is defined and stat.diff_percentage != 0 %} ({{ stat.diff_percentage }}%){% endif %}
									</span>
								</div>
							</div>
						</div>
					{% endif %}
				{% endfor %}
			</div>

		{% endif %}
	{% endfor %}
{% else %}
	<p class="report-empty">There were no stats generated for the given reporting criteria.</p>
{% endif %}
