<?php  if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $today_orders = (int)Database::scalar("SELECT COUNT(*) FROM orders WHERE DATE(created_at) = CURDATE()"); $pending = (int)Database::scalar("SELECT COUNT(*) FROM orders WHERE status_code = 2001"); $active_listings = (int)Database::scalar("SELECT COUNT(*) FROM products WHERE status_code = 3002"); $open_tickets = (int)Database::scalar("SELECT COUNT(DISTINCT user_id) FROM support_messages WHERE is_read = 0 AND is_admin = 0"); $customers = (int)Database::scalar("SELECT COUNT(*) FROM users WHERE admin_level = 0"); ?> <div id="kpi-grid" class="kpi-grid"> <div class="kpi-card"><span class="kpi-value"><?= $today_orders ?> </span><span class="kpi-label">Orders Today</span></div> <div class="kpi-card kpi-warning"><span class="kpi-value"><?= $pending ?> </span><span class="kpi-label">Pending</span></div> <div class="kpi-card"><span class="kpi-value"><?= $active_listings ?> </span><span class="kpi-label">Active Listings</span></div> <div class="kpi-card"><span class="kpi-value"><?= $open_tickets ?> </span><span class="kpi-label">Open Tickets</span></div> <div class="kpi-card"><span class="kpi-value"><?= $customers ?> </span><span class="kpi-label">Customers</span></div> </div>