root = Card([header, categoryFilter, draftsSection, publishedSection, topArticleSection, readershipChart, scheduleSection, commentsSection, newDraftAction], "card", "column", "l")

header = CardHeader("Content Studio", "Manage drafts, published pieces, and engagement")

categoryFilter = Card([filterLabel, categorySelect], "clear", "row", "m", "center")
filterLabel = TextContent("Filter by category:", "small-heavy")
categorySelect = Select("category_filter", categoryOptions, "All categories", null, "medium")
categoryOptions = [optAll, optTech, optBusiness, optDesign, optMarketing, optScience]
optAll = SelectItem("all", "All categories")
optTech = SelectItem("tech", "Technology")
optBusiness = SelectItem("business", "Business")
optDesign = SelectItem("design", "Design")
optMarketing = SelectItem("marketing", "Marketing")
optScience = SelectItem("science", "Science")

draftsSection = Card([draftsHeader, draftsTable], "sunk", "column", "m")
draftsHeader = Heading("Drafts", "h3")
draftsTable = Table([draftTitleCol, draftStatusCol, draftCategoryCol, draftUpdatedCol])
draftTitleCol = Col("Title", ["The Future of AI in Healthcare", "Sustainable Supply Chains", "Design Systems at Scale", "Remote Team Culture", "Quantum Computing Basics"])
draftStatusCol = Col("Status", ["In Review", "Editing", "Draft", "Needs Revision", "Ready to Schedule"])
draftCategoryCol = Col("Category", ["Tech", "Business", "Design", "Business", "Science"])
draftUpdatedCol = Col("Last Updated", ["2 hours ago", "Yesterday", "3 days ago", "1 week ago", "5 hours ago"])

publishedSection = Card([publishedHeader, publishedTable], "sunk", "column", "m")
publishedHeader = Heading("Published This Week", "h3")
publishedTable = Table([pubTitleCol, pubCategoryCol, pubDateCol, pubViewsCol])
pubTitleCol = Col("Title", ["AI Ethics in Practice", "Green Energy Investments", "Typography Trends 2024", "Leadership in Hybrid Work", "Climate Tech Breakthroughs"])
pubCategoryCol = Col("Category", ["Tech", "Business", "Design", "Business", "Science"])
pubDateCol = Col("Published", ["Mon", "Tue", "Wed", "Thu", "Fri"])
pubViewsCol = Col("Views", [12400, 8900, 15600, 7200, 11300])

topArticleSection = Card([topHeader, topArticleCard], "sunk", "column", "m")
topHeader = Heading("Most-Read Article This Month", "h3")
topArticleCard = Card([topTitle, topMeta, topStats, topExcerpt], "clear", "column", "s")
topTitle = TextContent("The Future of AI in Healthcare: Transforming Patient Outcomes", "large-heavy")
topMeta = TextContent("Technology • Published March 3 • 12 min read", "small")
topStats = Card([statViews, statReadTime, statEngagement], "clear", "row", "l", "center")
statViews = TextContent("247K Views", "large-heavy")
statReadTime = TextContent("8:42 Avg Read", "default")
statEngagement = TextContent("12.3% Engagement", "default")
topExcerpt = TextContent("Exploring how machine learning models are revolutionizing diagnostics, personalized treatment plans, and drug discovery — and what this means for the future of medicine.", "default")

readershipChart = Card([chartHeader, chart], "sunk", "column", "m")
chartHeader = Heading("Readership (Past 30 Days)", "h3")
chart = LineChart(chartLabels, [chartSeries], "natural", "Date", "Views")
chartLabels = ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13", "Mar 14", "Mar 15", "Mar 16", "Mar 17", "Mar 18", "Mar 19", "Mar 20", "Mar 21", "Mar 22", "Mar 23", "Mar 24", "Mar 25", "Mar 26", "Mar 27", "Mar 28", "Mar 29", "Mar 30", "Mar 31"]
chartSeries = Series("Daily Views", [8200, 7900, 9100, 8500, 7800, 12400, 11200, 9800, 8700, 9200, 10500, 11800, 13200, 14100, 12800, 11900, 15600, 14800, 13500, 12200, 10800, 9800, 11200, 12800, 14500, 16200, 15800, 14200, 13100, 11900])

scheduleSection = Card([scheduleHeader, scheduleForm], "sunk", "column", "m")
scheduleHeader = Heading("Schedule a Piece", "h3")
scheduleForm = Form("schedule-piece", scheduleButtons, [titleField, dateField, categoryField])
titleField = FormControl("Article Title", titleInput, "Enter the piece title")
titleInput = Input("title", "e.g., The Rise of Quantum Computing", "text", null, "")
dateField = FormControl("Publish Date", datePicker, "Select when to publish")
datePicker = DatePicker("publish_date", "single", null, [])
categoryField = FormControl("Category", scheduleCategorySelect, "Choose a category")
scheduleCategorySelect = Select("schedule_category", scheduleCategoryOptions, "Select category", null, "medium")
scheduleCategoryOptions = [schedOptTech, schedOptBusiness, schedOptDesign, schedOptMarketing, schedOptScience]
schedOptTech = SelectItem("tech", "Technology")
schedOptBusiness = SelectItem("business", "Business")
schedOptDesign = SelectItem("design", "Design")
schedOptMarketing = SelectItem("marketing", "Marketing")
schedOptScience = SelectItem("science", "Science")
scheduleButtons = Buttons([scheduleBtn, cancelBtn])
scheduleBtn = Button("Schedule", null, "primary")
cancelBtn = Button("Cancel", null, "tertiary")

commentsSection = Card([commentsHeader, commentsList], "sunk", "column", "m")
commentsHeader = Heading("Comments Awaiting Reply (8)", "h3")
commentsList = ListBlock(commentItems, "number")
commentItems = [comment1, comment2, comment3, comment4, comment5]
comment1 = ListItem("Sarah Chen on \"AI Ethics in Practice\"", "Great insights! How do you see regulation evolving in the next 2 years?", null, "Reply")
comment2 = ListItem("Marcus Johnson on \"Green Energy Investments\"", "Would love to see a follow-up on storage solutions.", null, "Reply")
comment3 = ListItem("Emma Rodriguez on \"Typography Trends 2024\"", "The variable fonts section was particularly helpful for our redesign.", null, "Reply")
comment4 = ListItem("David Park on \"Leadership in Hybrid Work\"", "Any tips for maintaining culture with globally distributed teams?", null, "Reply")
comment5 = ListItem("Lisa Thompson on \"Climate Tech Breakthroughs\"", "Fascinating piece. What's the biggest barrier to adoption right now?", null, "Reply")

newDraftAction = Card([newDraftBtn], "clear", "row", "m", "center")
newDraftBtn = Button("+ Start New Draft", null, "primary", "normal", "large")