{% extends 'base.html' %}
{% block title %}Expense Categories{% endblock %}

{% block content %}
<div class="flex justify-between items-center mb-6">
  <h1 class="text-2xl font-bold">Expense Categories</h1>
  <a href="{% url 'finance:category_create' %}" class="btn btn-primary btn-sm">➕ Add Category</a>
</div>

<div class="card bg-base-100 shadow">
  <div class="card-body p-0">
    <table class="table table-zebra">
      <thead>
        <tr>
          <th>Name</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        {% for category in categories %}
        <tr>
          <td class="font-medium">{{ category.name }}</td>
          <td class="text-base-content/60">{{ category.description|default:"—" }}</td>
        </tr>
        {% empty %}
        <tr>
          <td colspan="2" class="text-center text-base-content/40 py-10">
            No categories yet.
            <a href="{% url 'finance:category_create' %}" class="link link-primary">Add first category</a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}