<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Mastermind — Drafts</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}
    .pill{display:inline-block;padding:2px 8px;border:1px solid #233043;border-radius:999px;font-size:12px;color:#a9b7c6}
  </style>
</head>
<body>
<header>
  <div style="display:flex;justify-content:space-between;align-items:center;gap:10px">
    <div style="font-weight:700">Drafts</div>
    <div style="display:flex;gap:10px">
      <a href="/">Dashboard</a>
      <a href="/logout">Logout</a>
    </div>
  </div>
</header>
<main>
  <div class="card">
    <div class="muted">PCO and RFI drafts generated from emails. Nothing is sent automatically.</div>
  </div>

  <div class="card">
    <h2 style="margin:0 0 8px">PCO drafts</h2>
    <table>
      <thead><tr><th>Created</th><th>Project</th><th>Title</th><th>Status</th></tr></thead>
      <tbody>
        <% pcos.forEach(d => { %>
          <tr>
            <td><%= d.created_at %></td>
            <td><%= d.project_name || '' %></td>
            <td><a href="/drafts/pco/<%= d.id %>"><%= d.title || '(untitled)' %></a></td>
            <td><span class="pill"><%= d.status %></span></td>
          </tr>
        <% }) %>
      </tbody>
    </table>
  </div>

  <div class="card">
    <h2 style="margin:0 0 8px">RFI drafts</h2>
    <table>
      <thead><tr><th>Created</th><th>Project</th><th>Title</th><th>Status</th></tr></thead>
      <tbody>
        <% rfis.forEach(d => { %>
          <tr>
            <td><%= d.created_at %></td>
            <td><%= d.project_name || '' %></td>
            <td><a href="/drafts/rfi/<%= d.id %>"><%= d.title || '(untitled)' %></a></td>
            <td><span class="pill"><%= d.status %></span></td>
          </tr>
        <% }) %>
      </tbody>
    </table>
  </div>
</main>
</body>
</html>
