<!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: 1440px; margin: 0 auto; padding: 24px 14px; }
        .hero { background: #ffffff; border-radius: 20px; box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08); padding: 22px; border: 1px solid #e5e7eb; }
        h1 { margin: 0 0 14px; font-size: 30px; }
        .module + .module { margin-top: 18px; }
        .module-title { margin: 0 0 10px; font-size: 22px; color: #0f172a; }
        .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
        .card { background: #f8fafc; border: 1px solid #dbe3f0; border-radius: 16px; padding: 16px; text-align: center; }
        .card h2 { margin: 0 0 8px; font-size: 19px; }
        .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: 14px; display: flex; justify-content: flex-start; }
        @media (max-width: 960px) {
            .grid { grid-template-columns: 1fr; }
        }
    </style>
    {{ template "theme_head" . }}
</head>
<body>
    <main class="wrap">
        <section class="hero">
            <h1>管理主页</h1>
            <section class="module">
                <h2 class="module-title">平台管理</h2>
                <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>
                    <article class="card">
                        <h2>产品管理</h2>
                        <a class="btn" href="/pb/manage/product-manage">进入产品管理</a>
                    </article>
                    <article class="card">
                        <h2>方案预设管理</h2>
                        <a class="btn" href="/pb/manage/scheme">进入方案预设管理</a>
                    </article>
                    <article class="card">
                        <h2>SDK 权限管理</h2>
                        <a class="btn" href="/pb/manage/sdk-permission-manage">进入权限管理</a>
                    </article>
                    <article class="card">
                        <h2>购物车与订单</h2>
                        <a class="btn" href="/pb/manage/cart-order-manage">进入用户信息及订单管理</a>
                    </article>
                </div>
            </section>
            <section class="module">
                <h2 class="module-title">AI 管理</h2>
                <div class="grid">
                    <article class="card">
                        <h2>AI 审计管理</h2>
                        <a class="btn" href="/pb/bai-ai-manage">进入审计管理</a>
                    </article>
                    <article class="card">
                        <h2>AI 聊天测试</h2>
                        <a class="btn" href="/pb/bai-chat">进入聊天测试</a>
                    </article>
                    <article class="card">
                        <h2>SQL 实验室</h2>
                        <a class="btn" href="/pb/bai-ai-sql-lab">进入 SQL 实验室</a>
                    </article>
                </div>
            </section>
            <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>
    {{ template "theme_body" . }}
</body>
</html>
