{% set pricing = cart.getPricing %}
{% set billing_address = cart.invoiceAddress ?: cart.deliveryAddress %}
{% set delivery_address = cart.deliveryAddress %}
{% set shipping = cart.cartShipping %}
{% set reference_date = cart.cartCheckout and cart.cartCheckout.payedAt ? cart.cartCheckout.payedAt : cart.createdAt %}
{% set locale = cart.locale ?: 'fr' %}
{% set billing_postal = billing_address and billing_address.postal is defined and billing_address.postal ? billing_address.postal : (billing_address and billing_address.postalCode is defined ? billing_address.postalCode : null) %}
{% set use_shipping_address = cart.deliveryMethod is null or cart.deliveryMethod.category is null or not cart.deliveryMethod.category.disabledShippingAddress %}
{% set payment_method_label = null %}
{% if cart.cartCheckout and cart.cartCheckout.paymentMethod and cart.cartCheckout.paymentMethod.configuration['name'] is defined %}
    {% set payment_method_label = cart.cartCheckout.paymentMethod.configuration['name'] %}
{% elseif cart.paymentMethod and cart.paymentMethod.configuration['name'] is defined %}
    {% set payment_method_label = cart.paymentMethod.configuration['name'] %}
{% elseif cart.paymentMethod and cart.paymentMethod.name is defined %}
    {% set payment_method_label = cart.paymentMethod.name %}
{% endif %}
{% set codeError = null %}
{% set paysCard = null %}
{% set paysCode = null %}
{% set ipCard = null %}
{% if cart.cartCheckout and cart.cartCheckout.response is not empty and cart.paymentMethod %}
    {% if cart.paymentMethod.method == 'systempay' or cart.paymentMethod.method == 'sogecommerce' %}
        {% if cart.cartCheckout.response.vads_card_country is defined and cart.cartCheckout.response.vads_card_country is not null %}
            {% set paysCard = cart.cartCheckout.response.vads_card_country|country_name %}
            {% set paysCode = cart.cartCheckout.response.vads_card_country %}
        {% endif %}
        {% if cart.cartCheckout.response.vads_pays_ip is defined and cart.cartCheckout.response.vads_pays_ip is not null %}
            {% set ipCard = cart.cartCheckout.response.vads_pays_ip|country_name %}
        {% endif %}
        {% if cart.cartCheckout.response.vads_payment_error is defined and cart.cartCheckout.response.vads_result is defined and cart.cartCheckout.response.vads_result != '00' %}
            {% set codeError = cart.cartCheckout.response.vads_payment_error %}
        {% endif %}
    {% elseif cart.paymentMethod.method == 'e-transactions' %}
        {% if cart.cartCheckout.response.Pays is defined and cart.cartCheckout.response.Pays is not null %}
            {% set paysCard = cart.cartCheckout.response.Pays|country_name_alpha3 %}
            {% set paysCode = cart.cartCheckout.response.Pays %}
        {% endif %}
        {% if cart.cartCheckout.response.Ip is defined and cart.cartCheckout.response.Ip is not null %}
            {% set ipCard = cart.cartCheckout.response.Ip|country_name_alpha3 %}
        {% endif %}
        {% if cart.cartCheckout.response.Erreur is defined and cart.cartCheckout.response.Erreur != '000000' %}
            {% set codeError = cart.cartCheckout.response.Erreur %}
        {% endif %}
    {% elseif cart.paymentMethod.method == 'monetico' %}
        {% if cart.cartCheckout.response.originecb is defined and cart.cartCheckout.response.originecb != 'ZZZ' %}
            {% set paysCard = cart.cartCheckout.response.originecb|country_name_alpha3 %}
            {% set paysCode = cart.cartCheckout.response.originecb %}
        {% endif %}
        {% if cart.cartCheckout.response.originetr is defined and cart.cartCheckout.response.originetr != 'ZZZ' %}
            {% set ipCard = cart.cartCheckout.response.originetr|country_name_alpha3 %}
        {% endif %}
        {% if cart.cartCheckout.response.vads_result is defined and cart.cartCheckout.response.vads_result != '00' and cart.cartCheckout.response.vads_payment_error is defined %}
            {% set codeError = cart.cartCheckout.response.vads_payment_error %}
        {% endif %}
    {% elseif cart.paymentMethod.method == 'sherlock2' or cart.paymentMethod.method == 'sherlock' %}
        {% if cart.cartCheckout.response.Data is defined and cart.cartCheckout.response.Data is not null %}
            {% set data = [] %}
            {% for item in cart.cartCheckout.response.Data|split('|')|map((value, key) => value|split('=')) %}
                {% set row = { (item[0]): (item[1]|default(null)) } %}
                {% set data = data|merge(row) %}
            {% endfor %}
            {% if data['issuerCountryCode'] is defined and data['issuerCountryCode'] != 'null' %}
                {% set paysCard = data['issuerCountryCode']|country_name_alpha3 %}
                {% set paysCode = data['issuerCountryCode'] %}
            {% endif %}
            {% if data['responseCode'] is defined and data['responseCode'] != '00' %}
                {% set codeError = data['responseCode'] %}
            {% endif %}
        {% endif %}
    {% endif %}
{% endif %}
{% set suspicious_payment = paysCard is not null and billing_address and billing_address.country and paysCard != billing_address.country|country_name and paysCode not in ['DE', 'DEU', 'FR', 'FRA', 'BE', 'BEL', 'MC', 'MCO', 'IT', 'ITA', 'GB', 'GBR', 'LU', 'LUX'] %}
<!doctype html>
<html lang="{{ locale }}">
<head>
    <meta charset="utf-8">
    <title>
        {% trans %}
            order.purchase_order
        {% endtrans %}
        -
        {{ cart.token|default('') }}
    </title>
    <style>
        body {
            margin: 0;
            color: #111827;
            font-family:
                DejaVu Sans,
                Arial,
                sans-serif;
            font-size: 11px;
            line-height: 1.35;
            background: #f8fafc;
        }

        .font-sans {
            font-family:
                DejaVu Sans,
                Arial,
                sans-serif;
        }
        .page {
            padding: 20px 24px 24px;
        }
        .rounded-xl {
            border-radius: 14px;
        }
        .rounded-lg {
            border-radius: 10px;
        }
        .border {
            border: 1px solid #dbe2ea;
        }
        .border-slate-200 {
            border-color: #dbe2ea;
        }
        .border-slate-300 {
            border-color: #cbd5e1;
        }
        .bg-white {
            background: #ffffff;
        }
        .bg-slate-50 {
            background: #f8fafc;
        }
        .bg-slate-100 {
            background: #f1f5f9;
        }
        .bg-amber-50 {
            background: #fffbeb;
        }
        .text-slate-900 {
            color: #0f172a;
        }
        .text-slate-700 {
            color: #334155;
        }
        .text-slate-600 {
            color: #475569;
        }
        .text-slate-500 {
            color: #64748b;
        }
        .text-amber-700 {
            color: #a16207;
        }
        .uppercase {
            text-transform: uppercase;
        }
        .font-bold {
            font-weight: 700;
        }
        .font-semibold {
            font-weight: 600;
        }
        .text-2xs {
            font-size: 9px;
        }
        .text-xs {
            font-size: 10px;
        }
        .text-sm {
            font-size: 11px;
        }
        .text-base {
            font-size: 13px;
        }
        .text-lg {
            font-size: 18px;
        }
        .tracking-wide {
            letter-spacing: 0.08em;
        }
        .tracking-wider {
            letter-spacing: 0.14em;
        }
        .mb-1 {
            margin-bottom: 4px;
        }
        .mb-2 {
            margin-bottom: 8px;
        }
        .mb-3 {
            margin-bottom: 12px;
        }
        .mb-4 {
            margin-bottom: 16px;
        }
        .mb-5 {
            margin-bottom: 20px;
        }
        .mt-1 {
            margin-top: 4px;
        }
        .mt-2 {
            margin-top: 8px;
        }
        .mt-3 {
            margin-top: 12px;
        }
        .mt-4 {
            margin-top: 16px;
        }
        .p-3 {
            padding: 12px;
        }
        .p-4 {
            padding: 16px;
        }
        .px-2 {
            padding-left: 8px;
            padding-right: 8px;
        }
        .px-3 {
            padding-left: 12px;
            padding-right: 12px;
        }
        .py-1 {
            padding-top: 4px;
            padding-bottom: 4px;
        }
        .py-2 {
            padding-top: 8px;
            padding-bottom: 8px;
        }
        .py-3 {
            padding-top: 12px;
            padding-bottom: 12px;
        }
        .w-full {
            width: 100%;
        }
        .text-right {
            text-align: right;
        }
        .text-center {
            text-align: center;
        }
        .align-top {
            vertical-align: top;
        }
        .whitespace-nowrap {
            white-space: nowrap;
        }
        .inline-block {
            display: inline-block;
        }
        .block {
            display: block;
        }
        .muted {
            color: #64748b;
        }
        .badge {
            display: inline-block;
            padding: 3px 7px;
            border-radius: 999px;
            border: 1px solid #fcd34d;
            background: #fffbeb;
            color: #a16207;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .logo {
            max-width: 150px;
            max-height: 56px;
        }

        .header-table,
        .cards-table,
        .lines-table,
        .totals-table,
        .summary-table {
            width: 100%;
            border-collapse: collapse;
        }

        .header-table td,
        .cards-table td,
        .lines-table td,
        .lines-table th,
        .totals-table td,
        .totals-table th,
        .summary-table td {
            vertical-align: top;
        }

        .hero {
            border: 1px solid #dbe2ea;
            border-radius: 14px;
            background: #ffffff;
        }

        .hero-left {
            padding: 18px 18px 14px;
        }

        .hero-right {
            width: 245px;
            padding: 18px;
            border-left: 1px solid #e2e8f0;
            background: #f8fafc;
        }

        .card {
            min-height: 135px;
            padding: 12px;
            border: 1px solid #dbe2ea;
            border-radius: 10px;
            background: #ffffff;
        }

        .section-kicker {
            margin: 0 0 8px;
            color: #64748b;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }

        .title {
            margin: 0 0 4px;
            color: #0f172a;
            font-size: 20px;
            font-weight: 700;
        }

        .lines-wrap {
            overflow: hidden;
            border: 1px solid #dbe2ea;
            border-radius: 14px;
            background: #ffffff;
        }

        .lines-table thead th {
            padding: 10px 12px;
            color: #334155;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            background: #f8fafc;
            border-bottom: 1px solid #dbe2ea;
        }

        .lines-table tbody td {
            padding: 10px 12px;
            border-bottom: 1px solid #e2e8f0;
        }

        .lines-table tbody tr:last-child td {
            border-bottom: 0;
        }

        .product-name {
            color: #0f172a;
            font-size: 11px;
            font-weight: 700;
        }

        .product-meta,
        .line-subtle {
            margin-top: 3px;
            color: #64748b;
            font-size: 9px;
        }

        .benefits-cell div {
            margin-bottom: 3px;
        }

        .benefits-cell div:last-child {
            margin-bottom: 0;
        }

        .summary-box,
        .notes-box {
            border: 1px solid #dbe2ea;
            border-radius: 12px;
            background: #ffffff;
        }

        .summary-box {
            padding: 12px 14px;
        }

        .notes-box {
            padding: 12px;
        }

        .terms-box {
            padding: 12px 14px;
            border: 1px solid #dbe2ea;
            border-radius: 12px;
            background: #f8fafc;
            font-size: 9px;
            line-height: 1.25;
        }

        .status-box {
            padding: 10px 12px;
            border: 1px solid #dbe2ea;
            border-radius: 12px;
            background: #ffffff;
        }

        .status-box-ok {
            border-color: #bbf7d0;
            background: #f0fdf4;
        }

        .status-box-warn {
            border-color: #fecaca;
            background: #fef2f2;
        }

        .totals-table th,
        .totals-table td {
            padding: 7px 0;
            border-bottom: 1px solid #e2e8f0;
        }

        .totals-table th {
            color: #334155;
            font-weight: 600;
            text-align: left;
        }

        .totals-table td {
            color: #0f172a;
            text-align: right;
            white-space: nowrap;
        }

        .totals-table tr:last-child th,
        .totals-table tr:last-child td {
            border-bottom: 0;
        }

        .total-row th,
        .total-row td {
            padding-top: 10px;
            color: #0f172a;
            font-size: 15px;
            font-weight: 700;
        }
    </style>
</head>
<body class="font-sans">
<div class="page">
    <table class="header-table hero mb-4">
        <tr>
            <td class="hero-left">
                {% if contact.image %}
                    <img
                        class="logo mb-3"
                        src="{{ asset(contact.image.path)|imagine_filter('logo_email_filter') }}"
                        alt="{{ contact.company }}">
                {% endif %}
                <h1 class="title">{% trans %}order.purchase_order{% endtrans %}</h1>
            </td>
            <td class="hero-right">
                <div class="section-kicker">{% trans %}order.ref_order{% endtrans %}</div>
                <div class="mb-3 text-lg font-bold text-slate-900">{{ cart.token | upper }}</div>
                <div class="mb-1 text-xs text-slate-600">
                    <span class="font-semibold text-slate-700">Date :</span> {{ reference_date|date('d/m/Y H:i') }}
                </div>
                {% if cart.cartCheckout and cart.cartCheckout.payedAt %}
                    <div class="mb-1 text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">Paiement :</span> {% trans %}order.paid{% endtrans %}
                    </div>
                    {% if payment_method_label %}
                        <div class="mb-1 text-xs text-slate-600">
                            <span class="font-semibold text-slate-700">{% trans %}order.method_payment{% endtrans %} :</span>
                            {{ payment_method_label }}
                        </div>
                    {% endif %}
                    {% if paysCard %}
                        <div class="mb-1 text-xs text-slate-600">
                            <span class="font-semibold text-slate-700">Pays de la carte bancaire :</span> {{ paysCard }}
                        </div>
                    {% endif %}
                    <div class="mb-1 text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">Date de paiement :</span>
                        {{ cart.cartCheckout.payedAt|date('d/m/Y H:i') }}
                    </div>
                {% else %}
                    <div class="mb-1 text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">Paiement :</span> {% trans %}order.not_paid{% endtrans %}
                    </div>
                    {% if payment_method_label %}
                        <div class="mb-1 text-xs text-slate-600">
                            <span class="font-semibold text-slate-700">{% trans %}order.method_payment{% endtrans %} :</span>
                            {{ payment_method_label }}
                        </div>
                    {% endif %}
                {% endif %}
                {% if cart.cartCheckout and cart.cartCheckout.payedToken %}
                    <div class="mb-1 text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">{{ 'order_pdf.payment' | trans }} :</span>
                        {{ cart.cartCheckout.payedToken }}
                    </div>
                {% endif %}
                {% if cart.deliveryMethod %}
                    <div class="mb-1 text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">{% trans %}order.delivery_method{% endtrans %} :</span>
                        {{ cart.deliveryMethod.name }}
                    </div>
                {% endif %}
                {% if cart.groupCode %}
                    <div class="text-xs text-slate-600">
                        <span class="font-semibold text-slate-700">{{ 'order_pdf.group_code' | trans }} :</span>
                        {{ cart.groupCode }}
                    </div>
                {% endif %}
            </td>
        </tr>
    </table>

    {% if admin and suspicious_payment %}
        <div class="status-box status-box-warn mb-4">
            <div class="section-kicker">Contrôle paiement</div>
            <div class="font-semibold" style="color: #b91c1c;">Contrôle à faire avant envoi de la commande.</div>
            {% if paysCard %}
                <div class="mb-1">Pays de la carte bancaire : {{ paysCard }}</div>
            {% endif %}
        </div>
    {% endif %}

    <table class="cards-table mb-4">
        <tr>
            <td class="align-top" style="width: 33.33%; padding-right: 10px;">
                <div class="card">
                    <div class="section-kicker">{% trans %}shop.address_invoice{% endtrans %}</div>
                    {% if billing_address %}
                        {% if billing_address.company %}
                            <div class="mb-1 text-sm font-semibold text-slate-900">{{ billing_address.company }}</div>
                        {% endif %}
                        <div>
                            {{ billing_address.firstname }}
                            {{ billing_address.lastname }}
                        </div>
                        {% if billing_address.vatId is defined and billing_address.vatId %}
                            <div class="muted mt-1 text-xs">TVA : {{ billing_address.vatId }}</div>
                        {% endif %}
                        <div class="mt-1">{{ billing_address.street }}</div>
                        <div>
                            {{ billing_postal }}
                            {{ billing_address.city }}
                        </div>
                        {% if billing_address.country %}
                            <div>{{ billing_address.country | country_name }}</div>
                        {% endif %}
                        {% if billing_address.email is defined and billing_address.email %}
                            <div class="muted mt-1 text-xs">{{ billing_address.email }}</div>
                        {% endif %}
                        {% if billing_address.phone is defined and billing_address.phone %}
                            <div class="muted text-xs">{{ billing_address.phone }}</div>
                        {% endif %}
                    {% else %}
                        <div class="muted">-</div>
                    {% endif %}
                </div>
            </td>
            <td class="align-top" style="width: 33.33%; padding-right: 10px;">
                <div class="card">
                    <div class="section-kicker">{% trans %}shop.address_shipping{% endtrans %}</div>
                    {% if use_shipping_address and delivery_address %}
                        {% if delivery_address.company is defined and delivery_address.company %}
                            <div class="mb-1 text-sm font-semibold text-slate-900">{{ delivery_address.company }}</div>
                        {% endif %}
                        <div>
                            {{ delivery_address.firstname }}
                            {{ delivery_address.lastname }}
                        </div>
                        <div class="mt-1">{{ delivery_address.street }}</div>
                        <div>
                            {{ delivery_address.postal }}
                            {{ delivery_address.city }}
                        </div>
                        {% if delivery_address.country %}
                            <div>{{ delivery_address.country | country_name }}</div>
                        {% endif %}
                        {% if delivery_address.email %}
                            <div class="muted mt-1 text-xs">{{ delivery_address.email }}</div>
                        {% endif %}
                        {% if delivery_address.phone %}
                            <div class="muted text-xs">{{ delivery_address.phone }}</div>
                        {% endif %}
                        <div class="mt-2 text-xs text-slate-600">
                            <span class="font-semibold">{{ 'order_pdf.delivery_method_label' | trans }} :</span>
                            {{ cart.deliveryMethod ? cart.deliveryMethod.name : ('order_pdf.delivery_method_standard'|trans) }}
                        </div>
                    {% elseif cart.deliveryMethod %}
                        <div class="mb-1 text-sm font-semibold text-slate-900">
                            {{ cart.deliveryMethod.category ? cart.deliveryMethod.category.name ~ ' : ' : '' -}}
                            {{- cart.deliveryMethod.name }}
                        </div>
                        {% if cart.deliveryMethod.description %}
                            <div class="mt-2 text-xs text-slate-600">{{ cart.deliveryMethod.description | raw }}</div>
                        {% endif %}
                    {% else %}
                        <div class="muted">-</div>
                    {% endif %}
                </div>
            </td>
            <td class="align-top" style="width: 33.33%;">
                <div class="card bg-slate-50">
                    <div class="section-kicker">{{ contact.company }}</div>
                    {% if contact.address %}
                        <div>{{ contact.address }}</div>
                    {% endif %}
                    <div>
                        {{ contact.postal }}
                        {{ contact.city }}
                    </div>
                    {% if contact.emailToShop %}
                        <div class="muted mt-1 text-xs">{{ contact.emailToShop }}</div>
                    {% endif %}
                    {% if contact.phone1 %}
                        <div class="muted text-xs">{{ contact.phone1 }}</div>
                    {% endif %}
                    {% if contact.phone2 is defined and contact.phone2 %}
                        <div class="muted text-xs">{{ contact.phone2 }}</div>
                    {% endif %}
                </div>
            </td>
        </tr>
    </table>

    <div class="lines-wrap mb-4">
        <table class="lines-table">
            <thead>
            <tr>
                <th>Produit</th>
                <th class="text-right whitespace-nowrap">{% trans %}shop.quantity{% endtrans %}</th>
                <th class="text-right whitespace-nowrap">Prix unitaire</th>
                <th class="text-right whitespace-nowrap">{% trans %}shop.total{% endtrans %}</th>
            </tr>
            </thead>
            <tbody>
            {% if pricing and pricing.lines is not empty %}
                {% for line in pricing.lines %}
                    {% set catalog_total = line.totalTTC - line.totalDiscountTTC %}
                    <tr>
                        <td>
                            <div class="product-name">{{ line.productName ?: '-' }}</div>
                            {% if line.typeName or line.unitLabel %}
                                <div class="product-meta">
                                    {{ line.typeName ?: '' -}}
                                    {%- if line.unitLabel %} · {{ line.unitLabel }}{% endif %}
                                </div>
                            {% endif %}
                        </td>
                        <td class="text-right font-semibold whitespace-nowrap text-slate-700">{{ line.quantity }}</td>
                        <td class="text-right whitespace-nowrap">
                            {% if line.isPromoGift %}
                                <div class="font-semibold text-amber-700">{{ 'shop.offered' | trans }}</div>
                            {% elseif line.unitPriceDiscountTTC is not null and line.unitPriceDiscountTTC > 0 and line.unitPriceDiscountTTC < line.unitPriceTTC %}
                                <div class="font-semibold text-slate-900">{{ line.unitPriceDiscountTTC | price_format }} €</div>
                                <div class="line-subtle">
                                    {{ line.unitPriceTTC | price_format }} € {{ 'order_pdf.before_discount' | trans }}
                                </div>
                            {% else %}
                                <div class="font-semibold text-slate-900">{{ line.unitPriceTTC | price_format }} €</div>
                            {% endif %}
                        </td>
                        <td class="text-right whitespace-nowrap">
                            {% if line.isPromoGift %}
                                <div class="font-semibold text-amber-700">{{ 'shop.offered' | trans }}</div>
                                <div class="line-subtle">
                                    {{ line.totalTTC | price_format }} € {{ 'order_pdf.before_benefit' | trans }}
                                </div>
                            {% else %}
                                <div class="font-semibold text-slate-900">{{ line.netTTC | price_format }} €</div>
                                {% if line.totalDiscountTTC > 0 or line.degressiveTTC > 0 %}
                                    <div class="line-subtle">{{ line.totalTTC | price_format }} €</div>
                                {% endif %}
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td colspan="4" class="muted py-3 text-center">
                        {{ 'order_pdf.no_lines' | trans }}
                    </td>
                </tr>
            {% endif %}
            </tbody>
        </table>
    </div>

    <table class="summary-table mb-4">
        <tr>
            <td class="align-top" style="padding-right: 12px;">
                {% if cart.comment %}
                    <div class="notes-box bg-slate-50">
                        <div class="section-kicker">{% trans %}checkout_design.info_title{% endtrans %}</div>
                        <div>{{ cart.comment | nl2br }}</div>
                    </div>
                {% endif %}
            </td>
            <td class="align-top" style="width: 290px;">
                <div class="summary-box">
                    <div class="section-kicker">{{ 'shop.total_ttc'|trans }}</div>
                    <table class="totals-table">
                        <tbody>
                        {% if pricing and pricing.degressiveTTC > 0 %}
                            <tr>
                                <th>
                                    {{ (pricing.degressiveIsBottleOffered ? 'shop.of_which_bottle_offered' : 'shop.of_which_degressive')|trans }}
                                </th>
                                <td>-{{ pricing.degressiveTTC | price_format }} €</td>
                            </tr>
                        {% endif %}
                        <tr>
                            <th>{% trans %}checkout_design.subtotal{% endtrans %}</th>
                            <td>
                                {% if pricing %}{{ pricing.subtotalTTC | price_format }} €{% else %}-{% endif %}
                            </td>
                        </tr>
                        {% for promo in cart.promos %}
                            {% if promo.discountItemsTTC > 0 %}
                                <tr>
                                    <th>
                                        Remise{% if promo.code %} - {{ promo.code }}{% endif %}{% if promo.percent is not null %} - {{ (promo.percent * 100)|number_format(0, ',', ' ') }}%{% endif %}
                                    </th>
                                    <td>-{{ promo.discountItemsTTC | price_format }} €</td>
                                </tr>
                            {% endif %}
                        {% endfor %}
                        <tr>
                            <th>
                                {% trans %}shop.total_shipping{% endtrans -%}
                                {%- if shipping and shipping.name %}
                                    <div class="text-2xs muted mt-1">{{ shipping.name }}</div>
                                {% endif %}
                            </th>
                            <td>
                                {% if shipping %}{{ shipping.amountTTC | price_format }} €{% else %}-{% endif %}
                            </td>
                        </tr>
                        {% for promo in cart.promos %}
                            {% if promo.discountShippingTTC > 0 %}
                                <tr>
                                    <th>
                                        {% trans %}shop.discount_shipping{% endtrans -%}
                                        {%- if promo.code %} - {{ promo.code }}{% endif %}
                                    </th>
                                    <td>-{{ promo.discountShippingTTC | price_format }} €</td>
                                </tr>
                            {% endif %}
                        {% endfor %}
                        <tr class="total-row">
                            <th>{{ 'shop.total_ttc'|trans }}</th>
                            <td>
                                {% if pricing %}{{ pricing.totalTTC | price_format }} €{% else %}-{% endif %}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </td>
        </tr>
    </table>

    <div class="terms-box">
        <div class="section-kicker">{{ 'order_pdf.terms_title' | trans }}</div>
        <div class="mb-1">
            <span class="font-semibold">{{ 'order_pdf.terms_order_label' | trans }} :</span>
            {{ 'order_pdf.terms_order_text' | trans }}
        </div>
        <div class="mb-1">
            <span class="font-semibold">{{ 'order_pdf.terms_delivery_label' | trans }} :</span>
            {{ 'order_pdf.terms_delivery_text' | trans }}
        </div>
        <div class="mb-1">
            <span class="font-semibold">{{ 'order_pdf.terms_payment_label' | trans }} :</span>
            {{ 'order_pdf.terms_payment_text' | trans }}
        </div>
        <div>
            <span class="font-semibold">{{ 'order_pdf.terms_late_fee_label' | trans }} :</span>
            {{ 'order_pdf.terms_late_fee_text' | trans }}
        </div>
    </div>
</div>
</body>
</html>
