routerAdd('GET', '/manage', function (e) {
    const html = `<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>管理主页</title>
    <script>
        (function () {
            var token = localStorage.getItem('pb_manage_token') || ''
            var isLoggedIn = localStorage.getItem('pb_manage_logged_in') === '1'
            if (!token || !isLoggedIn) {
                window.location.replace('/pb/manage/login')
            }
        })()
    </script>
    <style>
        body { margin: 0; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: linear-gradient(180deg, #f3f6fb 0%, #eef2ff 100%); color: #1f2937; }
        .wrap { max-width: 760px; margin: 0 auto; padding: 48px 20px; }
        .hero { background: #ffffff; border-radius: 24px; box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08); padding: 36px; border: 1px solid #e5e7eb; }
        h1 { margin: 0 0 20px; font-size: 32px; }
        .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
        .card { background: #f8fafc; border: 1px solid #dbe3f0; border-radius: 18px; padding: 22px; text-align: center; }
        .card h2 { margin: 0 0 14px; font-size: 20px; }
        .btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 12px; text-decoration: none; background: #2563eb; color: #fff; font-weight: 600; margin-top: 12px; }
        .actions { margin-top: 24px; display: flex; justify-content: flex-start; }
    </style>
</head>
<body>
    <main class="wrap">
        <section class="hero">
            <h1>管理主页</h1>
            <div class="grid">
                <article class="card">
                    <h2>字典管理</h2>
                    <a class="btn" href="/pb/manage/dictionary-manage">进入字典管理</a>
                </article>
                <article class="card">
                    <h2>文档管理</h2>
                    <a class="btn" href="/pb/manage/document-manage">进入文档管理</a>
                </article>
            </div>
            <div class="actions">
                <button id="logoutBtn" class="btn" type="button" style="background:#dc2626;">退出登录</button>
            </div>
        </section>
    </main>
    <script>
        document.getElementById('logoutBtn').addEventListener('click', function () {
            localStorage.removeItem('pb_manage_token')
            localStorage.removeItem('pb_manage_logged_in')
            localStorage.removeItem('pb_manage_login_account')
            localStorage.removeItem('pb_manage_login_time')
            window.location.replace('/pb/manage/login')
        })
    </script>
</body>
</html>`

    return e.html(200, html)
})
