# 後台 Dashboard 化 Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [x]`) syntax for tracking. **Goal:** 將 `/admin` 由綠色純 CSS 表單頁改造成「墨黑 sidebar + 米白內容」嘅真 dashboard:`/admin` 做總覽、文章列表搬去 `/admin/posts`,所有 admin 頁統一視覺;維持純 Astro + CSS、無 React。 **Architecture:** `AdminLayout.astro` 做單一 shell(sidebar + CSS variables),保留原有 R2 上傳 script。新增 `getDashboardData(db)` 喺 `src/data/content.ts` 提供統計,唔改 schema。`index.astro` 改寫成 dashboard,新增 `posts.astro` 承接原文章列表。 **Tech Stack:** Astro 7 SSR、Drizzle/D1、純 CSS(CSS variables)。驗證=`npm run build`(專案冇 test/lint/typecheck)。 **Spec:** `docs/superpowers/specs/2026-09-13-admin-dashboard-design.md` --- ## File Structure - Modify `src/layouts/AdminLayout.astro` — shell / tokens / nav(保留 upload script) - Modify `src/data/content.ts` — 加 `getDashboardData` - Modify `src/pages/admin/index.astro` — dashboard - Create `src/pages/admin/posts.astro` — 文章列表(由原 index 搬) - Modify `src/pages/admin/post/[id].astro` — redirect+取消 link - Modify `src/pages/admin/{cases,settings,ai}.astro`、`content/[kind].astro` — 只改外觀 - Modify `src/pages/admin/login.astro` — 重新上色 - Modify `src/AGENTS.md` — Admin 段落 --- ### Task 1: `AdminLayout` tokens + sidebar shell **Files:** Modify `src/layouts/AdminLayout.astro` - [x] **Step 1: 換 `:root` 同佈局 CSS** — 將現有 `:root`(line 138-144)+ `.inner`/`.bar*`(149-158)換成: ```css :root { --ink:#1A1917; --ink-2:#24221F; --ink-3:#2E2B27; --bg:#FAF8F4; --surface:#fff; --fg:#1A1917; --fg-muted:#6E6862; --border:#E7E2D9; --brand:#D97706; --brand-strong:#B45309; --brand-soft:#FEF3C7; --ok:#0F6E56; --ok-soft:#E1F5EE; --warn:#854F0B; --warn-soft:#FAEEDA; --danger:#A32D2D; --danger-soft:#FCEBEB; --radius-sm:4px; --radius:8px; --sidebar-w:248px; font-family:"Noto Sans HK","PingFang HK","Microsoft JhengHei",system-ui,sans-serif; color:var(--fg); background:var(--bg); line-height:1.65; font-size:15px; } a{color:var(--brand-strong);text-decoration:none} a:hover{text-decoration:underline} .shell{display:flex;min-height:100vh} .sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-w);background:var(--ink);color:#EDEAE4;display:flex;flex-direction:column;padding:22px 14px;z-index:20} .brand{display:flex;flex-direction:column;gap:2px;padding:0 10px 18px;color:#fff} .brand-name{font-family:'Noto Serif HK',serif;font-weight:900;font-size:17px;letter-spacing:.02em} .brand-sub{font-size:11px;color:#9A938A;letter-spacing:.28em} .nav{display:flex;flex-direction:column;gap:2px;flex:1;overflow:auto} .nav-group{margin:16px 10px 6px;font-size:10.5px;letter-spacing:.22em;color:#7E776E} .nav a{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:var(--radius-sm);color:#CFC9C1;font-size:13.5px;border-left:3px solid transparent} .nav a:hover{background:var(--ink-2);color:#fff;text-decoration:none} .nav a.active{background:var(--ink-2);color:var(--brand);border-left-color:var(--brand);font-weight:700} .sidebar-foot{display:flex;flex-direction:column;gap:4px;border-top:1px solid #2E2B27;padding-top:14px} .sidebar-foot a{padding:8px 10px;color:#9A938A;font-size:13px} .sidebar-foot a:hover{color:#fff;text-decoration:none} .content{flex:1;margin-left:var(--sidebar-w);min-width:0} .main{max-width:1080px;padding:36px 40px 100px;margin:0 auto} .topbar{display:none} ``` - [x] **Step 2: 加 mobile CSS**(同一 `