<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Mastermind — Dashboard</title>
  <style>
    body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;margin:0;background:#0b0f14;color:#e8eef7}
    header{position:sticky;top:0;background:#111824;border-bottom:1px solid #233043;padding:14px 16px}
    main{max-width:1100px;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}
    a:hover{text-decoration:underline}
    .muted{color:#a9b7c6}
    .grid{display:grid;grid-template-columns:repeat(12,1fr);gap:12px}
    .col6{grid-column:span 12}
    @media(min-width:900px){.col6{grid-column:span 6}}
  </style>
</head>
<body>
  <header>
    <div style="display:flex;justify-content:space-between;align-items:center;gap:10px">
      <div>
        <div style="font-weight:700">Mastermind</div>
        <div class="muted" style="font-size:13px">Logged in as <%= user.email || user.display_name || user.id %></div>
      </div>
      <div style="display:flex;gap:10px">
        <a href="/account/password">Password</a>
        <a href="/setup">Setup</a>
        <a href="/docs">Docs</a>
        <% if (user.role === 'owner') { %>
          <a href="/admin/email">Email</a>
          <a href="/admin/email-rules">Rules</a>
          <a href="/admin/users">Users</a>
          <a href="/admin/audit">Audit</a>
        <% } %>
        <a href="/logout">Logout</a>
      </div>
    </div>
  </header>

  <main>
    <div class="grid">
      <div class="card col6">
        <h2 style="margin:0 0 8px">MVP status</h2>
        <div class="muted">Auth is wired (local + optional Google/Microsoft). Next: project wizard + inbox ingestion.</div>
      </div>
      <div class="card col6">
        <h2 style="margin:0 0 8px">Base URL</h2>
        <div class="muted">Current: <code><%= baseUrl %></code></div>
        <div class="muted" style="margin-top:6px">If OAuth callbacks don’t work, update Base URL under Setup.</div>
      </div>
    </div>

    <div class="card">
      <h2 style="margin:0 0 8px">Start</h2>
      <p class="muted">Create a project profile so Mastermind can sort your single mailbox automatically.</p>
      <p><a href="/projects">→ Projects</a></p>
      <p><a href="/inbox">→ Inbox (import + triage)</a></p>
      <p><a href="/drafts">→ Drafts (PCO / RFI)</a></p>
    </div>

    <div class="card">
      <h2 style="margin:0 0 8px">Next build steps</h2>
      <ol class="muted">
        <li>Inbox triage queue (single mailbox → auto-sort per project)</li>
        <li>RFI/Submittal/PCO logs + draft generators with citations</li>
        <li>Email connectors (Gmail + Microsoft) behind OAuth + local fallback imports</li>
      </ol>
    </div>
  </main>
</body>
</html>
