<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Action Required: Quota Exceeded</title>
</head>
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; color: #374151; max-width: 600px; margin: 0 auto; padding: 20px;">
    <div style="background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); padding: 30px; border-radius: 12px 12px 0 0; text-align: center;">
        <h1 style="color: white; margin: 0; font-size: 24px;">Action Required</h1>
        <p style="color: rgba(255,255,255,0.9); margin: 10px 0 0 0;">Your account has exceeded its quota</p>
    </div>

    <div style="background: #ffffff; padding: 30px; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 12px 12px;">
        <p>Hi {{ owner.first_name|default:owner.username }},</p>

        <p>Your <strong>{{ tenant.name }}</strong> account has exceeded its limit for <strong>{{ display_name }}</strong>.</p>

        <div style="background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 20px; margin: 20px 0;">
            <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                <span style="color: #92400e;">Current Usage:</span>
                <strong style="color: #92400e;">{{ current_usage }}</strong>
            </div>
            <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                <span style="color: #92400e;">Your Plan Allows:</span>
                <strong style="color: #92400e;">{{ allowed_limit }}</strong>
            </div>
            <div style="display: flex; justify-content: space-between; border-top: 1px solid #f59e0b; padding-top: 10px;">
                <span style="color: #92400e;">Over Limit By:</span>
                <strong style="color: #dc2626;">{{ overage_amount }}</strong>
            </div>
        </div>

        <h2 style="color: #1f2937; font-size: 18px; margin-top: 30px;">What happens now?</h2>

        <p>You have <strong>{{ days_remaining }} days</strong> (until {{ grace_period_ends|date:"F j, Y" }}) to resolve this by:</p>

        <ol style="padding-left: 20px;">
            <li style="margin-bottom: 10px;"><strong>Select which {{ display_name }} to keep active</strong> - You can choose which ones to archive (they'll become read-only but data is preserved)</li>
            <li style="margin-bottom: 10px;"><strong>Upgrade your plan</strong> - Get more capacity for your growing business</li>
            <li style="margin-bottom: 10px;"><strong>Delete excess {{ display_name }}</strong> - Remove ones you no longer need</li>
        </ol>

        <div style="background: #fee2e2; border: 1px solid #ef4444; border-radius: 8px; padding: 15px; margin: 20px 0;">
            <p style="margin: 0; color: #991b1b;">
                <strong>Important:</strong> After the grace period ends, the oldest {{ display_name }} will be automatically archived. You can download your data before then to keep a copy for your records.
            </p>
        </div>

        <div style="text-align: center; margin: 30px 0;">
            <a href="{{ manage_url }}" style="display: inline-block; background: #4f46e5; color: white; padding: 12px 30px; border-radius: 8px; text-decoration: none; font-weight: 600; margin-right: 10px;">Manage Quota</a>
            <a href="{{ upgrade_url }}" style="display: inline-block; background: #10b981; color: white; padding: 12px 30px; border-radius: 8px; text-decoration: none; font-weight: 600;">Upgrade Plan</a>
        </div>

        <p style="margin-top: 30px;">
            Need to keep your data? <a href="{{ export_url }}" style="color: #4f46e5;">Export it now</a> before making changes.
        </p>

        <hr style="border: none; border-top: 1px solid #e5e7eb; margin: 30px 0;">

        <p style="color: #6b7280; font-size: 14px;">
            If you have any questions, please contact our support team. We're here to help!
        </p>
    </div>
</body>
</html>
