{% extends 'base.html' %}
{% block title %}Add Expense{% endblock %}
{% block content %}
<div class="flex justify-between items-center mb-6">
  <h1 class="text-2xl font-bold">Add Expense</h1>
  <a href="{% url 'finance:expense_list' %}" class="btn btn-ghost btn-sm">← Back</a>
</div>
{% load form_tags %}
<div class="card bg-base-100 shadow max-w-lg">
  <div class="card-body">
    <form method="post">
      {% csrf_token %}
      {% for field in form %}
        <div class="form-control mb-3">
          <label class="label"><span class="label-text">{{ field.label }}</span></label>
          {{ field|daisyui }}
          {% for error in field.errors %}
            <span class="text-error text-sm">{{ error }}</span>
          {% endfor %}
        </div>
      {% endfor %}
      {% if form.non_field_errors %}
        <div class="alert alert-error mb-3">{{ form.non_field_errors }}</div>
      {% endif %}
      <div class="card-actions justify-end mt-4">
        <a href="{% url 'finance:expense_list' %}" class="btn btn-ghost">Cancel</a>
        <button type="submit" class="btn btn-primary">💾 Save</button>
      </div>
    </form>
  </div>
</div>
{% endblock %}