<div class="flex items-center justify-between flex-wrap gap-4 mb-8">
  <div>
    <h1 class="text-3xl font-display font-semibold">Kelola EA</h1>
    <p class="text-muted text-sm mt-1">Tambah, edit, atau hapus produk EA.</p>
  </div>
  <a href="/admin/eas/new" class="btn btn-gold px-5 py-2.5 rounded-full text-sm">+ Tambah EA</a>
</div>

<div class="card p-0 overflow-hidden">
  <div class="overflow-x-auto">
    <table class="tbl">
      <thead>
        <tr>
          <th>Kode</th>
          <th>Nama</th>
          <th>Pair</th>
          <th>Harga</th>
          <th>Profit</th>
          <th>Status</th>
          <th>File</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <% if (eas && eas.length) { %>
          <% eas.forEach(function(ea){ %>
            <tr>
              <td><span class="pill pill-gold"><%= ea.code %></span></td>
              <td>
                <div class="font-medium"><%= ea.name %></div>
                <div class="text-xs text-muted"><%= ea.rating || '' %></div>
              </td>
              <td class="text-sm"><%= ea.pair || '-' %></td>
              <td class="mono">Rp<%= Number(ea.price).toLocaleString('id-ID') %></td>
              <td class="text-gold-200"><%= ea.watch_profit || '-' %></td>
              <td>
                <span class="pill <%= ea.is_active ? 'pill-green' : 'pill-red' %>">
                  <%= ea.is_active ? 'Aktif' : 'Nonaktif' %>
                </span>
              </td>
              <td>
                <% if (ea.file_path) { %>
                  <span class="text-emerald-300 text-xs">✓ Ada</span>
                <% } else { %>
                  <span class="text-red-300 text-xs">✕ Belum</span>
                <% } %>
              </td>
              <td>
                <div class="flex items-center gap-2 justify-end">
                  <a href="/admin/eas/<%= ea.id %>/edit" class="text-gold-300 hover:text-gold-200 text-sm">Edit</a>
                  <form action="/admin/eas/<%= ea.id %>/delete" method="post" class="needs-confirm" data-confirm="Yakin hapus EA <%= ea.name %>?">
                    <button class="text-red-300 hover:text-red-200 text-sm">Hapus</button>
                  </form>
                </div>
              </td>
            </tr>
          <% }); %>
        <% } else { %>
          <tr><td colspan="8" class="text-center py-10 text-muted">Belum ada EA. <a href="/admin/eas/new" class="text-gold-300">Tambah EA pertama →</a></td></tr>
        <% } %>
      </tbody>
    </table>
  </div>
</div>
