<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Mastermind — Project Inbox</title>
  <style>
    body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;margin:0;background:#0b0f14;color:#e8eef7}
    header{background:#111824;border-bottom:1px solid #233043;padding:14px 16px;position:sticky;top:0}
    main{max-width:1200px;margin:0 auto;padding:16px}
    .card{background:#111824;border:1px solid #233043;border-radius:12px;padding:14px;margin:12px 0}
    a{color:#7cc4ff;text-decoration:none}
    .muted{color:#a9b7c6}
    table{width:100%;border-collapse:collapse}
    th,td{border-bottom:1px solid #233043;padding:10px 6px;text-align:left;color:#a9b7c6;font-size:13px;vertical-align:top}
    th{color:#e8eef7}
  </style>
</head>
<body>
<header>
  <div style="display:flex;justify-content:space-between;align-items:center;gap:10px">
    <div>
      <div style="font-weight:700"><%= project.name %> — Inbox</div>
      <div class="muted" style="font-size:13px">Job: <%= project.job_number || '—' %></div>
    </div>
    <div style="display:flex;gap:10px">
      <a href="/projects/<%= project.id %>">Project</a>
      <a href="/projects">Projects</a>
      <a href="/inbox">Global Inbox</a>
      <a href="/">Dashboard</a>
    </div>
  </div>
</header>

<main>
  <div class="card">
    <h2 style="margin:0 0 8px">Assigned emails</h2>
    <div style="overflow:auto">
      <table>
        <thead>
          <tr>
            <th>Date</th>
            <th>From</th>
            <th>Subject</th>
            <th>Source</th>
          </tr>
        </thead>
        <tbody>
          <% emails.forEach(e => { %>
            <tr>
              <td><%= e.date || '' %></td>
              <td><%= e.from_addr || '' %></td>
              <td><a href="/inbox/<%= e.id %>"><%= e.subject || '(no subject)' %></a></td>
              <td><%= e.source %></td>
            </tr>
          <% }) %>
        </tbody>
      </table>
    </div>
  </div>
</main>
</body>
</html>
