
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>EOD Portfolio Report</title>
    <style>
        body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; color: #333; }
        .container { max-width: 600px; margin: 0 auto; padding: 20px; }
        .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center; }
        .section { margin: 20px 0; padding: 15px; background: #f9f9f9; border-radius: 4px; }
        .section h2 { margin-top: 0; color: #667eea; }
        .alert { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin: 10px 0; }
        .footer { text-align: center; color: #999; font-size: 12px; margin-top: 30px; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>Portfolio Summary</h1>
            <p>{{ date }}</p>
        </div>

        <div class="section">
            <h2>Today's Performance</h2>
            <p><strong>Portfolio Value:</strong> {{ summary.total_value | currency }}</p>
            <p><strong>Daily Change:</strong> {{ summary.daily_change | percent }}</p>
            <p><strong>YTD Return:</strong> {{ summary.ytd_return | percent }}</p>
        </div>

        {% if alerts %}
        <div class="section">
            <h2>⚠️ Alerts</h2>
            {% for alert in alerts %}
            <div class="alert">{{ alert }}</div>
            {% endfor %}
        </div>
        {% endif %}

        <div class="section">
            <h2>Asset Allocation</h2>
            <ul>
            {% for asset_type, allocation in allocation_by_type.items() %}
                <li>{{ asset_type | title }}: {{ allocation | percent }}</li>
            {% endfor %}
            </ul>
        </div>

        <div class="footer">
            <p>This is an automated report from InvestorClaw</p>
            <p><a href="#">View full report</a></p>
        </div>
    </div>
</body>
</html>
