<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= esc($title ?? 'Application Error') ?></title>
    <style>
        body { font-family: sans-serif; padding: 40px 20px; background: #f5f5f5; color: #333; }
        h1 { color: #e74c3c; }
        pre { background: #fff; border: 1px solid #ddd; padding: 15px; overflow: auto; font-size: 13px; border-radius: 4px; }
        a { color: #3498db; text-decoration: none; }
    </style>
</head>
<body>
    <h1><?= esc($title ?? 'Application Error') ?></h1>
    <p><?= esc($type ?? '') ?>: <?= esc($message ?? '') ?></p>
    <?php if (defined('CI_DEBUG') && CI_DEBUG && isset($backtrace)) : ?>
        <pre><?= esc($backtrace) ?></pre>
    <?php endif; ?>
    <p><a href="/">Go back home</a></p>
</body>
</html>
