<!DOCTYPE html><html lang="nl"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Inbox — Mek-Tech</title><link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet"><link rel="stylesheet" href="/css/style.css"><link rel="stylesheet" href="/css/dynamic.css"><link rel="icon" href="/img/favicon.svg"><script src="https://unpkg.com/lucide@latest"></script>
<style>
body{background:var(--bg);font-family:'Inter',-apple-system,sans-serif;min-height:100vh}
.em-wrap{max-width:900px;margin:0 auto;padding:1rem 1.5rem 3rem}
.em-toolbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:.5rem;flex-wrap:wrap}
.em-toolbar h1{font-size:1.3rem;font-weight:800;color:var(--text);display:flex;align-items:center;gap:.4rem}
.em-toolbar .em-actions{display:flex;gap:.35rem;flex-wrap:wrap}
.em-actions .btn{display:inline-flex;align-items:center;gap:.3rem;padding:.35rem .7rem;border-radius:7px;font-size:.68rem;font-weight:500;cursor:pointer;border:none;font-family:inherit;text-decoration:none;transition:all .15s}
.btn-primary{background:var(--accent);color:#fff}.btn-primary:hover{background:var(--accent-hover)}
.btn-secondary{background:var(--border-light);color:var(--text-muted)}.btn-secondary:hover{color:var(--text);background:var(--border)}
.account-badge{font-size:.62rem;color:var(--text-dim);background:var(--bg-card);border:1px solid var(--border);padding:.2rem .5rem;border-radius:6px;display:inline-flex;align-items:center;gap:.25rem}
.em-row{display:flex;align-items:center;gap:.6rem;padding:.6rem .8rem;background:var(--bg-card);border:1px solid var(--border);border-radius:8px;margin-bottom:2px;text-decoration:none;color:inherit;transition:all .15s;cursor:pointer}
.em-row:hover{border-color:var(--accent);background:rgba(88,166,255,.03)}
.em-row.unseen{border-left:3px solid var(--accent);font-weight:600}
.em-row .em-from{width:160px;font-size:.8rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}
.em-row .em-subj{flex:1;font-size:.8rem;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.em-row .em-date{font-size:.68rem;color:var(--text-dim);flex-shrink:0;white-space:nowrap}
.em-row .em-star{color:var(--orange);flex-shrink:0;font-size:.75rem}
.empty-state{text-align:center;padding:3rem 1rem;color:var(--text-muted)}
.empty-state svg{width:48px;height:48px;color:var(--text-dim);margin-bottom:.75rem}
.empty-state h3{font-size:.9rem;color:var(--text);margin-bottom:.25rem}
.empty-state p{font-size:.72rem;margin-bottom:.75rem}
.alert{padding:.4rem .7rem;border-radius:7px;font-size:.72rem;margin-bottom:.75rem}
.alert-error{background:var(--red-bg);color:var(--red);border:1px solid var(--red)}
@media(max-width:640px){.em-row .em-from{width:100px;font-size:.72rem}.em-row .em-subj{font-size:.72rem}.em-row .em-date{font-size:.62rem}}
</style></head><body>
<nav class="navbar"><div class="nav-inner"><a href="/" class="nav-brand"><img src="/img/logo.svg" class="nav-logo" alt="Mek-Tech"></a><div style="display:flex;align-items:center;gap:.4rem"><a href="/" class="nav-icon-btn" title="Dashboard"><i data-lucide="layout-dashboard" style="width:15px;height:15px"></i> Dashboard</a><button class="theme-toggle" id="themeToggle" onclick="toggleTheme()"></button><a href="/auth/logout" class="nav-icon-btn" style="color:var(--red)"><i data-lucide="log-out" style="width:15px;height:15px"></i> Uitloggen</a></div></div></nav>

<div class="em-wrap">
<% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>

<% if (!account) { %>
<div class="empty-state">
<i data-lucide="mail" style="width:56px;height:56px;color:var(--text-dim);margin-bottom:1rem"></i>
<h3>Geen email account gekoppeld</h3>
<p>Koppel je IMAP/SMTP account om emails te ontvangen en te versturen</p>
<a href="/email/settings" class="btn-primary" style="text-decoration:none;display:inline-flex;align-items:center;gap:.3rem;padding:.45rem .9rem;border-radius:7px;font-size:.72rem"><i data-lucide="plus" style="width:14px;height:14px"></i> Account configureren</a>
</div>
<% } else { %>
<div class="em-toolbar">
<h1><i data-lucide="inbox" style="color:var(--accent);width:20px;height:20px"></i> Inbox</h1>
<div class="em-actions">
<span class="account-badge"><%= account.email %></span>
<a href="/email/sync" class="btn btn-secondary"><i data-lucide="refresh-cw" style="width:13px;height:13px"></i> Sync</a>
<a href="/email/compose" class="btn btn-primary"><i data-lucide="pen-line" style="width:13px;height:13px"></i> Opstellen</a>
</div>
</div>

<% if (messages.length === 0) { %>
<div class="empty-state"><i data-lucide="inbox" style="width:48px;height:48px;color:var(--text-dim);margin-bottom:.75rem"></i><h3>Inbox is leeg</h3><p>Klik op Sync om je berichten op te halen</p></div>
<% } else { %>
<% messages.forEach(function(m){ %>
<a href="/email/message/<%= m.id %>" class="em-row <%= !m.seen ? 'unseen' : '' %>">
<span class="em-from"><%= m.from_name || m.from_addr || 'Onbekend' %></span>
<span class="em-subj"><%= m.subject || '(geen onderwerp)' %></span>
<% if (m.flagged) { %><span class="em-star">★</span><% } %>
<span class="em-date"><%= m.date ? new Date(m.date).toLocaleDateString('nl-NL',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit'}) : '' %></span>
</a>
<% }) %>
<% } %>
<% } %>
</div>
<script>lucide.createIcons()</script><script src="/js/theme.js"></script></body></html>