root = Card([header, kpiRow, chartsRow, tablesRow, experimentsRow, actionsRow], "card", "column", "l")
header = CardHeader("Live Operations Dashboard", "Real-time game health & player insights")
kpiRow = Card([onlinePlayers, dauMau, revenueToday, arpu, reportsCount, appealsCount], "clear", "row", "m", "stretch", "between")
onlinePlayers = Card([onlineLabel, onlineValue], "card", "column", "xs", "center")
onlineLabel = TextContent("Players Online", "small")
onlineValue = TextContent("247,832", "large-heavy")
dauMau = Card([dauMauLabel, dauValue, mauValue], "card", "column", "xs", "center")
dauMauLabel = TextContent("Active Players", "small")
dauValue = TextContent("DAU: 1.2M", "default")
mauValue = TextContent("MAU: 8.7M", "small")
revenueToday = Card([revLabel, revValue], "card", "column", "xs", "center")
revLabel = TextContent("Revenue Today", "small")
revValue = TextContent("$487,320", "large-heavy")
arpu = Card([arpuLabel, arpuValue], "card", "column", "xs", "center")
arpuLabel = TextContent("Revenue Per User", "small")
arpuValue = TextContent("$0.41", "large-heavy")
reportsCount = Card([reportsLabel, reportsValue], "card", "column", "xs", "center")
reportsLabel = TextContent("Player Reports", "small")
reportsValue = TextContent("1,247 awaiting review", "default")
appealsCount = Card([appealsLabel, appealsValue], "card", "column", "xs", "center")
appealsLabel = TextContent("Ban Appeals", "small")
appealsValue = TextContent("312 awaiting review", "default")
chartsRow = Card([sessionChart, inflationChart, crashChart], "clear", "row", "l", "stretch", "between")
sessionChart = Card([sessionHeader, sessionLine], "card", "column", "m")
sessionHeader = Heading("Session Length (14 days)", "h3")
sessionLine = LineChart(sessionLabels, [sessionSeries], "natural", "Day", "Minutes")
sessionLabels = ["Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6", "Day 7", "Day 8", "Day 9", "Day 10", "Day 11", "Day 12", "Day 13", "Day 14"]
sessionSeries = Series("Avg Session", [22, 24, 21, 25, 23, 27, 28, 24, 26, 25, 27, 29, 28, 30])
inflationChart = Card([inflationHeader, inflationArea], "card", "column", "m")
inflationHeader = Heading("In-Game Currency Inflation", "h3")
inflationArea = AreaChart(inflationLabels, [inflationSeries], "natural", "Week", "Gold Index")
inflationLabels = ["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"]
inflationSeries = Series("Gold Value Index", [100, 102, 105, 108, 112, 118, 125, 131])
crashChart = Card([crashHeader, crashBar], "card", "column", "m")
crashHeader = Heading("Crash Rate by App Version", "h3")
crashBar = BarChart(crashLabels, [crashSeries], "grouped", "Version", "Crash Rate %")
crashLabels = ["v3.2.1", "v3.2.0", "v3.1.5", "v3.1.4", "v3.1.3"]
crashSeries = Series("Crash %", [0.12, 0.34, 0.89, 1.21, 1.45])
tablesRow = Card([itemsTable, regionsTable, eventsTable], "clear", "row", "l", "stretch", "between")
itemsTable = Card([itemsHeader, bestSellingTable], "card", "column", "m")
itemsHeader = Heading("Best-Selling Items", "h3")
bestSellingTable = Table([itemNameCol, itemUnitsCol, itemRevCol])
itemNameCol = Col("Item", ["Battle Pass S3", "Legendary Skin: Phoenix", "XP Boost 30d", "Weapon Bundle: Arctic", "Emote Pack: Dance", "Pet: Shadow Wolf"])
itemUnitsCol = Col("Units Sold", [45230, 18920, 34100, 12450, 28760, 9840])
itemRevCol = Col("Revenue", ["$678,450", "$473,000", "$341,000", "$249,000", "$143,800", "$196,800"])
regionsTable = Card([regionsHeader, serverRegionsTable], "card", "column", "m")
regionsHeader = Heading("Server Regions & Health", "h3")
serverRegionsTable = Table([regionNameCol, regionStatusCol, regionPlayersCol, regionLatencyCol])
regionNameCol = Col("Region", ["US-East", "US-West", "EU-Central", "EU-West", "AP-Southeast", "AP-Northeast", "SA-East", "ME-Central"])
regionStatusCol = Col("Health", ["Healthy", "Healthy", "Degraded", "Healthy", "Healthy", "Critical", "Healthy", "Healthy"])
regionPlayersCol = Col("Players", [52340, 38210, 45670, 29840, 61230, 18920, 12450, 8760])
regionLatencyCol = Col("Avg Latency (ms)", [42, 38, 67, 51, 89, 156, 94, 112])
eventsTable = Card([eventsHeader, liveEventsTable], "card", "column", "m")
eventsHeader = Heading("Live Events", "h3")
liveEventsTable = Table([eventNameCol, eventStatusCol, eventStartCol, eventEndCol])
eventNameCol = Col("Event", ["Summer Festival", "Double XP Weekend", "New Hero Launch", "Anniversary Celebration", "Halloween Spooktacular"])
eventStatusCol = Col("Status", ["Running", "Running", "Upcoming", "Upcoming", "Upcoming"])
eventStartCol = Col("Start", ["Jul 15", "Jul 19", "Jul 22", "Aug 1", "Oct 25"])
eventEndCol = Col("End", ["Aug 15", "Jul 21", "Aug 5", "Aug 15", "Nov 8"])
experimentsRow = Card([expHeader, expCardA, expCardB], "clear", "column", "m")
expHeader = Heading("Running Experiments", "h3")
expCardA = Card([expATitle, expADesc, expAMetrics, expAAction], "card", "column", "m")
expATitle = TextContent("Experiment A: Matchmaking Algorithm v2", "large-heavy")
expADesc = TextContent("Testing skill-based matchmaking with reduced queue times vs current hybrid system. 50/50 split, running 14 days.", "default")
expAMetrics = Card([expAMetricRow], "clear", "row", "m")
expAMetricRow = Card([expARetention, expAQueue, expASatisfaction], "clear", "row", "m", "stretch", "between")
expARetention = Card([retLabel, retValue], "card", "column", "xs", "center")
retLabel = TextContent("Day-7 Retention", "small")
retValue = TextContent("+2.3% △", "default")
expAQueue = Card([queueLabel, queueValue], "card", "column", "xs", "center")
queueLabel = TextContent("Avg Queue Time", "small")
queueValue = TextContent("-18s ▽", "default")
expASatisfaction = Card([satLabel, satValue], "card", "column", "xs", "center")
satLabel = TextContent("Match Quality Score", "small")
satValue = TextContent("+4.1% △", "default")
expAAction = Buttons([expAApply, expAExtend])
expAApply = Button("Apply to All", null, "primary")
expAExtend = Button("Extend Experiment", null, "secondary")
expCardB = Card([expBTitle, expBDesc, expBMetrics, expBAction], "card", "column", "m")
expBTitle = TextContent("Experiment B: Daily Reward Structure", "large-heavy")
expBDesc = TextContent("Comparing linear reward progression (control) vs streak-based escalating rewards (variant). 50/50 split, running 21 days.", "default")
expBMetrics = Card([expBMetricRow], "clear", "row", "m")
expBMetricRow = Card([expBRetention, expBEngagement, expBRevenue], "clear", "row", "m", "stretch", "between")
expBRetention = Card([retLabelB, retValueB], "card", "column", "xs", "center")
retLabelB = TextContent("Day-14 Retention", "small")
retValueB = TextContent("+1.8% △", "default")
expBEngagement = Card([engLabel, engValue], "card", "column", "xs", "center")
engLabel = TextContent("Daily Sessions/User", "small")
engValue = TextContent("+0.3 △", "default")
expBRevenue = Card([revLabelB, revValueB], "card", "column", "xs", "center")
revLabelB = TextContent("ARPU Impact", "small")
revValueB = TextContent("+$0.07 △", "default")
expBAction = Buttons([expBApply, expBExtend])
expBApply = Button("Apply to All", null, "primary")
expBExtend = Button("Extend Experiment", null, "secondary")
actionsRow = Card([regionFocus, patchNotesForm, hotfixForm], "clear", "row", "l", "stretch", "between")
regionFocus = Card([focusHeader, focusSelect, focusBtn], "card", "column", "m")
focusHeader = Heading("Focus Region", "h3")
focusSelect = Select("region_focus", [focusUSEast, focusUSWest, focusEUCentral, focusEUWest, focusAPSE, focusAPNE, focusSAEast, focusMECentral], "Select a region to drill down")
focusUSEast = SelectItem("us-east", "US-East (52,340 players)")
focusUSWest = SelectItem("us-west", "US-West (38,210 players)")
focusEUCentral = SelectItem("eu-central", "EU-Central (45,670 players) — Degraded")
focusEUWest = SelectItem("eu-west", "EU-West (29,840 players)")
focusAPSE = SelectItem("ap-southeast", "AP-Southeast (61,230 players)")
focusAPNE = SelectItem("ap-northeast", "AP-Northeast (18,920 players) — Critical")
focusSAEast = SelectItem("sa-east", "SA-East (12,450 players)")
focusMECentral = SelectItem("me-central", "ME-Central (8,760 players)")
focusBtn = Buttons([focusGo])
focusGo = Button("Open Region Detail", null, "primary")
patchNotesForm = Card([patchHeader, patchForm], "card", "column", "m")
patchHeader = Heading("Draft Patch Notes", "h3")
patchForm = Form("patch-notes", patchButtons, [patchVersionField, patchTitleField, patchBodyField])
patchVersionField = FormControl("Version", patchVersionInput, "e.g., 3.2.2")
patchVersionInput = Input("version", "3.2.2")
patchTitleField = FormControl("Title", patchTitleInput, "Short summary")
patchTitleInput = Input("title", "Hotfix: Crash Fixes & Balance")
patchBodyField = FormControl("Notes (Markdown)", patchBodyArea, "Use markdown. Will be published to players.")
patchBodyArea = TextArea("body", "## Fixed\n- Crash on launch for v3.2.1 (iOS)\n- Matchmaking timeout in EU-Central\n\n## Balance\n- Phoenix skin VFX visibility adjusted\n- XP boost duration corrected", 8)
patchButtons = Buttons([patchSave, patchPublish])
patchSave = Button("Save Draft", null, "secondary")
patchPublish = Button("Publish", null, "primary")
hotfixForm = Card([hotfixHeader, hotfixFormInner], "card", "column", "m")
hotfixHeader = Heading("Ship Hotfix", "h3")
hotfixFormInner = Form("hotfix-deploy", hotfixButtons, [hotfixVersionField, hotfixDescField, hotfixTargetField, hotfixConfirmField])
hotfixVersionField = FormControl("Hotfix Version", hotfixVersionInput, "Auto-increments from current")
hotfixVersionInput = Input("hotfix_version", "3.2.2-hotfix.1")
hotfixDescField = FormControl("Description", hotfixDescArea, "What does this hotfix address?")
hotfixDescArea = TextArea("hotfix_desc", "Critical crash fix for iOS launch + EU-Central matchmaking timeout resolution", 4)
hotfixTargetField = FormControl("Target Regions", hotfixTargetSelect, "Select regions or leave blank for global")
hotfixTargetSelect = Select("hotfix_regions", [hotfixGlobal, hotfixUSEast, hotfixUSWest, hotfixEUCentral, hotfixEUWest, hotfixAPSE, hotfixAPNE, hotfixSAEast, hotfixMECentral], "All regions (global)")
hotfixGlobal = SelectItem("global", "All Regions (Global)")
hotfixUSEast = SelectItem("us-east", "US-East")
hotfixUSWest = SelectItem("us-west", "US-West")
hotfixEUCentral = SelectItem("eu-central", "EU-Central")
hotfixEUWest = SelectItem("eu-west", "EU-West")
hotfixAPSE = SelectItem("ap-southeast", "AP-Southeast")
hotfixAPNE = SelectItem("ap-northeast", "AP-Northeast")
hotfixSAEast = SelectItem("sa-east", "SA-East")
hotfixMECentral = SelectItem("me-central", "ME-Central")
hotfixConfirmField = FormControl("Confirmation", hotfixConfirmCheck, "Type 'DEPLOY' to confirm")
hotfixConfirmCheck = Input("confirm", "", "text", null, null, "DEPLOY")
hotfixButtons = Buttons([hotfixCancel, hotfixDeploy])
hotfixCancel = Button("Cancel", null, "tertiary")
hotfixDeploy = Button("Deploy Hotfix", null, "primary", "destructive")