<tr>
  <td>
    <a href="/app/forderungen/details/{{ row.Client_DB }}_{{ row.Document_No }}"
      class="btn btn-sm btn-primary gc-action-btn">
      <i class="icon cil-pencil"></i>
    </a>
  </td>

  <td>
    <div class="gc-title">{{ row.Standort_Name }}</div>
    <div class="gc-subtitle">{{ row.Bereich }}</div>
  </td>

  <td class="gc-main-cell">
    <a class="gc-title text-decoration-none" href="/app/forderungen/liste?Kunde={{ row.Kunde|urlencode }}">
      {{ row.Kunde }}
    </a>
    <div class="gc-subtitle">
      {{ row.Document_No }}
      {% if row.Kunde_Email %}
      · <a href="mailto:{{ row.Kunde_Email }}?subject={{ row.Document_No }}" hx-disable="true">E-Mail</a>
      {% endif %}
    </div>
  </td>

  <td>
    <a href="/app/forderungen/liste?Verursacher={{ row.Verursacher|urlencode }}"
      class="text-decoration-none fw-semibold">
      {{ row.Verursacher }}
    </a>
    {% if row.Verursacher == 'N.N.' %}
    <span class="gc-badge gc-badge-warning ms-1">offen</span>
    {% endif %}
  </td>

  <td>
    <span class="gc-badge gc-badge-info">{{ row.Document_No }}</span>
  </td>

  <td>
    <div>{{ row.Invoice_Date|date_format }}</div>
    <div class="gc-subtitle">fällig {{ row.Fällig_Datum|date_format }}</div>
  </td>

  <td class="text-end align-top">
    <div class="gc-money">{{ row.offen|number_format }} €</div>
  </td>

  <td class="text-end">
    <div class="gc-money">{{ row.offen|number_format }} €</div>
    <div class="gc-subtitle">Kunde {{ row.offen_Kunde_gesamt|number_format }} €</div>
  </td>

  <td class="text-end">
    {% set mahnstufe = row.Mahnstufe or row.Stufe %}

    {% if mahnstufe and mahnstufe|string != '0' %}
    <span class="gc-badge gc-badge-danger gc-mahnstufe-{{ mahnstufe }}">
      M{{ mahnstufe }}
    </span>
    {% endif %}
    <div class="gc-subtitle">Staffel {{ row.Staffel }}</div>
  </td>

  <td class="text-end">
    {% if row.Abwarten %}
    <span class="gc-badge gc-badge-warning">{{ row.Abwarten }}</span>
    {% endif %}
  </td>

  <td>
    <div class="gc-subtitle">{{ row.Kommentar_Fibu or '' }}</div>
  </td>

  <td>
    <div class="gc-subtitle">{{ row.Kommentar_Abteilung or '' }}</div>
  </td>

  <td class="text-end">
    {% if row.Wiedervorlage %}
    <span class="gc-badge gc-badge-success">{{ row.Wiedervorlage|date_format }}</span>
    {% endif %}
  </td>
</tr>