<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}MailsAuswerten{% endblock %}</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #f0f2f5;
            color: #333;
        }
        nav {
            background: #2c3e50;
            padding: 0 2rem;
            display: flex;
            align-items: center;
            height: 56px;
        }
        nav .brand {
            color: #fff;
            font-size: 1.3rem;
            font-weight: 700;
            margin-right: 2rem;
            text-decoration: none;
        }
        nav a {
            color: #bdc3c7;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 4px;
            font-size: 0.95rem;
        }
        nav a:hover, nav a.active {
            color: #fff;
            background: rgba(255,255,255,0.1);
        }
        .container {
            max-width: 1100px;
            margin: 2rem auto;
            padding: 0 1rem;
        }
        h1 { margin-bottom: 1.5rem; color: #2c3e50; }
        .card {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            padding: 1.5rem;
            margin-bottom: 1.5rem;
        }
        .btn {
            display: inline-block;
            padding: 0.6rem 1.5rem;
            border: none;
            border-radius: 5px;
            font-size: 1rem;
            cursor: pointer;
            text-decoration: none;
            color: #fff;
        }
        .btn-primary { background: #3498db; }
        .btn-primary:hover { background: #2980b9; }
        .btn-success { background: #27ae60; }
        .btn-success:hover { background: #219a52; }
        .btn-danger { background: #e74c3c; }
        .btn-danger:hover { background: #c0392b; }
        .btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
        .btn-group { display: flex; gap: 0.5rem; align-items: center; }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            padding: 0.75rem 1rem;
            text-align: left;
            border-bottom: 1px solid #eee;
        }
        th {
            background: #f8f9fa;
            font-weight: 600;
            color: #555;
        }
        tr:hover { background: #f8f9fa; }
        .flash {
            padding: 1rem;
            border-radius: 5px;
            margin-bottom: 1rem;
        }
        .flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
        .flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
        .flash-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
        .stat-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        .stat-card {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            padding: 1.5rem;
            text-align: center;
        }
        .stat-card .number {
            font-size: 2.5rem;
            font-weight: 700;
            color: #3498db;
        }
        .stat-card .label {
            color: #777;
            margin-top: 0.3rem;
        }
        label {
            display: block;
            margin-bottom: 0.3rem;
            font-weight: 600;
            color: #555;
        }
        input[type="text"], input[type="number"], input[type="password"], select {
            width: 100%;
            padding: 0.5rem;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 0.95rem;
            margin-bottom: 1rem;
        }
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
        }
        a.link { color: #3498db; text-decoration: none; }
        a.link:hover { text-decoration: underline; }
    </style>
</head>
<body>
    <nav>
        <a href="/" class="brand">MailsAuswerten</a>
        <a href="/">Dashboard</a>
        <a href="/emails">E-Mails</a>
        <a href="/senders">Absender</a>
        <a href="/accounts">Konten</a>
        <a href="/config">Einstellungen</a>
    </nav>
    <div class="container">
        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
            <div class="flash flash-{{ category }}">{{ message }}</div>
            {% endfor %}
        {% endif %}
        {% endwith %}
        {% block content %}{% endblock %}
    </div>
</body>
</html>
