root = Card([header, liveSection, kpiSection, trendSection, tablesSection, eventsSection, reviewSection, economySection, experimentsSection, patchSection, actionsSection])

header = CardHeader("Live-Ops Command Center", "Game Studio · Real-time operations")

liveSection = Card([liveHeading, liveStats], "sunk")
liveHeading = Heading("Players Online Now", "h2")
liveStats = Table([liveMetric, liveValue])
liveMetric = Col("Metric", ["Players Online", "Daily Active Users", "Monthly Active Users", "Revenue Today", "Revenue Per User"])
liveValue = Col("Value", ["42,318", "1,204,556", "8,932,110", "$184,230", "$0.153"])

kpiSection = Card([kpiHeading, sessionTrend], "sunk")
kpiHeading = Heading("Session Length (last 14 days)", "h2")
sessionTrend = LineChart(["D-13", "D-12", "D-11", "D-10", "D-9", "D-8", "D-7", "D-6", "D-5", "D-4", "D-3", "D-2", "D-1", "Today"], [sessionSeries], "natural", "Day", "Minutes")
sessionSeries = Series("Avg Session", [22, 24, 23, 27, 26, 29, 28, 31, 30, 33, 35, 34, 36, 38])

tablesSection = Card([sellingHeading, sellingTable, regionHeading, regionTable, crashHeading, crashTable], "sunk")
sellingHeading = Heading("Best-Selling Items", "h2")
sellingTable = Table([itemCol, unitsCol])
itemCol = Col("Item", ["Dragon Armor Set", "Mana Potion XL", "Guild Banner", "Pet Egg Bundle", "Season Pass"])
unitsCol = Col("Units Sold", ["12,540", "9,872", "7,341", "5,208", "3,916"])

regionHeading = Heading("Server Regions & Health", "h2")
regionTable = Table([regionCol, healthCol, pingCol])
regionCol = Col("Region", ["NA East", "NA West", "EU West", "EU Central", "Asia Pacific", "South America"])
healthCol = Col("Health", ["Healthy", "Healthy", "Degraded", "Healthy", "Healthy", "Healthy"])
pingCol = Col("Avg Ping (ms)", ["38", "42", "61", "55", "89", "94"])

crashHeading = Heading("Crash Rate by App Version", "h2")
crashTable = Table([versionCol, crashRateCol])
versionCol = Col("Version", ["v2.4.0", "v2.3.9", "v2.3.8", "v2.3.7"])
crashRateCol = Col("Crash Rate", ["0.12%", "0.08%", "0.31%", "0.19%"])

eventsSection = Card([eventsHeading, eventsList], "sunk")
eventsHeading = Heading("Live Events & Upcoming", "h2")
eventsList = ListBlock([eventLive, eventUpcoming1, eventUpcoming2])
eventLive = ListItem("Double XP Weekend", "Running now · ends in 2d 14h", null, "View")
eventUpcoming1 = ListItem("Boss Rush Challenge", "Starts in 3 days", null, "View")
eventUpcoming2 = ListItem("Winter Festival", "Starts in 10 days", null, "View")

reviewSection = Card([reviewHeading, reviewStats], "sunk")
reviewHeading = Heading("Player Reports & Appeals", "h2")
reviewStats = Table([reviewMetric, reviewCount])
reviewMetric = Col("Category", ["Player Reports Awaiting Review", "Ban Appeals Awaiting Review"])
reviewCount = Col("Count", ["1,284", "342"])

economySection = Card([economyHeading, inflationChart], "sunk")
economyHeading = Heading("In-Game Currency Inflation", "h2")
inflationChart = AreaChart(["W1", "W2", "W3", "W4", "W5", "W6"], [inflationSeries], "linear", "Week", "Gold Supply Index")
inflationSeries = Series("Gold Supply", [100, 104, 109, 117, 128, 142])

experimentsSection = Card([experimentsHeading, experimentTable], "sunk")
experimentsHeading = Heading("Running Experiments", "h2")
experimentTable = Table([experimentCol, resultCol, statusCol])
experimentCol = Col("Experiment", ["Matchmaking ELO band", "Store bundle pricing"])
resultCol = Col("Result", ["+8% retention", "+4.2% revenue"])
statusCol = Col("Status", ["Statistically significant", "Statistically significant"])

patchSection = Card([patchHeading, patchForm], "sunk")
patchHeading = Heading("Draft Patch Notes", "h2")
patchForm = Form("patch-notes-draft", patchButtons, [patchTitleField, patchBodyField])
patchTitleField = FormControl("Patch Title", patchTitleInput)
patchTitleInput = Input("patch_title", "e.g. v2.4.1 Hotfix")
patchBodyField = FormControl("Notes", patchBodyArea, "Markdown supported")
patchBodyArea = TextArea("patch_notes", "## Balance changes\n- Reduced Mana Potion XL price\n\n## Bug fixes\n- Fixed crash on quest completion", 8)
patchButtons = Buttons([saveDraftBtn, previewBtn])
saveDraftBtn = Button("Save Draft", null, "primary")
previewBtn = Button("Preview", null, "secondary")

actionsSection = Card([actionsHeading, actionsButtons], "sunk")
actionsHeading = Heading("Focus & Ship", "h2")
actionsButtons = Buttons([focusRegionBtn, hotfixBtn])
focusRegionBtn = Button("Focus on NA East", null, "secondary")
hotfixBtn = Button("Ship Hotfix", null, "primary")