root = Card([header, kpiBlock, filterForm, ordersHeader, ordersTable, volumeHeader, volumeChart, followUps])
header = CardHeader("E-Commerce Operations Desk", "Real-time order management · Updated just now")
kpiBlock = SnippetCardBlock([kpiOrders, kpiRevenue, kpiAov, kpiRefund], "grid", true)
kpiOrders = SnippetCardItem("orders-today", kpiOrdersLhs, kpiOrdersRhs)
kpiOrdersLhs = IconText(kpiOrdersIcon, "neutral", "m", "Orders Today", "Since midnight", false, "horizontal")
kpiOrdersIcon = Icon("shopping-cart", "commerce")
kpiOrdersRhs = BoldText("number", "147", "+12 vs. yesterday", "metric")
kpiRevenue = SnippetCardItem("revenue-today", kpiRevenueLhs, kpiRevenueRhs)
kpiRevenueLhs = IconText(kpiRevenueIcon, "neutral", "m", "Revenue Today", "Gross sales", false, "horizontal")
kpiRevenueIcon = Icon("circle-dollar-sign", "finance")
kpiRevenueRhs = BoldText("number", "$42,350", "+8.4% vs. yesterday", "metric")
kpiAov = SnippetCardItem("aov-today", kpiAovLhs, kpiAovRhs)
kpiAovLhs = IconText(kpiAovIcon, "neutral", "m", "Avg. Order Value", "Today's mean", false, "horizontal")
kpiAovIcon = Icon("calculator", "tools")
kpiAovRhs = BoldText("number", "$288.10", "+$14 vs. 7-day avg", "metric")
kpiRefund = SnippetCardItem("refund-rate", kpiRefundLhs, kpiRefundRhs)
kpiRefundLhs = IconText(kpiRefundIcon, "neutral", "m", "Refund Rate (MTD)", "Month to date", false, "horizontal")
kpiRefundIcon = Icon("rotate-ccw", "arrows")
kpiRefundRhs = BoldText("number", "2.3%", "-0.4 pp vs. last month", "metric")
filterForm = Form("order-filters", filterButtons, [fcStatus, fcSearch])
filterButtons = Buttons([btnApply, btnClear], "row")
btnApply = Button("Apply Filters", { type: "continue_conversation", context: "Apply the selected status filter and customer search to the orders table" }, "primary")
btnClear = Button("Clear", { type: "continue_conversation", context: "Clear all filters and show all recent orders" }, "secondary")
fcStatus = FormControl("Filter by Status", statusSelect, "Narrow the order list to a specific fulfillment state")
statusSelect = Select("status-filter", [stAll, stPending, stProcessing, stShipped, stDelivered, stCancelled, stRefunded], "All statuses")
stAll = SelectItem("", "All")
stPending = SelectItem("pending", "Pending")
stProcessing = SelectItem("processing", "Processing")
stShipped = SelectItem("shipped", "Shipped")
stDelivered = SelectItem("delivered", "Delivered")
stCancelled = SelectItem("cancelled", "Cancelled")
stRefunded = SelectItem("refunded", "Refunded")
fcSearch = FormControl("Search Customer", searchInput, "Type a name or email — filters as you type")
searchInput = Input("customer-search", "e.g. sarah.jones@email.com", "text")
ordersHeader = InlineHeader("Recent Orders", "Latest 10 orders — click Mark Fulfilled to advance status")
ordersTable = Table([colId, colCustomer, colTotal, colStatus, colAction])
colId = Col("Order ID", orderIds, "string")
colCustomer = Col("Customer", customers, "string")
colTotal = Col("Total", totals, "number")
colStatus = Col("Status", statuses, "string")
colAction = Col("Action", actions, "action")
orderIds = ["ORD-20260415-001", "ORD-20260415-002", "ORD-20260415-003", "ORD-20260415-004", "ORD-20260415-005", "ORD-20260415-006", "ORD-20260415-007", "ORD-20260415-008", "ORD-20260415-009", "ORD-20260415-010"]
customers = ["Sarah Jones", "Michael Chen", "Emma Williams", "David Rodriguez", "Lisa Thompson", "James Anderson", "Maria Garcia", "Robert Kim", "Jennifer Lee", "Thomas Brown"]
totals = [349.99, 127.50, 899.00, 215.75, 67.99, 1,245.00, 312.40, 89.99, 567.80, 199.95]
statuses = ["Processing", "Pending", "Shipped", "Processing", "Delivered", "Pending", "Processing", "Shipped", "Processing", "Pending"]
actions = ["Mark Fulfilled", "Mark Fulfilled", "Mark Fulfilled", "Mark Fulfilled", "—", "Mark Fulfilled", "Mark Fulfilled", "Mark Fulfilled", "Mark Fulfilled", "Mark Fulfilled"]
volumeHeader = InlineHeader("Order Volume — Last 4 Weeks", "Weekly order count trend")
volumeChart = BarChart(weekLabels, [volumeSeries], "grouped", "Week", "Orders")
weekLabels = ["Week 1 (Mar 18–24)", "Week 2 (Mar 25–31)", "Week 3 (Apr 1–7)", "Week 4 (Apr 8–14)"]
volumeSeries = Series("Orders", [892, 1,045, 1,187, 1,234])
followUps = FollowUpBlock([fu1, fu2, fu3])
fu1 = FollowUpItem("Show me orders needing attention")
fu2 = FollowUpItem("Export today's orders to CSV")
fu3 = FollowUpItem("Set up low-stock alerts for top SKUs")