<?php
/**
 * Dashboard section for Noesia Smart Waiter.
 *
 * @package Noesia_Smart_Waiter
 */
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! function_exists( 'noesia_swa_dashboard_render_registry_area' ) ) {
	/**
	 * Render non-legacy dashboard widgets for a specific area.
	 *
	 * @param Noesia_SWA_Dashboard_Widgets|null $registry Registry instance.
	 * @param string                            $area     Area slug.
	 * @return void
	 */
	function noesia_swa_dashboard_render_registry_area( $registry, $area ) {
		if ( ! ( $registry instanceof Noesia_SWA_Dashboard_Widgets ) ) {
			return;
		}

		$widgets = $registry->get_widgets_by_area( $area );
		if ( empty( $widgets ) ) {
			return;
		}

		foreach ( $widgets as $widget ) {
			if ( ! is_array( $widget ) ) {
				continue;
			}

			$source = isset( $widget['source'] ) ? sanitize_key( (string) $widget['source'] ) : 'core';
			if ( 'legacy' === $source ) {
				continue;
			}

			$capability = isset( $widget['capability'] ) ? sanitize_key( (string) $widget['capability'] ) : 'manage_options';
			if ( ! current_user_can( $capability ) ) {
				continue;
			}

			$callback = isset( $widget['callback'] ) ? $widget['callback'] : null;
			if ( ! is_callable( $callback ) ) {
				continue;
			}

			$callback_args = array();
			if ( ! empty( $widget['callback_args'] ) && is_array( $widget['callback_args'] ) ) {
				$callback_args = $widget['callback_args'];
			}

			echo '<div class="noesia-card noesia-swa-dashboard-widget" data-noesia-swa-widget="' . esc_attr( isset( $widget['id'] ) ? (string) $widget['id'] : '' ) . '">';

			if ( ! empty( $widget['title'] ) ) {
				echo '<div class="noesia-swa-card-header"><div><h3>' . esc_html( (string) $widget['title'] ) . '</h3></div></div>';
			}

			echo '<div class="noesia-swa-card-body">';
			call_user_func_array( $callback, $callback_args );
			echo '</div>';
			echo '</div>';
		}
	}
}

$noesia_swa_options = get_option( 'noesia_swa_options', array() );
if ( ! is_array( $noesia_swa_options ) ) {
	$noesia_swa_options = array();
}

$noesia_swa_dashboard_context_defaults = array(
	'host_name'                    => '',
	'business_name'                => '',
	'business_type'                => '',
	'profile_address'              => '',
	'profile_phone'                => '',
	'profile_email'                => '',
	'profile_website'              => '',
	'profile_tax_id'               => '',
	'profile_reg_no'               => '',
	'briefing_enabled'             => 'yes',
	'briefing_updates'             => 'yes',
	'briefing_schedule'            => 'yes',
	'current_hour'                 => (int) current_time( 'G' ),
	'greeting_text'                => __( 'Good day', 'noesia-smart-waiter' ),
	'today_requests_count'         => 0,
	'briefing_updates_text'        => __( '0 Active Requests', 'noesia-smart-waiter' ),
	'dashboard_active_badge_type'   => 'requests',
	'dashboard_active_badge_visible' => true,
	'dashboard_active_badge_count'  => 0,
	'dashboard_active_badge_label'  => __( 'Active Requests', 'noesia-smart-waiter' ),
	'dashboard_active_badge_text'   => __( '0 Active Requests', 'noesia-smart-waiter' ),
	'dashboard_active_badge_target' => 'design',
	'briefing_schedule_count'      => '0',
	'briefing_schedule_label'      => __( 'Appointments today', 'noesia-smart-waiter' ),
	'profile_business_text'        => __( 'Not set yet', 'noesia-smart-waiter' ),
	'profile_contact_text'         => __( 'Not set yet', 'noesia-smart-waiter' ),
	'profile_legal_text'           => __( 'Not set yet', 'noesia-smart-waiter' ),
	'weather_bundle'               => array(
		'place'            => '',
		'units'            => 'metric',
		'units_label'      => '°C',
		'now_label'        => '—',
		'condition'        => '',
		'tip'              => __( 'Have a great day.', 'noesia-smart-waiter' ),
		'today_label'      => __( 'Today', 'noesia-smart-waiter' ),
		'min_text'         => __( 'Min', 'noesia-smart-waiter' ),
		'max_text'         => __( 'Max', 'noesia-smart-waiter' ),
		'rain_text'        => __( 'Rain', 'noesia-smart-waiter' ),
		'today_min_label'  => '—',
		'today_max_label'  => '—',
		'today_rain_label' => '—',
		'days'             => array(),
		'error'            => '',
	),
	'forecast_days'                => array(),
	'dashboard_language'           => 'en',
	'world_my_world'               => array(
		'place'             => '',
		'now_label'         => '—',
		'condition'         => '',
		'tip'               => __( 'Have a great day.', 'noesia-smart-waiter' ),
		'min_label'         => '—',
		'max_label'         => '—',
		'rain_label'        => '—',
		'sunrise_label'     => '—',
		'sunset_label'      => '—',
		'air_quality_label' => 'AQI —',
		'alert_title'       => __( 'Steady service window', 'noesia-smart-waiter' ),
		'alert_text'        => __( 'Conditions look balanced. Keep your usual service flow and stay ready for standard requests.', 'noesia-smart-waiter' ),
		'alert_level'       => 'calm',
		'source_label'      => 'Open-Meteo',
		'updated_label'     => '—',
	),
	'world_earthquakes'            => array(
		'source_label'  => 'USGS',
		'updated_label' => '—',
		'count_24h'     => 0,
		'largest_label' => '—',
		'largest_place' => __( 'No earthquake data yet.', 'noesia-smart-waiter' ),
		'items'         => array(),
	),
	'world_events'                 => array(
		'source_label'  => 'GDACS',
		'updated_label' => '—',
		'count'         => 0,
		'items'         => array(),
	),
	'world_iss'                    => array(
		'source_label'   => 'wheretheiss.at',
		'updated_label'  => '—',
		'has_position'   => false,
		'lat'            => null,
		'lng'            => null,
		'altitude_label' => '—',
		'velocity_label' => '—',
		'visibility'     => '—',
		'region_label'   => __( 'Live orbit unavailable right now', 'noesia-smart-waiter' ),
	),
	'world_window'                 => array(
		'title'        => __( 'ISS Live', 'noesia-smart-waiter' ),
		'description'  => __( 'Live ISS telemetry with a direct path to the official NASA Live page.', 'noesia-smart-waiter' ),
		'source_label' => __( 'Official NASA Live', 'noesia-smart-waiter' ),
		'window_label' => __( 'Live orbit unavailable right now', 'noesia-smart-waiter' ),
		'watch_url'    => 'https://www.nasa.gov/live/',
		'watch_label'  => __( 'Open NASA Live', 'noesia-smart-waiter' ),
	),
	'world_sky_watch'              => array(
		'timezone_label'   => __( 'Local time', 'noesia-smart-waiter' ),
		'sunrise_label'    => '—',
		'sunset_label'     => '—',
		'day_length_label' => '—',
		'moon_phase_label' => '—',
		'next_cycle_label' => __( 'Solar cycle ready', 'noesia-smart-waiter' ),
	),
	'world_clocks'                 => array(),
	'world_map_points'             => array(),
	'world_live_stream'            => array(),
	'dashboard_active_requests'    => 0,
	'dashboard_today_appointments' => 0,
	'business_pulse_title'         => __( 'Steady service window', 'noesia-smart-waiter' ),
	'business_pulse_text'          => __( 'Conditions look balanced. Keep your usual service flow and stay ready for standard requests.', 'noesia-smart-waiter' ),
	'dashboard_system_health'      => __( '🟢 Online & Ready', 'noesia-smart-waiter' ),
	'dashboard_activity_status'    => __( '☕ Quiet / Open', 'noesia-smart-waiter' ),
	'dashboard_orders_status'      => __( '0 pending', 'noesia-smart-waiter' ),
	'business_pulse_kicker'       => __( 'SMART AI ALERT', 'noesia-smart-waiter' ),
	'business_pulse_heading'      => __( 'Business Pulse', 'noesia-smart-waiter' ),
	'business_pulse_status_label' => __( 'Live Operational Status:', 'noesia-smart-waiter' ),
	'business_pulse_intro'        => __( 'Real-time monitoring of system health, activity and local conditions.', 'noesia-smart-waiter' ),
	'business_pulse_local_conditions_label' => __( 'Local Conditions', 'noesia-smart-waiter' ),
	'business_pulse_system_health_label' => __( 'System Health', 'noesia-smart-waiter' ),
	'business_pulse_daily_activity_label' => __( 'Daily Activity', 'noesia-smart-waiter' ),
	'business_pulse_live_orders_label' => __( 'Live Orders', 'noesia-smart-waiter' ),
	'global_pulse_kicker'         => __( 'GLOBAL PULSE', 'noesia-smart-waiter' ),
	'global_pulse_heading'        => __( 'Global Pulse', 'noesia-smart-waiter' ),
	'global_pulse_next_label'     => __( 'Next notable date:', 'noesia-smart-waiter' ),
	'global_pulse_intro'          => __( 'Planet observances.', 'noesia-smart-waiter' ),
	'dashboard_next_notable'       => array(
		'date_label' => __( '—', 'noesia-smart-waiter' ),
		'title'      => __( 'No notable date available.', 'noesia-smart-waiter' ),
	),
);

$noesia_swa_dashboard_data_service = null;
if ( function_exists( 'noesia_swa' ) ) {
	$noesia_swa_plugin = noesia_swa();
	if ( is_object( $noesia_swa_plugin ) ) {
		$noesia_swa_dashboard_data_service = $noesia_swa_plugin->dashboard_data;
	}
}

if ( ! ( $noesia_swa_dashboard_data_service instanceof Noesia_SWA_Dashboard_Data ) && class_exists( 'Noesia_SWA_Dashboard_Data' ) ) {
	$noesia_swa_dashboard_data_service = new Noesia_SWA_Dashboard_Data();
}

$noesia_swa_dashboard_context = $noesia_swa_dashboard_context_defaults;
if ( $noesia_swa_dashboard_data_service instanceof Noesia_SWA_Dashboard_Data ) {
	$noesia_swa_dashboard_context = wp_parse_args(
		$noesia_swa_dashboard_data_service->build_context( $noesia_swa_options ),
		$noesia_swa_dashboard_context_defaults
	);
}

$host_name                             = isset( $noesia_swa_dashboard_context['host_name'] ) ? (string) $noesia_swa_dashboard_context['host_name'] : '';
$business_name                         = isset( $noesia_swa_dashboard_context['business_name'] ) ? (string) $noesia_swa_dashboard_context['business_name'] : '';
$business_type                         = isset( $noesia_swa_dashboard_context['business_type'] ) ? (string) $noesia_swa_dashboard_context['business_type'] : '';
$profile_address                       = isset( $noesia_swa_dashboard_context['profile_address'] ) ? (string) $noesia_swa_dashboard_context['profile_address'] : '';
$profile_phone                         = isset( $noesia_swa_dashboard_context['profile_phone'] ) ? (string) $noesia_swa_dashboard_context['profile_phone'] : '';
$profile_email                         = isset( $noesia_swa_dashboard_context['profile_email'] ) ? (string) $noesia_swa_dashboard_context['profile_email'] : '';
$profile_website                       = isset( $noesia_swa_dashboard_context['profile_website'] ) ? (string) $noesia_swa_dashboard_context['profile_website'] : '';
$profile_tax_id                        = isset( $noesia_swa_dashboard_context['profile_tax_id'] ) ? (string) $noesia_swa_dashboard_context['profile_tax_id'] : '';
$profile_reg_no                        = isset( $noesia_swa_dashboard_context['profile_reg_no'] ) ? (string) $noesia_swa_dashboard_context['profile_reg_no'] : '';
$briefing_enabled                      = isset( $noesia_swa_dashboard_context['briefing_enabled'] ) ? (string) $noesia_swa_dashboard_context['briefing_enabled'] : 'yes';
$briefing_updates                      = isset( $noesia_swa_dashboard_context['briefing_updates'] ) ? (string) $noesia_swa_dashboard_context['briefing_updates'] : 'yes';
$briefing_schedule                     = isset( $noesia_swa_dashboard_context['briefing_schedule'] ) ? (string) $noesia_swa_dashboard_context['briefing_schedule'] : 'yes';
$current_hour                          = isset( $noesia_swa_dashboard_context['current_hour'] ) ? (int) $noesia_swa_dashboard_context['current_hour'] : (int) current_time( 'G' );
$greeting_text                         = isset( $noesia_swa_dashboard_context['greeting_text'] ) ? (string) $noesia_swa_dashboard_context['greeting_text'] : __( 'Good day', 'noesia-smart-waiter' );
$today_requests_count                  = isset( $noesia_swa_dashboard_context['today_requests_count'] ) ? (int) $noesia_swa_dashboard_context['today_requests_count'] : 0;
$briefing_updates_text                 = isset( $noesia_swa_dashboard_context['briefing_updates_text'] ) ? (string) $noesia_swa_dashboard_context['briefing_updates_text'] : __( '0 Active Requests', 'noesia-smart-waiter' );
$dashboard_active_badge_type           = isset( $noesia_swa_dashboard_context['dashboard_active_badge_type'] ) ? (string) $noesia_swa_dashboard_context['dashboard_active_badge_type'] : 'requests';
$dashboard_active_badge_visible        = ! empty( $noesia_swa_dashboard_context['dashboard_active_badge_visible'] );
$dashboard_active_badge_count          = isset( $noesia_swa_dashboard_context['dashboard_active_badge_count'] ) ? (int) $noesia_swa_dashboard_context['dashboard_active_badge_count'] : 0;
$dashboard_active_badge_label          = isset( $noesia_swa_dashboard_context['dashboard_active_badge_label'] ) ? (string) $noesia_swa_dashboard_context['dashboard_active_badge_label'] : __( 'Active Requests', 'noesia-smart-waiter' );
$dashboard_active_badge_text           = isset( $noesia_swa_dashboard_context['dashboard_active_badge_text'] ) ? (string) $noesia_swa_dashboard_context['dashboard_active_badge_text'] : __( '0 Active Requests', 'noesia-smart-waiter' );
$dashboard_active_badge_target         = isset( $noesia_swa_dashboard_context['dashboard_active_badge_target'] ) ? (string) $noesia_swa_dashboard_context['dashboard_active_badge_target'] : 'design';
$briefing_schedule_count               = isset( $noesia_swa_dashboard_context['briefing_schedule_count'] ) ? (string) $noesia_swa_dashboard_context['briefing_schedule_count'] : '0';
$briefing_schedule_label               = isset( $noesia_swa_dashboard_context['briefing_schedule_label'] ) ? (string) $noesia_swa_dashboard_context['briefing_schedule_label'] : __( 'Appointments today', 'noesia-smart-waiter' );
$profile_business_text                 = isset( $noesia_swa_dashboard_context['profile_business_text'] ) ? (string) $noesia_swa_dashboard_context['profile_business_text'] : __( 'Not set yet', 'noesia-smart-waiter' );
$profile_contact_text                  = isset( $noesia_swa_dashboard_context['profile_contact_text'] ) ? (string) $noesia_swa_dashboard_context['profile_contact_text'] : __( 'Not set yet', 'noesia-smart-waiter' );
$profile_legal_text                    = isset( $noesia_swa_dashboard_context['profile_legal_text'] ) ? (string) $noesia_swa_dashboard_context['profile_legal_text'] : __( 'Not set yet', 'noesia-smart-waiter' );
$weather_bundle                        = isset( $noesia_swa_dashboard_context['weather_bundle'] ) && is_array( $noesia_swa_dashboard_context['weather_bundle'] ) ? $noesia_swa_dashboard_context['weather_bundle'] : array();
$forecast_days                         = isset( $noesia_swa_dashboard_context['forecast_days'] ) && is_array( $noesia_swa_dashboard_context['forecast_days'] ) ? $noesia_swa_dashboard_context['forecast_days'] : array();
$world_forecast_days                   = array_slice( $forecast_days, 0, 3 );
$dashboard_language                    = isset( $noesia_swa_dashboard_context['dashboard_language'] ) ? (string) $noesia_swa_dashboard_context['dashboard_language'] : 'en';
$world_live_enabled                    = ! empty( $noesia_swa_dashboard_context['world_live_enabled'] );
$world_my_world                        = isset( $noesia_swa_dashboard_context['world_my_world'] ) && is_array( $noesia_swa_dashboard_context['world_my_world'] ) ? $noesia_swa_dashboard_context['world_my_world'] : array();
$world_earthquakes                     = isset( $noesia_swa_dashboard_context['world_earthquakes'] ) && is_array( $noesia_swa_dashboard_context['world_earthquakes'] ) ? $noesia_swa_dashboard_context['world_earthquakes'] : array();
$world_events                          = isset( $noesia_swa_dashboard_context['world_events'] ) && is_array( $noesia_swa_dashboard_context['world_events'] ) ? $noesia_swa_dashboard_context['world_events'] : array();
$world_iss                             = isset( $noesia_swa_dashboard_context['world_iss'] ) && is_array( $noesia_swa_dashboard_context['world_iss'] ) ? $noesia_swa_dashboard_context['world_iss'] : array();
$world_window                          = isset( $noesia_swa_dashboard_context['world_window'] ) && is_array( $noesia_swa_dashboard_context['world_window'] ) ? $noesia_swa_dashboard_context['world_window'] : array();
$world_sky_watch                       = isset( $noesia_swa_dashboard_context['world_sky_watch'] ) && is_array( $noesia_swa_dashboard_context['world_sky_watch'] ) ? $noesia_swa_dashboard_context['world_sky_watch'] : array();
$world_clocks                          = isset( $noesia_swa_dashboard_context['world_clocks'] ) && is_array( $noesia_swa_dashboard_context['world_clocks'] ) ? $noesia_swa_dashboard_context['world_clocks'] : array();
$world_map_points                      = isset( $noesia_swa_dashboard_context['world_map_points'] ) && is_array( $noesia_swa_dashboard_context['world_map_points'] ) ? $noesia_swa_dashboard_context['world_map_points'] : array();
$world_live_stream                     = isset( $noesia_swa_dashboard_context['world_live_stream'] ) && is_array( $noesia_swa_dashboard_context['world_live_stream'] ) ? $noesia_swa_dashboard_context['world_live_stream'] : array();
$news_country                          = isset( $noesia_swa_dashboard_context['news_country'] ) ? strtoupper( sanitize_key( (string) $noesia_swa_dashboard_context['news_country'] ) ) : '';
$world_iss_coordinates                 = __( 'Pick a live signal on the globe', 'noesia-smart-waiter' );
$world_focus_local_label               = ! empty( $world_my_world['place'] ) ? (string) $world_my_world['place'] : __( 'My Place', 'noesia-smart-waiter' );
$world_focus_country_label             = __( 'My Country', 'noesia-smart-waiter' );
$world_focus_global_label              = __( 'Whole Planet', 'noesia-smart-waiter' );
$world_focus_default_target            = $world_focus_local_label;

if (
	isset( $world_iss['lat'], $world_iss['lng'] )
	&& is_numeric( $world_iss['lat'] )
	&& is_numeric( $world_iss['lng'] )
) {
	$world_iss_coordinates = sprintf(
		/* translators: 1: latitude, 2: longitude */
		__( '%1$s°, %2$s°', 'noesia-smart-waiter' ),
		number_format_i18n( (float) $world_iss['lat'], 1 ),
		number_format_i18n( (float) $world_iss['lng'], 1 )
	);
}

$noesia_swa_dashboard_world_locale_map = array(
	'el' => 'el-GR',
	'fr' => 'fr-FR',
	'de' => 'de-DE',
	'it' => 'it-IT',
	'es' => 'es-ES',
	'en' => 'en-US',
);
$noesia_swa_dashboard_world_locale     = isset( $noesia_swa_dashboard_world_locale_map[ $dashboard_language ] ) ? $noesia_swa_dashboard_world_locale_map[ $dashboard_language ] : determine_locale();
$noesia_swa_dashboard_world_messages   = array(
	'awaiting_brief' => __( 'Awaiting verified world brief…', 'noesia-smart-waiter' ),
	'verified_source' => __( 'Verified source', 'noesia-smart-waiter' ),
	'map_all_hidden' => __( 'All map layers are currently hidden.', 'noesia-smart-waiter' ),
	'map_no_weather' => __( 'Weather signals are waiting for the next refresh.', 'noesia-smart-waiter' ),
	'map_no_earthquake' => __( 'No earthquake signals are available right now.', 'noesia-smart-waiter' ),
	'map_no_disaster' => __( 'No major disaster signals are available right now.', 'noesia-smart-waiter' ),
	'map_no_orbit' => __( 'Orbital telemetry is temporarily unavailable.', 'noesia-smart-waiter' ),
	'map_no_signals' => __( 'No visible signals on the planet right now.', 'noesia-smart-waiter' ),
	'map_select_signal' => __( 'Select a signal to inspect it here.', 'noesia-smart-waiter' ),
	'map_coordinates' => __( 'Coordinates', 'noesia-smart-waiter' ),
	'map_world_signal' => __( 'World signal', 'noesia-smart-waiter' ),
	'map_weather' => __( 'Weather', 'noesia-smart-waiter' ),
	'map_earthquake' => __( 'Earthquake', 'noesia-smart-waiter' ),
	'map_disaster' => __( 'Disaster', 'noesia-smart-waiter' ),
	'map_orbit' => __( 'Orbit', 'noesia-smart-waiter' ),
	'world_loading' => __( 'Loading planet signals…', 'noesia-smart-waiter' ),
	'world_unavailable' => __( 'Planet signals are temporarily unavailable. Try again in a moment.', 'noesia-smart-waiter' ),
	'live_disabled' => __( 'Live world providers are currently disabled in Settings.', 'noesia-smart-waiter' ),
	'brief_disabled' => __( 'Enable Live World Data in Settings to load global briefings here.', 'noesia-smart-waiter' ),
	'clocks_disabled' => __( 'Enable Live World Data in Settings to load city time and temperature cards.', 'noesia-smart-waiter' ),
	'earth_disabled' => __( 'Enable Live World Data in Settings to load quakes, alerts and orbit telemetry.', 'noesia-smart-waiter' ),
	'earth_idle' => __( 'No live planet signals are active right now.', 'noesia-smart-waiter' ),
	'world_open_source' => __( 'Open report', 'noesia-smart-waiter' ),
	'world_focus_local' => __( 'My Place', 'noesia-smart-waiter' ),
	'world_focus_country' => __( 'My Country', 'noesia-smart-waiter' ),
	'world_focus_global' => __( 'Whole Planet', 'noesia-smart-waiter' ),
	'world_focus_search_placeholder' => __( 'Search country or city', 'noesia-smart-waiter' ),
	'world_focus_search_button' => __( 'Focus', 'noesia-smart-waiter' ),
	'world_focus_clear' => __( 'Clear', 'noesia-smart-waiter' ),
	'world_focus_hint' => __( 'Type a city or country to move the world view when matching live signals are available.', 'noesia-smart-waiter' ),
	'world_focus_no_match' => __( 'Nothing matched that search yet. Try another city or country.', 'noesia-smart-waiter' ),
	'world_focus_tracking' => __( 'Pick a live signal on the globe', 'noesia-smart-waiter' ),
	'world_brief_local' => __( 'Local and country briefing', 'noesia-smart-waiter' ),
	'world_brief_country' => __( 'Country briefing', 'noesia-smart-waiter' ),
	'world_brief_global' => __( 'Global briefing', 'noesia-smart-waiter' ),
	'planet_timeline_empty' => __( 'No planet signals are available right now.', 'noesia-smart-waiter' ),
	'world_compare_empty' => __( 'Add city names in Settings to compare them here.', 'noesia-smart-waiter' ),
	'world_compare_day' => __( 'Day', 'noesia-smart-waiter' ),
	'world_compare_night' => __( 'Night', 'noesia-smart-waiter' ),
	'world_compare_rain' => __( 'Rain', 'noesia-smart-waiter' ),
	'world_compare_wind' => __( 'Wind', 'noesia-smart-waiter' ),
	'world_compare_daylight' => __( 'Daylight', 'noesia-smart-waiter' ),
	'world_window_watch' => __( 'Open NASA Live', 'noesia-smart-waiter' ),
	'world_compare_updating' => __( 'Refreshing…', 'noesia-smart-waiter' ),
);
$dashboard_active_requests             = isset( $noesia_swa_dashboard_context['dashboard_active_requests'] ) ? (int) $noesia_swa_dashboard_context['dashboard_active_requests'] : 0;
$dashboard_today_appointments          = isset( $noesia_swa_dashboard_context['dashboard_today_appointments'] ) ? (int) $noesia_swa_dashboard_context['dashboard_today_appointments'] : 0;
$business_pulse_title                  = isset( $noesia_swa_dashboard_context['business_pulse_title'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_title'] : __( 'Steady service window', 'noesia-smart-waiter' );
$business_pulse_text                   = isset( $noesia_swa_dashboard_context['business_pulse_text'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_text'] : __( 'Conditions look balanced. Keep your usual service flow and stay ready for standard requests.', 'noesia-smart-waiter' );
$dashboard_system_health               = isset( $noesia_swa_dashboard_context['dashboard_system_health'] ) ? (string) $noesia_swa_dashboard_context['dashboard_system_health'] : __( '🟢 Online & Ready', 'noesia-smart-waiter' );
$dashboard_activity_status             = isset( $noesia_swa_dashboard_context['dashboard_activity_status'] ) ? (string) $noesia_swa_dashboard_context['dashboard_activity_status'] : __( '☕ Quiet / Open', 'noesia-smart-waiter' );
$dashboard_orders_status               = isset( $noesia_swa_dashboard_context['dashboard_orders_status'] ) ? (string) $noesia_swa_dashboard_context['dashboard_orders_status'] : __( '0 pending', 'noesia-smart-waiter' );
$business_pulse_kicker                 = isset( $noesia_swa_dashboard_context['business_pulse_kicker'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_kicker'] : __( 'SMART AI ALERT', 'noesia-smart-waiter' );
$business_pulse_heading                = isset( $noesia_swa_dashboard_context['business_pulse_heading'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_heading'] : __( 'Business Pulse', 'noesia-smart-waiter' );
$business_pulse_status_label           = isset( $noesia_swa_dashboard_context['business_pulse_status_label'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_status_label'] : __( 'Live Operational Status:', 'noesia-smart-waiter' );
$business_pulse_intro                  = isset( $noesia_swa_dashboard_context['business_pulse_intro'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_intro'] : __( 'Real-time monitoring of system health, activity and local conditions.', 'noesia-smart-waiter' );
$business_pulse_local_conditions_label = isset( $noesia_swa_dashboard_context['business_pulse_local_conditions_label'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_local_conditions_label'] : __( 'Local Conditions', 'noesia-smart-waiter' );
$business_pulse_system_health_label    = isset( $noesia_swa_dashboard_context['business_pulse_system_health_label'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_system_health_label'] : __( 'System Health', 'noesia-smart-waiter' );
$business_pulse_daily_activity_label   = isset( $noesia_swa_dashboard_context['business_pulse_daily_activity_label'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_daily_activity_label'] : __( 'Daily Activity', 'noesia-smart-waiter' );
$business_pulse_live_orders_label      = isset( $noesia_swa_dashboard_context['business_pulse_live_orders_label'] ) ? (string) $noesia_swa_dashboard_context['business_pulse_live_orders_label'] : __( 'Live Orders', 'noesia-smart-waiter' );
$global_pulse_kicker                   = isset( $noesia_swa_dashboard_context['global_pulse_kicker'] ) ? (string) $noesia_swa_dashboard_context['global_pulse_kicker'] : __( 'GLOBAL PULSE', 'noesia-smart-waiter' );
$global_pulse_heading                  = isset( $noesia_swa_dashboard_context['global_pulse_heading'] ) ? (string) $noesia_swa_dashboard_context['global_pulse_heading'] : __( 'Global Pulse', 'noesia-smart-waiter' );
$global_pulse_next_label               = isset( $noesia_swa_dashboard_context['global_pulse_next_label'] ) ? (string) $noesia_swa_dashboard_context['global_pulse_next_label'] : __( 'Next notable date:', 'noesia-smart-waiter' );
$global_pulse_intro                    = isset( $noesia_swa_dashboard_context['global_pulse_intro'] ) ? (string) $noesia_swa_dashboard_context['global_pulse_intro'] : __( 'Planet observances.', 'noesia-smart-waiter' );
$dashboard_next_notable                = isset( $noesia_swa_dashboard_context['dashboard_next_notable'] ) && is_array( $noesia_swa_dashboard_context['dashboard_next_notable'] ) ? $noesia_swa_dashboard_context['dashboard_next_notable'] : array();

// Morning Briefing personalization + dashboard stats source.
$dashboard_stats_source = isset( $noesia_swa_options['dashboard_stats_source'] ) ? sanitize_key( $noesia_swa_options['dashboard_stats_source'] ) : '';
if ( '' === $dashboard_stats_source ) {
	$dashboard_stats_source = 'requests';
}
$dashboard_stats_source = in_array( $dashboard_stats_source, array( 'reminders', 'requests', 'appointments' ), true ) ? $dashboard_stats_source : 'requests';

// Try to derive a numeric count from existing context (fallback to filter for real data providers).
$dashboard_stats_count = 0;
if ( isset( $dashboard_active_badge_text ) && is_string( $dashboard_active_badge_text ) ) {
	if ( preg_match( '/(\d+)/', $dashboard_active_badge_text, $m ) ) {
		$dashboard_stats_count = (int) $m[1];
	}
}
$dashboard_stats_count = (int) apply_filters( 'noesia_swa_dashboard_stats_count', $dashboard_stats_count, $dashboard_stats_source, $noesia_swa_dashboard_context, $noesia_swa_options );

$dashboard_stats_label = __( 'requests', 'noesia-smart-waiter' );
if ( 'reminders' === $dashboard_stats_source ) {
	$dashboard_stats_label = __( 'reminders', 'noesia-smart-waiter' );
} elseif ( 'appointments' === $dashboard_stats_source ) {
	$dashboard_stats_label = __( 'appointments', 'noesia-smart-waiter' );
}

$dashboard_hour = (int) current_time( 'G' );
$dashboard_greeting_prefix = __( 'Good Morning', 'noesia-smart-waiter' );
if ( $dashboard_hour >= 12 && $dashboard_hour < 18 ) {
	$dashboard_greeting_prefix = __( 'Good Afternoon', 'noesia-smart-waiter' );
} elseif ( $dashboard_hour >= 18 ) {
	$dashboard_greeting_prefix = __( 'Good Evening', 'noesia-smart-waiter' );
}
$dashboard_host_name = '';
if ( isset( $noesia_swa_options['profile_host_name'] ) ) {
	$dashboard_host_name = trim( (string) $noesia_swa_options['profile_host_name'] );
}
if ( '' === $dashboard_host_name && isset( $host_name ) ) {
	$dashboard_host_name = trim( (string) $host_name );
}
$dashboard_greeting_text = $dashboard_greeting_prefix;
// Override dashboard badge variables to follow dashboard_stats_source.
$dashboard_active_badge_target = $dashboard_stats_source;
$dashboard_active_badge_label  = $dashboard_stats_label;
$dashboard_active_badge_text   = (string) (int) $dashboard_stats_count;

if ( '' !== $dashboard_host_name ) {
	$dashboard_greeting_text = sprintf( '%1$s, %2$s!', $dashboard_greeting_prefix, $dashboard_host_name );
}

$dashboard_orders_display = trim( preg_replace( '/\s+(?:booked\s+today|pending)$/i', ' live', (string) $dashboard_orders_status ) );

if ( '' === $dashboard_orders_display ) {
	$dashboard_orders_display = (string) $dashboard_orders_status;
}

$noesia_swa_dashboard_widgets_registry = null;
if ( function_exists( 'noesia_swa' ) ) {
	$noesia_swa_plugin = noesia_swa();
	if ( is_object( $noesia_swa_plugin ) ) {
		$noesia_swa_dashboard_widgets_registry = $noesia_swa_plugin->dashboard_widgets;
	}
}

if ( $noesia_swa_dashboard_widgets_registry instanceof Noesia_SWA_Dashboard_Widgets ) {
	$noesia_swa_dashboard_widgets_registry->register_widgets(
		array(
			'legacy-profile-info' => array(
				'title'    => __( 'Profile Info', 'noesia-smart-waiter' ),
				'area'     => 'top',
				'position' => 20,
				'source'   => 'legacy',
			),
			'legacy-business-pulse' => array(
				'title'    => __( 'Business Pulse', 'noesia-smart-waiter' ),
				'area'     => 'hero',
				'position' => 10,
				'source'   => 'legacy',
			),
			'legacy-global-pulse' => array(
				'title'    => __( 'Global Pulse', 'noesia-smart-waiter' ),
				'area'     => 'hero',
				'position' => 20,
				'source'   => 'legacy',
			),
			'legacy-weather' => array(
				'title'    => __( 'Weather', 'noesia-smart-waiter' ),
				'area'     => 'main',
				'position' => 30,
				'source'   => 'legacy',
			
			),
		)
	);
}

?>

<?php
$noesia_swa_dashboard_omni_logo_default = '';
if ( defined( 'NOESIA_SWA_PLUGIN_URL' ) ) {
	$noesia_swa_dashboard_omni_logo_default = trailingslashit( NOESIA_SWA_PLUGIN_URL ) . 'modules/free/dashboard/assets/images/noesia-logo-g.png';
}

$noesia_swa_dashboard_omni_logo_url = (string) apply_filters(
	'noesia_swa_dashboard_omni_logo_url',
	$noesia_swa_dashboard_omni_logo_default
);

$noesia_swa_dashboard_home_hero_default = '';
if ( defined( 'NOESIA_SWA_PLUGIN_URL' ) ) {
	$noesia_swa_dashboard_home_hero_default = trailingslashit( NOESIA_SWA_PLUGIN_URL ) . 'modules/free/dashboard/assets/images/noesia-feel-home-hero.webp';
}

$noesia_swa_dashboard_home_hero_url = (string) apply_filters(
	'noesia_swa_dashboard_home_hero_url',
	$noesia_swa_dashboard_home_hero_default
);

$noesia_swa_dashboard_bookmark_menu = array();
for ( $noesia_swa_bookmark_index = 1; $noesia_swa_bookmark_index <= 8; $noesia_swa_bookmark_index++ ) {
	$noesia_swa_bookmark_name_key = 'bookmark_' . $noesia_swa_bookmark_index . '_name';
	$noesia_swa_bookmark_url_key  = 'bookmark_' . $noesia_swa_bookmark_index . '_url';
	$noesia_swa_bookmark_name     = isset( $noesia_swa_options[ $noesia_swa_bookmark_name_key ] ) ? sanitize_text_field( (string) $noesia_swa_options[ $noesia_swa_bookmark_name_key ] ) : '';
	$noesia_swa_bookmark_url      = isset( $noesia_swa_options[ $noesia_swa_bookmark_url_key ] ) ? esc_url( (string) $noesia_swa_options[ $noesia_swa_bookmark_url_key ] ) : '';

	if ( '' === $noesia_swa_bookmark_name || '' === $noesia_swa_bookmark_url ) {
		continue;
	}

	$noesia_swa_dashboard_bookmark_menu[] = array(
		'name' => $noesia_swa_bookmark_name,
		'url'  => $noesia_swa_bookmark_url,
	);
}

$noesia_swa_dashboard_recent_activity_defaults = array();

$noesia_swa_dashboard_recent_activity = (array) apply_filters(
	'noesia_swa_dashboard_recent_activity',
	$noesia_swa_dashboard_recent_activity_defaults,
	$noesia_swa_dashboard_context,
	$noesia_swa_options
);

$noesia_swa_dashboard_recent_activity = array_values(
	array_filter(
		$noesia_swa_dashboard_recent_activity,
		static function ( $item ) {
			return is_array( $item ) && ! empty( $item['label'] ) && ! empty( $item['text'] );
		}
	)
);

$noesia_swa_dashboard_recent_activity = array_map(
	static function ( $item ) {
		$timestamp = isset( $item['timestamp'] ) ? absint( $item['timestamp'] ) : 0;

		if ( $timestamp <= 0 && ! empty( $item['time'] ) ) {
			$parsed_timestamp = strtotime( sanitize_text_field( (string) $item['time'] ) );
			$timestamp        = false !== $parsed_timestamp ? absint( $parsed_timestamp ) : 0;
		}

		return array(
			'label'     => sanitize_text_field( (string) $item['label'] ),
			'text'      => sanitize_text_field( (string) $item['text'] ),
			'timestamp' => $timestamp,
		);
	},
	$noesia_swa_dashboard_recent_activity
);

usort(
	$noesia_swa_dashboard_recent_activity,
	static function ( $left, $right ) {
		$left_timestamp  = isset( $left['timestamp'] ) ? absint( $left['timestamp'] ) : 0;
		$right_timestamp = isset( $right['timestamp'] ) ? absint( $right['timestamp'] ) : 0;

		if ( $left_timestamp === $right_timestamp ) {
			return 0;
		}

		return ( $left_timestamp < $right_timestamp ) ? 1 : -1;
	}
);

$noesia_swa_dashboard_recent_activity = array_slice( $noesia_swa_dashboard_recent_activity, 0, 10 );

if ( empty( $noesia_swa_dashboard_recent_activity ) ) {
	$noesia_swa_dashboard_recent_activity[] = array(
		'label'     => '[' . wp_date( 'H:i', current_time( 'timestamp' ) ) . '] ' . __( 'Workspace', 'noesia-smart-waiter' ),
		'text'      => __( 'No recent workspace events were found yet.', 'noesia-smart-waiter' ),
		'timestamp' => current_time( 'timestamp' ),
	);
}


$noesia_swa_dashboard_quick_links = array(
    array(
        'id'          => 'news',
        'title'       => __( 'Read latest news', 'noesia-smart-waiter' ),
        'description' => __( 'Open the News workspace.', 'noesia-smart-waiter' ),
        'target'      => 'news',
        'pro'         => false,
    ),
    array(
        'id'          => 'ai-business',
        'title'       => __( 'Ask AI for business', 'noesia-smart-waiter' ),
        'description' => __( 'Open AI Studio for business prompts.', 'noesia-smart-waiter' ),
        'target'      => 'ai-studio',
        'pro'         => true,
    ),
    array(
        'id'          => 'medical-evidence',
        'title'       => __( 'Evidence search for medical', 'noesia-smart-waiter' ),
        'description' => __( 'Open Medical Evidence in Global Data Hub.', 'noesia-smart-waiter' ),
        'target'      => 'global-data-hub',
        'pro'         => true,
    ),
    array(
        'id'          => 'image-tools',
        'title'       => __( 'Edit and compress image', 'noesia-smart-waiter' ),
        'description' => __( 'Open Image Tools.', 'noesia-smart-waiter' ),
        'target'      => 'image-tools',
        'pro'         => false,
    ),
    array(
        'id'          => 'appointments',
        'title'       => __( 'Book an appointment', 'noesia-smart-waiter' ),
        'description' => __( 'Open Appointments.', 'noesia-smart-waiter' ),
        'target'      => 'appointments',
        'pro'         => false,
    ),
    array(
        'id'          => 'tasks',
        'title'       => __( 'Create a task', 'noesia-smart-waiter' ),
        'description' => __( 'Open Tasks.', 'noesia-smart-waiter' ),
        'target'      => 'tasks',
        'pro'         => false,
    ),
    array(
        'id'          => 'smart-pocket-note',
        'title'       => __( 'Write a note', 'noesia-smart-waiter' ),
        'description' => __( 'Open Smart Pocket notes.', 'noesia-smart-waiter' ),
        'target'      => 'smart-pocket',
        'route'       => 'notes',
        'pro'         => true,
    ),
    array(
        'id'          => 'smart-pocket-music',
        'title'       => __( 'Listen music', 'noesia-smart-waiter' ),
        'description' => __( 'Open Smart Pocket music.', 'noesia-smart-waiter' ),
        'target'      => 'smart-pocket',
        'route'       => 'music',
        'pro'         => true,
    ),
    array(
        'id'          => 'smart-pocket-radio',
        'title'       => __( 'Open world radio', 'noesia-smart-waiter' ),
        'description' => __( 'Open Smart Pocket world radio.', 'noesia-smart-waiter' ),
        'target'      => 'smart-pocket',
        'route'       => 'radio',
        'pro'         => true,
    ),
    array(
        'id'          => 'live-command',
        'title'       => __( 'Open Live Command', 'noesia-smart-waiter' ),
        'description' => __( 'Jump into live operations.', 'noesia-smart-waiter' ),
        'target'      => 'livecommand',
        'pro'         => true,
    ),
    array(
        'id'          => 'global-pulse',
        'title'       => __( 'Check Global Pulse', 'noesia-smart-waiter' ),
        'description' => __( 'Open system and world updates.', 'noesia-smart-waiter' ),
        'target'      => 'global-pulse',
        'pro'         => false,
    ),
    array(
        'id'          => 'guardian',
        'title'       => __( 'Pin my location', 'noesia-smart-waiter' ),
        'description' => __( 'Open Guardian.', 'noesia-smart-waiter' ),
        'target'      => 'guardian',
        'pro'         => false,
    ),
);

$noesia_swa_dashboard_apps_grid = array(
    array( 'abbr' => 'WE', 'name' => __( 'Weather', 'noesia-smart-waiter' ), 'target' => 'weather', 'pro' => false ),
    array( 'abbr' => 'NW', 'name' => __( 'News', 'noesia-smart-waiter' ), 'target' => 'news', 'pro' => false ),
    array( 'abbr' => 'GN', 'name' => __( 'Guardian', 'noesia-smart-waiter' ), 'target' => 'guardian', 'pro' => false ),
    array( 'abbr' => 'AV', 'name' => __( 'Auth Vault', 'noesia-smart-waiter' ), 'target' => 'auth-vault', 'pro' => false ),
    array( 'abbr' => 'CA', 'name' => __( 'Calculator', 'noesia-smart-waiter' ), 'target' => 'calculator', 'pro' => false ),
    array( 'abbr' => 'IT', 'name' => __( 'Image Tools', 'noesia-smart-waiter' ), 'target' => 'image-tools', 'pro' => false ),
    array( 'abbr' => 'TS', 'name' => __( 'Tasks', 'noesia-smart-waiter' ), 'target' => 'tasks', 'pro' => false ),
    array( 'abbr' => 'AP', 'name' => __( 'Appointments', 'noesia-smart-waiter' ), 'target' => 'appointments', 'pro' => false ),
    array( 'abbr' => 'SP', 'name' => __( 'Smart Pocket', 'noesia-smart-waiter' ), 'target' => 'smart-pocket', 'pro' => true ),
    array( 'abbr' => 'DV', 'name' => __( 'DentaVision AR', 'noesia-smart-waiter' ), 'target' => 'dentavision-ar', 'pro' => false ),
    array( 'abbr' => 'QR', 'name' => __( 'QR Builder', 'noesia-smart-waiter' ), 'target' => 'qr-builder', 'pro' => true ),
    array( 'abbr' => 'LC', 'name' => __( 'Live Command', 'noesia-smart-waiter' ), 'target' => 'livecommand', 'pro' => true ),
    array( 'abbr' => 'ER', 'name' => __( 'ERP Lite', 'noesia-smart-waiter' ), 'target' => 'erp-lite', 'pro' => true ),
    array( 'abbr' => 'CL', 'name' => __( 'Clinical Workspace', 'noesia-smart-waiter' ), 'target' => 'clinical-workspace', 'pro' => true ),
    array( 'abbr' => 'AI', 'name' => __( 'AI Studio', 'noesia-smart-waiter' ), 'target' => 'ai-studio', 'pro' => true ),
    array( 'abbr' => 'GP', 'name' => __( 'Global Pulse', 'noesia-smart-waiter' ), 'target' => 'global-pulse', 'pro' => false ),
    array( 'abbr' => 'CR', 'name' => __( 'CRM Lite', 'noesia-smart-waiter' ), 'target' => 'crm-lite', 'pro' => true ),
    array( 'abbr' => 'PH', 'name' => __( 'POS Ho.Re.Ca', 'noesia-smart-waiter' ), 'target' => 'pos-horeca', 'pro' => true ),
    array( 'abbr' => 'WO', 'name' => __( 'WOO Orders', 'noesia-smart-waiter' ), 'target' => 'woo-orders', 'pro' => true ),
    array( 'abbr' => 'FD', 'name' => __( 'Frontdesk', 'noesia-smart-waiter' ), 'target' => 'frontdesk', 'pro' => true ),
    array( 'abbr' => 'HK', 'name' => __( 'Housekeeping', 'noesia-smart-waiter' ), 'target' => 'housekeeping', 'pro' => true ),
    array( 'abbr' => 'AN', 'name' => __( 'Analytics', 'noesia-smart-waiter' ), 'target' => 'analytics', 'pro' => true ),
    array( 'abbr' => 'RV', 'name' => __( 'Reviews Booster', 'noesia-smart-waiter' ), 'target' => 'reviews-booster', 'pro' => true ),
    array( 'abbr' => 'MB', 'name' => __( 'Menu Builder', 'noesia-smart-waiter' ), 'target' => 'menu-builder', 'pro' => true ),
    array( 'abbr' => 'RS', 'name' => __( 'Reservations', 'noesia-smart-waiter' ), 'target' => 'reservations', 'pro' => true ),
    array( 'abbr' => 'WR', 'name' => __( 'World Radio', 'noesia-smart-waiter' ), 'target' => 'smart-pocket', 'pro' => true ),
    array( 'abbr' => 'MU', 'name' => __( 'Music Tools', 'noesia-smart-waiter' ), 'target' => 'smart-pocket', 'pro' => true ),
    array( 'abbr' => 'PY', 'name' => __( 'Payments Hub', 'noesia-smart-waiter' ), 'target' => 'livecommand', 'pro' => true ),
    array( 'abbr' => 'IN', 'name' => __( 'Inventory', 'noesia-smart-waiter' ), 'target' => 'erp-lite', 'pro' => true ),
    array( 'abbr' => 'SH', 'name' => __( 'Staff Hub', 'noesia-smart-waiter' ), 'target' => 'staff-hub', 'pro' => true ),
    array( 'abbr' => 'CU', 'name' => __( 'Customer Hub', 'noesia-smart-waiter' ), 'target' => 'customer-hub', 'pro' => true ),
    array( 'abbr' => 'GD', 'name' => __( 'Global Data Hub', 'noesia-smart-waiter' ), 'target' => 'global-data-hub', 'pro' => true ),
    array( 'abbr' => 'SR', 'name' => __( 'Screen Recorder', 'noesia-smart-waiter' ), 'target' => 'noesia-screen-recorder', 'pro' => true ),
    array( 'abbr' => 'EV', 'name' => __( 'Event Designer', 'noesia-smart-waiter' ), 'target' => 'event-designer', 'pro' => true ),
);

$noesia_swa_dashboard_omni_engines = (array) apply_filters(
	'noesia_swa_dashboard_omni_engines',
	array(
		'noesia'   => array(
			'label'        => __( 'Noesia', 'noesia-smart-waiter' ),
			'type'         => 'local',
			'base_url'     => '',
			'query_mode'   => 'local',
			'query_suffix' => '',
			'description'  => '',
		),
		'google'   => array(
			'label'        => __( 'Google', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.google.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Open a Google search in a new tab.', 'noesia-smart-waiter' ),
		),
		'chatgpt'  => array(
			'label'        => __( 'ChatGPT', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://chatgpt.com/?q=',
			'query_mode'   => 'append',
			'query_suffix' => '&hints=search',
			'description'  => __( 'Open ChatGPT in a new tab with your query.', 'noesia-smart-waiter' ),
		),
		'gemini'   => array(
			'label'        => __( 'Gemini', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://gemini.google.com/app?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Open Gemini in a new tab with your query when supported by Gemini.', 'noesia-smart-waiter' ),
		),
		'youtube'  => array(
			'label'        => __( 'YouTube', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.youtube.com/results?search_query=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Open YouTube results in a new tab.', 'noesia-smart-waiter' ),
		),
		'wikipedia' => array(
			'label'        => __( 'Wikipedia', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://en.wikipedia.org/w/index.php?search=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Open Wikipedia search in a new tab.', 'noesia-smart-waiter' ),
		),
	)
);

$noesia_swa_dashboard_omni_extra_engines = (array) apply_filters(
	'noesia_swa_dashboard_omni_extra_engines',
	array(
		'booking' => array(
			'label'        => __( 'Booking', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.booking.com/searchresults.html?ss=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Booking in a new tab.', 'noesia-smart-waiter' ),
		),
		'walmart' => array(
			'label'        => __( 'Walmart', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.walmart.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Walmart in a new tab.', 'noesia-smart-waiter' ),
		),
		'alibaba' => array(
			'label'        => __( 'Alibaba', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.alibaba.com/trade/search?SearchText=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Alibaba in a new tab.', 'noesia-smart-waiter' ),
		),
		'reddit' => array(
			'label'        => __( 'Reddit', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.reddit.com/search/?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Reddit in a new tab.', 'noesia-smart-waiter' ),
		),
		'bing' => array(
			'label'        => __( 'Bing', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.bing.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Bing in a new tab.', 'noesia-smart-waiter' ),
		),
		'linkedin' => array(
			'label'        => __( 'LinkedIn', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.linkedin.com/search/results/all/?keywords=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search LinkedIn in a new tab.', 'noesia-smart-waiter' ),
		),
		'imdb' => array(
			'label'        => __( 'IMDb', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.imdb.com/find/?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search IMDb in a new tab.', 'noesia-smart-waiter' ),
		),
		'apple' => array(
			'label'        => __( 'Apple', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.apple.com/search/',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Apple in a new tab.', 'noesia-smart-waiter' ),
		),
		'google-play' => array(
			'label'        => __( 'Google Play', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://play.google.com/store/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '&c=apps',
			'description'  => __( 'Search Google Play in a new tab.', 'noesia-smart-waiter' ),
		),
		'temu' => array(
			'label'        => __( 'Temu', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.temu.com/search_result.html?search_key=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Temu in a new tab.', 'noesia-smart-waiter' ),
		),
		'google-maps' => array(
			'label'        => __( 'Google Maps', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.google.com/maps/search/?api=1&query=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Google Maps in a new tab.', 'noesia-smart-waiter' ),
		),
		'ebay' => array(
			'label'        => __( 'eBay', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.ebay.com/sch/i.html?_nkw=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search eBay in a new tab.', 'noesia-smart-waiter' ),
		),
		'amazon' => array(
			'label'        => __( 'Amazon', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.amazon.com/s?k=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Amazon in a new tab.', 'noesia-smart-waiter' ),
		),
		'tripadvisor' => array(
			'label'        => __( 'TripAdvisor', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.tripadvisor.com/Search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search TripAdvisor in a new tab.', 'noesia-smart-waiter' ),
		),
		'google-news' => array(
			'label'        => __( 'Google News', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://news.google.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Google News in a new tab.', 'noesia-smart-waiter' ),
		),
		'skroutz' => array(
			'label'        => __( 'Skroutz', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.skroutz.gr/search?keyphrase=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Skroutz in a new tab.', 'noesia-smart-waiter' ),
		),
		'facebook' => array(
			'label'        => __( 'Facebook', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.facebook.com/search/top/?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Facebook in a new tab.', 'noesia-smart-waiter' ),
		),
		'tiktok' => array(
			'label'        => __( 'TikTok', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.tiktok.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search TikTok in a new tab.', 'noesia-smart-waiter' ),
		),
		'instagram' => array(
			'label'        => __( 'Instagram', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://www.instagram.com/explore/search/keyword/?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Instagram in a new tab.', 'noesia-smart-waiter' ),
		),
		'github' => array(
			'label'        => __( 'GitHub', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://github.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search GitHub in a new tab.', 'noesia-smart-waiter' ),
		),
		'stack-overflow' => array(
			'label'        => __( 'Stack Overflow', 'noesia-smart-waiter' ),
			'type'         => 'external',
			'base_url'     => 'https://stackoverflow.com/search?q=',
			'query_mode'   => 'append',
			'query_suffix' => '',
			'description'  => __( 'Search Stack Overflow in a new tab.', 'noesia-smart-waiter' ),
		),
	)
);

$noesia_swa_dashboard_omni_max_extra_engines = 8;
$noesia_swa_dashboard_news_shorts_categories = method_exists( $this, 'get_dashboard_news_shorts_categories' ) ? $this->get_dashboard_news_shorts_categories() : array();
?>

<section
	class="noesia-card noesia-swa-omni-search-shell"
	data-noesia-swa-omni-search-root="1"
	data-noesia-swa-omni-placeholder-local="<?php echo esc_attr__( 'Search Noesia modules, tools, CRM, ERP, and more', 'noesia-smart-waiter' ); ?>"
	data-noesia-swa-omni-placeholder-external="<?php echo esc_attr__( 'Type a query and launch it in the selected destination', 'noesia-smart-waiter' ); ?>"
	data-noesia-swa-omni-max-extra="<?php echo esc_attr( (string) $noesia_swa_dashboard_omni_max_extra_engines ); ?>"
>
	<div class="noesia-swa-omni-search-brand" aria-hidden="true">
		<?php if ( '' !== $noesia_swa_dashboard_omni_logo_url ) : ?>
			<img
				class="noesia-swa-omni-search-logo"
				src="<?php echo esc_url( $noesia_swa_dashboard_omni_logo_url ); ?>"
				alt="<?php esc_attr_e( 'Noesia', 'noesia-smart-waiter' ); ?>"
			/>
		<?php else : ?>
			<span class="noesia-swa-omni-search-wordmark"><?php esc_html_e( 'Noesia', 'noesia-smart-waiter' ); ?></span>
		<?php endif; ?>
	</div>

	<div class="noesia-swa-omni-search-form" data-noesia-swa-omni-search-form="1" role="search">
		<label class="screen-reader-text" for="noesia-swa-dashboard-omni-search-input"><?php esc_html_e( 'Search the dashboard', 'noesia-smart-waiter' ); ?></label>
		<div class="noesia-swa-omni-search-input-wrap">
			<span class="dashicons dashicons-search noesia-swa-omni-search-input-icon" aria-hidden="true"></span>
			<input
				id="noesia-swa-dashboard-omni-search-input"
				type="search"
				class="noesia-swa-omni-search-input"
				data-noesia-swa-omni-input="1"
				maxlength="200"
				autocomplete="off"
				spellcheck="false"
				placeholder="<?php echo esc_attr__( 'Search Noesia modules, tools, CRM, ERP, and more', 'noesia-smart-waiter' ); ?>"
			/>
			<span class="noesia-swa-omni-search-command-hint" data-noesia-swa-omni-command-hint="1"><?php esc_html_e( 'Press / to command', 'noesia-smart-waiter' ); ?></span>
			<button type="button" class="noesia-swa-omni-search-submit" data-noesia-swa-omni-submit="1">
				<span class="dashicons dashicons-arrow-right-alt2" aria-hidden="true"></span>
				<span><?php esc_html_e( 'Search', 'noesia-smart-waiter' ); ?></span>
			</button>
		</div>

		<div class="noesia-swa-omni-search-pills" role="toolbar" aria-label="<?php esc_attr_e( 'Search destinations', 'noesia-smart-waiter' ); ?>">
			<?php foreach ( $noesia_swa_dashboard_omni_engines as $noesia_swa_dashboard_omni_key => $noesia_swa_dashboard_omni_engine ) : ?>
				<?php
				$noesia_swa_dashboard_omni_key          = sanitize_key( (string) $noesia_swa_dashboard_omni_key );
				$noesia_swa_dashboard_omni_label        = isset( $noesia_swa_dashboard_omni_engine['label'] ) ? (string) $noesia_swa_dashboard_omni_engine['label'] : ucfirst( $noesia_swa_dashboard_omni_key );
				$noesia_swa_dashboard_omni_type         = isset( $noesia_swa_dashboard_omni_engine['type'] ) ? sanitize_key( (string) $noesia_swa_dashboard_omni_engine['type'] ) : 'external';
				$noesia_swa_dashboard_omni_base_url     = isset( $noesia_swa_dashboard_omni_engine['base_url'] ) ? (string) $noesia_swa_dashboard_omni_engine['base_url'] : '';
				$noesia_swa_dashboard_omni_query_mode   = isset( $noesia_swa_dashboard_omni_engine['query_mode'] ) ? sanitize_key( (string) $noesia_swa_dashboard_omni_engine['query_mode'] ) : 'append';
				$noesia_swa_dashboard_omni_query_suffix = isset( $noesia_swa_dashboard_omni_engine['query_suffix'] ) ? (string) $noesia_swa_dashboard_omni_engine['query_suffix'] : '';
				$noesia_swa_dashboard_omni_description  = isset( $noesia_swa_dashboard_omni_engine['description'] ) ? (string) $noesia_swa_dashboard_omni_engine['description'] : '';
				$noesia_swa_dashboard_omni_active       = ( 'noesia' === $noesia_swa_dashboard_omni_key );
				?>
				<button
					type="button"
					class="noesia-swa-omni-search-pill<?php echo $noesia_swa_dashboard_omni_active ? ' is-active' : ''; ?>"
					data-noesia-swa-omni-engine="<?php echo esc_attr( $noesia_swa_dashboard_omni_key ); ?>"
					data-noesia-swa-omni-engine-type="<?php echo esc_attr( $noesia_swa_dashboard_omni_type ); ?>"
					data-noesia-swa-omni-base-url="<?php echo esc_url( $noesia_swa_dashboard_omni_base_url ); ?>"
					data-noesia-swa-omni-query-mode="<?php echo esc_attr( $noesia_swa_dashboard_omni_query_mode ); ?>"
					data-noesia-swa-omni-query-suffix="<?php echo esc_attr( $noesia_swa_dashboard_omni_query_suffix ); ?>"
					data-noesia-swa-omni-description="<?php echo esc_attr( $noesia_swa_dashboard_omni_description ); ?>"
					aria-pressed="<?php echo $noesia_swa_dashboard_omni_active ? 'true' : 'false'; ?>"
				>
					<?php echo esc_html( $noesia_swa_dashboard_omni_label ); ?>
				</button>
			<?php endforeach; ?>

			<?php foreach ( $noesia_swa_dashboard_omni_extra_engines as $noesia_swa_dashboard_omni_key => $noesia_swa_dashboard_omni_engine ) : ?>
				<?php
				$noesia_swa_dashboard_omni_key          = sanitize_key( (string) $noesia_swa_dashboard_omni_key );
				$noesia_swa_dashboard_omni_label        = isset( $noesia_swa_dashboard_omni_engine['label'] ) ? (string) $noesia_swa_dashboard_omni_engine['label'] : ucfirst( $noesia_swa_dashboard_omni_key );
				$noesia_swa_dashboard_omni_type         = isset( $noesia_swa_dashboard_omni_engine['type'] ) ? sanitize_key( (string) $noesia_swa_dashboard_omni_engine['type'] ) : 'external';
				$noesia_swa_dashboard_omni_base_url     = isset( $noesia_swa_dashboard_omni_engine['base_url'] ) ? (string) $noesia_swa_dashboard_omni_engine['base_url'] : '';
				$noesia_swa_dashboard_omni_query_mode   = isset( $noesia_swa_dashboard_omni_engine['query_mode'] ) ? sanitize_key( (string) $noesia_swa_dashboard_omni_engine['query_mode'] ) : 'append';
				$noesia_swa_dashboard_omni_query_suffix = isset( $noesia_swa_dashboard_omni_engine['query_suffix'] ) ? (string) $noesia_swa_dashboard_omni_engine['query_suffix'] : '';
				$noesia_swa_dashboard_omni_description  = isset( $noesia_swa_dashboard_omni_engine['description'] ) ? (string) $noesia_swa_dashboard_omni_engine['description'] : '';
				?>
				<button
					type="button"
					class="noesia-swa-omni-search-pill noesia-swa-omni-search-pill--extra"
					data-noesia-swa-omni-engine="<?php echo esc_attr( $noesia_swa_dashboard_omni_key ); ?>"
					data-noesia-swa-omni-engine-type="<?php echo esc_attr( $noesia_swa_dashboard_omni_type ); ?>"
					data-noesia-swa-omni-base-url="<?php echo esc_url( $noesia_swa_dashboard_omni_base_url ); ?>"
					data-noesia-swa-omni-query-mode="<?php echo esc_attr( $noesia_swa_dashboard_omni_query_mode ); ?>"
					data-noesia-swa-omni-query-suffix="<?php echo esc_attr( $noesia_swa_dashboard_omni_query_suffix ); ?>"
					data-noesia-swa-omni-description="<?php echo esc_attr( $noesia_swa_dashboard_omni_description ); ?>"
					data-noesia-swa-omni-extra-engine="1"
					aria-pressed="false"
					hidden
				>
					<?php echo esc_html( $noesia_swa_dashboard_omni_label ); ?>
				</button>
			<?php endforeach; ?>

			<button
				type="button"
				class="noesia-swa-omni-search-pill noesia-swa-omni-search-pill--picker"
				data-noesia-swa-omni-picker-open="1"
				aria-haspopup="dialog"
				aria-expanded="false"
			>
				<span class="noesia-swa-omni-search-pill-plus" aria-hidden="true">+</span>
				<span><?php esc_html_e( 'More', 'noesia-smart-waiter' ); ?></span>
				<span class="noesia-swa-omni-search-pill-count" data-noesia-swa-omni-picker-count="1">0/<?php echo esc_html( (string) $noesia_swa_dashboard_omni_max_extra_engines ); ?></span>
			</button>
		</div>

		<p class="noesia-swa-omni-search-status" data-noesia-swa-omni-status="1" aria-live="polite" hidden></p>
	</div>

	<div class="noesia-swa-omni-picker" data-noesia-swa-omni-picker="1" hidden>
		<div class="noesia-swa-omni-picker-backdrop" data-noesia-swa-omni-picker-close="1"></div>
		<div class="noesia-swa-omni-picker-dialog" role="dialog" aria-modal="true" aria-labelledby="noesia-swa-omni-picker-title">
			<div class="noesia-swa-omni-picker-head">
				<div>
					<h3 id="noesia-swa-omni-picker-title"><?php esc_html_e( 'Add more search engines', 'noesia-smart-waiter' ); ?></h3>
					<p><?php esc_html_e( 'Choose up to 8 extra destinations for your dashboard search bar.', 'noesia-smart-waiter' ); ?></p>
				</div>
				<button type="button" class="noesia-swa-omni-picker-close" data-noesia-swa-omni-picker-close="1" aria-label="<?php esc_attr_e( 'Close', 'noesia-smart-waiter' ); ?>">
					<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
				</button>
			</div>
			<div class="noesia-swa-omni-picker-meta">
				<strong data-noesia-swa-omni-picker-selected-count="1">0</strong>
				<span><?php esc_html_e( 'selected', 'noesia-smart-waiter' ); ?></span>
				<span class="noesia-swa-omni-picker-meta-sep" aria-hidden="true">•</span>
				<?php /* translators: %d: maximum number of extra search engines that can be selected. */ ?>
				<span><?php echo esc_html( sprintf( __( 'Maximum %d', 'noesia-smart-waiter' ), $noesia_swa_dashboard_omni_max_extra_engines ) ); ?></span>
			</div>
			<div class="noesia-swa-omni-picker-grid" data-noesia-swa-omni-picker-grid="1">
				<?php foreach ( $noesia_swa_dashboard_omni_extra_engines as $noesia_swa_dashboard_omni_key => $noesia_swa_dashboard_omni_engine ) : ?>
					<?php
					$noesia_swa_dashboard_omni_key         = sanitize_key( (string) $noesia_swa_dashboard_omni_key );
					$noesia_swa_dashboard_omni_label       = isset( $noesia_swa_dashboard_omni_engine['label'] ) ? (string) $noesia_swa_dashboard_omni_engine['label'] : ucfirst( $noesia_swa_dashboard_omni_key );
					$noesia_swa_dashboard_omni_description = isset( $noesia_swa_dashboard_omni_engine['description'] ) ? (string) $noesia_swa_dashboard_omni_engine['description'] : '';
					?>
					<button
						type="button"
						class="noesia-swa-omni-picker-option"
						data-noesia-swa-omni-picker-engine="<?php echo esc_attr( $noesia_swa_dashboard_omni_key ); ?>"
						aria-pressed="false"
					>
						<span class="noesia-swa-omni-picker-option-label"><?php echo esc_html( $noesia_swa_dashboard_omni_label ); ?></span>
						<?php if ( '' !== $noesia_swa_dashboard_omni_description ) : ?>
							<span class="noesia-swa-omni-picker-option-text"><?php echo esc_html( $noesia_swa_dashboard_omni_description ); ?></span>
						<?php endif; ?>
					</button>
				<?php endforeach; ?>
			</div>
			<div class="noesia-swa-omni-picker-actions">
				<button type="button" class="button button-secondary" data-noesia-swa-omni-picker-clear="1"><?php esc_html_e( 'Clear extras', 'noesia-smart-waiter' ); ?></button>
				<button type="button" class="button button-primary" data-noesia-swa-omni-picker-close="1"><?php esc_html_e( 'Done', 'noesia-smart-waiter' ); ?></button>
			</div>
		</div>
	</div>
</section>

<div class="noesia-swa-dashboard-modes-shell" data-noesia-swa-dashboard-modes-root="1" data-noesia-swa-dashboard-current-mode="home">
	<div class="noesia-swa-dashboard-modebar">
		<div class="noesia-swa-dashboard-modebar-side">
			<button type="button" class="noesia-swa-dashboard-modepill noesia-swa-dashboard-modepill--shorts" data-noesia-swa-dashboard-news-shorts-open="1" aria-haspopup="dialog" aria-expanded="false" aria-label="<?php esc_attr_e( 'Open News Shorts', 'noesia-smart-waiter' ); ?>">
				<span class="dashicons dashicons-video-alt3" aria-hidden="true"></span>
				<span class="noesia-swa-dashboard-modepill-short-label"><?php esc_html_e( 'Shorts', 'noesia-smart-waiter' ); ?></span>
			</button>
		</div>
		<div class="noesia-swa-dashboard-modebar-main" role="tablist" aria-label="<?php esc_attr_e( 'Dashboard appearance modes', 'noesia-smart-waiter' ); ?>">
			<button type="button" class="noesia-swa-dashboard-modepill noesia-swa-dashboard-modepill--home is-active" role="tab" aria-selected="true" aria-expanded="true" data-noesia-swa-dashboard-mode="home">
				<span class="noesia-swa-dashboard-modepill-arrow" data-noesia-swa-dashboard-home-hero-toggle="1" aria-hidden="true"></span>
				<span class="noesia-swa-dashboard-modepill-label"><?php esc_html_e( 'Feel Home', 'noesia-smart-waiter' ); ?></span>
			</button>
			<button type="button" class="noesia-swa-dashboard-modepill" role="tab" aria-selected="false" data-noesia-swa-dashboard-mode="free">
				<?php esc_html_e( 'Feel Free', 'noesia-smart-waiter' ); ?>
			</button>
			<button type="button" class="noesia-swa-dashboard-modepill" role="tab" aria-selected="false" data-noesia-swa-dashboard-mode="matrix">
				<?php esc_html_e( 'Feel the Matrix', 'noesia-smart-waiter' ); ?>
			</button>
			<button type="button" class="noesia-swa-dashboard-modepill" role="tab" aria-selected="false" data-noesia-swa-dashboard-mode="apps">
				<?php esc_html_e( 'Feel the Apps', 'noesia-smart-waiter' ); ?>
			</button>
			<button type="button" class="noesia-swa-dashboard-modepill" role="tab" aria-selected="false" data-noesia-swa-dashboard-mode="world">
				<?php esc_html_e( 'Feel the World', 'noesia-smart-waiter' ); ?>
			</button>
		</div>
	</div>

	<div class="noesia-swa-dashboard-mode-panels">
		<div class="noesia-swa-dashboard-mode-panel noesia-swa-dashboard-mode-panel--home is-active" data-noesia-swa-dashboard-mode-panel="home">

<?php do_action( 'noesia_swa_dashboard_before_grid', $noesia_swa_dashboard_widgets_registry ); ?>
<?php noesia_swa_dashboard_render_registry_area( $noesia_swa_dashboard_widgets_registry, 'hero' ); ?>
<?php
$noesia_swa_site_icon = get_site_icon_url( 64 );
$noesia_swa_today     = wp_date( 'l, j F Y' );
?>
<div class="noesia-swa-dashboard-home-hero-shell" data-noesia-swa-dashboard-home-hero="1">
	<div class="noesia-swa-dashboard-home-hero-frame">
		<?php if ( '' !== $noesia_swa_dashboard_home_hero_url ) : ?>
			<img class="noesia-swa-dashboard-home-hero-image" src="<?php echo esc_url( $noesia_swa_dashboard_home_hero_url ); ?>" alt="" decoding="async" />
		<?php endif; ?>
		<div class="noesia-swa-dashboard-home-hero-hotspots" aria-label="<?php esc_attr_e( 'Feel quick access', 'noesia-smart-waiter' ); ?>">
			<button type="button" class="noesia-swa-dashboard-home-hero-link noesia-swa-dashboard-home-hero-link--home" data-noesia-swa-dashboard-mode="home"><span class="screen-reader-text"><?php esc_html_e( 'Feel Home', 'noesia-smart-waiter' ); ?></span></button>
			<button type="button" class="noesia-swa-dashboard-home-hero-link noesia-swa-dashboard-home-hero-link--free" data-noesia-swa-dashboard-mode="free"><span class="screen-reader-text"><?php esc_html_e( 'Feel Free', 'noesia-smart-waiter' ); ?></span></button>
			<button type="button" class="noesia-swa-dashboard-home-hero-link noesia-swa-dashboard-home-hero-link--matrix" data-noesia-swa-dashboard-mode="matrix"><span class="screen-reader-text"><?php esc_html_e( 'Feel the Matrix', 'noesia-smart-waiter' ); ?></span></button>
			<button type="button" class="noesia-swa-dashboard-home-hero-link noesia-swa-dashboard-home-hero-link--apps" data-noesia-swa-dashboard-mode="apps"><span class="screen-reader-text"><?php esc_html_e( 'Feel the Apps', 'noesia-smart-waiter' ); ?></span></button>
			<button type="button" class="noesia-swa-dashboard-home-hero-link noesia-swa-dashboard-home-hero-link--world" data-noesia-swa-dashboard-mode="world"><span class="screen-reader-text"><?php esc_html_e( 'Feel the World', 'noesia-smart-waiter' ); ?></span></button>
		</div>
	</div>
</div>
<div class="noesia-swa-dashboard-datebar">
  <?php if ( $noesia_swa_site_icon ) : ?>
    <img src="<?php echo esc_url( $noesia_swa_site_icon ); ?>"
         alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>"
         width="22" height="22"
         class="noesia-swa-dashboard-datebar-icon" />
  <?php endif; ?>

  <div>
    <div class="noesia-swa-muted noesia-swa-dashboard-datebar-kicker"><?php esc_html_e( 'Today', 'noesia-smart-waiter' ); ?></div>
    <div class="noesia-swa-dashboard-datebar-date">
      <?php echo esc_html( $noesia_swa_today ); ?>
    </div>
  </div>
</div>
<div class="noesia-swa-dashboard-grid">

	
	<div class="noesia-swa-dashboard-main-row">
<div class="noesia-card noesia-swa-dashboard-briefing noesia-swa-dashboard-main-card">
		<div class="noesia-swa-card-header">
			<div>
				<div class="noesia-swa-kicker"><?php esc_html_e( 'MORNING BRIEFING', 'noesia-smart-waiter' ); ?></div>
				<h3><?php echo esc_html( $dashboard_greeting_text ); ?></h3>
				<p class="noesia-swa-muted">
    <?php 
    /* translators: 1: Count of items, 2: Label (e.g., appointments or requests) */
    echo esc_html( sprintf( __( 'Today you have %1$d %2$s.', 'noesia-smart-waiter' ), (int) $dashboard_stats_count, $dashboard_stats_label ) ); 
    ?>
</p>
			</div>

			<div class="noesia-swa-inline-actions">
				<button type="button" class="button" data-noesia-swa-nav-target="settings">
					<span class="dashicons dashicons-admin-generic" aria-hidden="true"></span>
					<?php esc_html_e( 'Settings', 'noesia-smart-waiter' ); ?>
				</button>
			</div>
		</div>

		<div class="noesia-swa-briefing-stack">
			<div class="noesia-card noesia-swa-dynamic-badge-card" data-noesia-swa-dynamic-badge="1" data-noesia-swa-briefing-target="<?php echo esc_attr( $dashboard_active_badge_target ); ?>" data-noesia-swa-active-badge-label="<?php echo esc_attr( $dashboard_active_badge_label ); ?>">
				<div class="noesia-swa-muted"><?php echo esc_html( $dashboard_active_badge_label ); ?></div>
				<div><strong><?php echo esc_html( $dashboard_active_badge_text ); ?></strong></div>
			</div>

			<div class="noesia-card noesia-swa-morning-briefing-ticker-card">
				<div class="noesia-swa-muted"><?php esc_html_e( 'Live Headlines', 'noesia-smart-waiter' ); ?></div>
				<div id="noesia-swa-morning-briefing-slot" class="noesia-swa-morning-briefing-slot" aria-live="polite">
					<a class="noesia-swa-news-link" href="#" target="_blank" rel="noopener noreferrer"><strong><?php esc_html_e( 'Awaiting telemetry…', 'noesia-smart-waiter' ); ?></strong></a>
				</div>
			</div>

			
		</div>
	</div>

	
<div class="noesia-card noesia-swa-dashboard-profile noesia-swa-dashboard-main-card">
		<div class="noesia-swa-card-header">
			<div>
				<div class="noesia-swa-kicker"><?php esc_html_e( 'PROFILE INFO', 'noesia-smart-waiter' ); ?></div>
				<h3><?php echo esc_html( '' !== $business_name ? $business_name : __( 'Profile Info', 'noesia-smart-waiter' ) ); ?></h3>
				<p class="noesia-swa-muted"><?php esc_html_e( 'Your saved details appear below. You can update them anytime from Settings.', 'noesia-smart-waiter' ); ?></p>
			</div>

			<div class="noesia-swa-inline-actions">
				<button type="button" class="button" data-noesia-swa-nav-target="settings">
					<span class="dashicons dashicons-admin-users" aria-hidden="true"></span>
					<?php esc_html_e( 'Edit', 'noesia-smart-waiter' ); ?>
				</button>
			</div>
		</div>

		<div class="noesia-swa-section-grid">
			<div class="noesia-card">
				<div class="noesia-swa-muted"><?php esc_html_e( 'The Host', 'noesia-smart-waiter' ); ?></div>
				<div><strong><?php echo esc_html( '' !== $host_name ? $host_name : __( 'Not set yet', 'noesia-smart-waiter' ) ); ?></strong></div>
			</div>

			<div class="noesia-card">
				<div class="noesia-swa-muted"><?php esc_html_e( 'Business Details', 'noesia-smart-waiter' ); ?></div>
				<div><strong><?php echo esc_html( $profile_business_text ); ?></strong></div>
			</div>

			<div class="noesia-card">
				<div class="noesia-swa-muted"><?php esc_html_e( 'Contact', 'noesia-smart-waiter' ); ?></div>
				<div><strong><?php echo esc_html( $profile_contact_text ); ?></strong></div>
			</div>

			<div class="noesia-card">
				<div class="noesia-swa-muted"><?php esc_html_e( 'VAT / Registration / Address', 'noesia-smart-waiter' ); ?></div>
				<div><strong><?php echo esc_html( $profile_legal_text ); ?></strong></div>
			</div>
		</div>
	</div>

	
<div class="noesia-card noesia-swa-dashboard-alert noesia-swa-dashboard-alert--business-pulse noesia-swa-dashboard-main-card">
				<div class="noesia-swa-hero-card noesia-swa-dashboard-alert-flow">
					<div class="noesia-swa-dashboard-alert-head">
						<div class="noesia-swa-hero-icon noesia-swa-dashboard-alert-inline-icon" aria-hidden="true">✨</div>
						<div class="noesia-swa-dashboard-alert-copy">
							<div class="noesia-swa-kicker"><?php echo esc_html( isset( $business_pulse_kicker ) ? (string) $business_pulse_kicker : __( 'SMART AI ALERT', 'noesia-smart-waiter' ) ); ?></div>
							<h3><?php echo esc_html( isset( $business_pulse_heading ) ? (string) $business_pulse_heading : __( 'Business Pulse', 'noesia-smart-waiter' ) ); ?></h3>
							<p><strong><?php echo esc_html( isset( $business_pulse_status_label ) ? (string) $business_pulse_status_label : __( 'Live Operational Status:', 'noesia-smart-waiter' ) ); ?></strong></p>
							<p class="noesia-swa-muted"><?php echo esc_html( isset( $business_pulse_intro ) ? (string) $business_pulse_intro : __( 'Real-time monitoring of system health, activity and local conditions.', 'noesia-smart-waiter' ) ); ?></p>
						</div>
					</div>

<div class="noesia-swa-status-box">
	<strong><?php echo esc_html( $business_pulse_title ); ?></strong>
	<span><?php echo esc_html( $business_pulse_text ); ?></span>
</div>

<div class="noesia-swa-status-box">
	<strong><?php echo esc_html( isset( $business_pulse_local_conditions_label ) ? (string) $business_pulse_local_conditions_label : __( 'Local Conditions', 'noesia-smart-waiter' ) ); ?></strong>
	<div id="noesia-swa-weather-current">
		<p><strong><?php echo esc_html( $weather_bundle['now_label'] ); ?></strong></p>
		<p class="noesia-swa-muted"><?php echo esc_html( $weather_bundle['tip'] ); ?></p>
	</div>
</div>

					<div class="noesia-swa-bookmarks-grid noesia-swa-dashboard-alert-kpis">
						<div class="noesia-swa-kpi-box">
							<strong><?php echo esc_html( isset( $business_pulse_system_health_label ) ? (string) $business_pulse_system_health_label : __( 'System Health', 'noesia-smart-waiter' ) ); ?></strong>
							<span><?php echo esc_html( $dashboard_system_health ); ?></span>
						</div>

						<div class="noesia-swa-kpi-box">
							<strong><?php echo esc_html( isset( $business_pulse_daily_activity_label ) ? (string) $business_pulse_daily_activity_label : __( 'Daily Activity', 'noesia-smart-waiter' ) ); ?></strong>
							<span><?php echo esc_html( $dashboard_activity_status ); ?></span>
						</div>

						<div class="noesia-swa-kpi-box">
							<strong><?php echo esc_html( isset( $business_pulse_live_orders_label ) ? (string) $business_pulse_live_orders_label : __( 'Live Orders', 'noesia-smart-waiter' ) ); ?></strong>
							<span><?php echo esc_html( $dashboard_orders_display ); ?></span>
						</div>
					</div>
				</div>
			</div>

			
<div class="noesia-card noesia-swa-dashboard-alert noesia-swa-dashboard-global-pulse-card noesia-swa-dashboard-main-card">
				<div class="noesia-swa-hero-card">
					<div class="noesia-swa-hero-icon" aria-hidden="true">♡</div>

					<div>
						<div class="noesia-swa-kicker"><?php echo esc_html( isset( $global_pulse_kicker ) ? (string) $global_pulse_kicker : __( 'GLOBAL PULSE', 'noesia-smart-waiter' ) ); ?></div>
						<h3><?php echo esc_html( isset( $global_pulse_heading ) ? (string) $global_pulse_heading : __( 'Global Pulse', 'noesia-smart-waiter' ) ); ?></h3>
						<p><strong><?php echo esc_html( isset( $global_pulse_next_label ) ? (string) $global_pulse_next_label : __( 'Next notable date:', 'noesia-smart-waiter' ) ); ?></strong></p>
						<p class="noesia-swa-muted"><?php echo esc_html( isset( $global_pulse_intro ) ? (string) $global_pulse_intro : __( 'Planet observances.', 'noesia-smart-waiter' ) ); ?></p>

						<div class="noesia-swa-status-box">
							<div class="noesia-swa-weather-now-card">
								<div class="noesia-swa-weather-big"><?php echo esc_html( $dashboard_next_notable['date_label'] ); ?></div>
								<div><strong><?php echo esc_html( $dashboard_next_notable['title'] ); ?></strong></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		

	
	</div>

<?php do_action( 'noesia_swa_dashboard_before_legacy_top', $noesia_swa_dashboard_widgets_registry ); ?>
<?php noesia_swa_dashboard_render_registry_area( $noesia_swa_dashboard_widgets_registry, 'top' ); ?>

			<?php do_action( 'noesia_swa_dashboard_before_legacy_main', $noesia_swa_dashboard_widgets_registry ); ?>
<?php noesia_swa_dashboard_render_registry_area( $noesia_swa_dashboard_widgets_registry, 'main' ); ?>
<section class="noesia-card noesia-swa-card--span2 noesia-swa-dashboard-weather">
		<div class="noesia-swa-card-header">
			<div>
				<div class="noesia-swa-kicker"><?php esc_html_e( 'WEATHER', 'noesia-smart-waiter' ); ?></div>
				<h3><?php esc_html_e( 'Weather', 'noesia-smart-waiter' ); ?></h3>
			</div>
			<div class="noesia-swa-inline-actions">
				<button type="button" class="button" data-noesia-swa-nav-target="settings">
					<span class="dashicons dashicons-admin-generic" aria-hidden="true"></span>
					<?php esc_html_e( 'Configure', 'noesia-smart-waiter' ); ?>
				</button>
			</div>
		</div>

		<div class="noesia-swa-card-body">
			<?php if ( '' !== $weather_bundle['error'] ) : ?>
				<p class="noesia-swa-muted"><?php echo esc_html( $weather_bundle['error'] ); ?></p>
			<?php endif; ?>

			<div class="noesia-swa-weather-now-card">
				<div id="noesia-swa-weather-current-main">
					<div class="noesia-swa-weather-today-card">
						<div class="noesia-swa-weather-day"><?php echo esc_html( isset( $weather_bundle['today_label'] ) ? (string) $weather_bundle['today_label'] : __( 'Today', 'noesia-smart-waiter' ) ); ?></div>
						<?php if ( ! empty( $weather_bundle['place'] ) ) : ?>
							<div class="noesia-swa-weather-place"><?php echo esc_html( $weather_bundle['place'] ); ?></div>
						<?php endif; ?>
						<div class="noesia-swa-weather-big"><?php echo esc_html( $weather_bundle['now_label'] ); ?></div>
						<?php if ( ! empty( $weather_bundle['condition'] ) ) : ?>
							<div class="noesia-swa-weather-condition"><?php echo esc_html( $weather_bundle['condition'] ); ?></div>
						<?php endif; ?>
						<div class="noesia-swa-weather-today-meta">
							<div class="noesia-swa-weather-meta-item">
								<span class="noesia-swa-weather-meta-label"><?php echo esc_html( isset( $weather_bundle['min_text'] ) ? (string) $weather_bundle['min_text'] : __( 'Min', 'noesia-smart-waiter' ) ); ?></span>
								<strong class="noesia-swa-weather-meta-value"><?php echo esc_html( isset( $weather_bundle['today_min_label'] ) ? (string) $weather_bundle['today_min_label'] : '—' ); ?></strong>
							</div>
							<div class="noesia-swa-weather-meta-item">
								<span class="noesia-swa-weather-meta-label"><?php echo esc_html( isset( $weather_bundle['max_text'] ) ? (string) $weather_bundle['max_text'] : __( 'Max', 'noesia-smart-waiter' ) ); ?></span>
								<strong class="noesia-swa-weather-meta-value"><?php echo esc_html( isset( $weather_bundle['today_max_label'] ) ? (string) $weather_bundle['today_max_label'] : '—' ); ?></strong>
							</div>
							<div class="noesia-swa-weather-meta-item">
								<span class="noesia-swa-weather-meta-label"><?php echo esc_html( isset( $weather_bundle['rain_text'] ) ? (string) $weather_bundle['rain_text'] : __( 'Rain', 'noesia-smart-waiter' ) ); ?></span>
								<strong class="noesia-swa-weather-meta-value"><?php echo esc_html( isset( $weather_bundle['today_rain_label'] ) ? (string) $weather_bundle['today_rain_label'] : '—' ); ?></strong>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div id="noesia-swa-weather-forecast" class="noesia-swa-forecast-grid">
				<?php if ( empty( $forecast_days ) ) : ?>
					<?php for ( $noesia_swa_i = 0; $noesia_swa_i < 5; $noesia_swa_i++ ) : ?>
						<div class="noesia-swa-forecast-box">
							<div class="noesia-swa-forecast-top">
								<div class="noesia-swa-forecast-day">—</div>
								<div class="noesia-swa-forecast-date">—</div>
							</div>
							<div class="noesia-swa-forecast-icon">
								<span class="noesia-swa-forecast-icon-emoji">☁️</span>
								<span class="noesia-swa-forecast-condition"><?php esc_html_e( 'Weather', 'noesia-smart-waiter' ); ?></span>
							</div>
							<div class="noesia-swa-forecast-temp">
								<strong class="noesia-swa-forecast-high">—</strong>
								<span class="noesia-swa-forecast-low">—</span>
							</div>
							<div class="noesia-swa-forecast-rain"><?php esc_html_e( 'Rain —', 'noesia-smart-waiter' ); ?></div>
						</div>
					<?php endfor; ?>
				<?php else : ?>
					<?php foreach ( array_slice( $forecast_days, 0, 5 ) as $noesia_swa_forecast_day ) : ?>
						<div class="noesia-swa-forecast-box">
							<div class="noesia-swa-forecast-top">
								<div class="noesia-swa-forecast-day"><?php echo esc_html( isset( $noesia_swa_forecast_day['day_name'] ) ? (string) $noesia_swa_forecast_day['day_name'] : '—' ); ?></div>
								<div class="noesia-swa-forecast-date"><?php echo esc_html( isset( $noesia_swa_forecast_day['day_date'] ) ? (string) $noesia_swa_forecast_day['day_date'] : '—' ); ?></div>
							</div>
							<div class="noesia-swa-forecast-icon">
								<span class="noesia-swa-forecast-icon-emoji"><?php echo esc_html( isset( $noesia_swa_forecast_day['icon'] ) ? (string) $noesia_swa_forecast_day['icon'] : '🌡️' ); ?></span>
								<span class="noesia-swa-forecast-condition"><?php echo esc_html( isset( $noesia_swa_forecast_day['short'] ) ? (string) $noesia_swa_forecast_day['short'] : __( 'Weather', 'noesia-smart-waiter' ) ); ?></span>
							</div>
							<div class="noesia-swa-forecast-temp">
								<strong class="noesia-swa-forecast-high"><?php echo esc_html( isset( $noesia_swa_forecast_day['max_label'] ) ? (string) $noesia_swa_forecast_day['max_label'] : '—' ); ?></strong>
								<span class="noesia-swa-forecast-low"><?php echo esc_html( isset( $noesia_swa_forecast_day['min_label'] ) ? (string) $noesia_swa_forecast_day['min_label'] : '—' ); ?></span>
							</div>
							<div class="noesia-swa-forecast-rain">
    <?php 
    /* translators: %d: Percentage of rain probability */
    echo esc_html( isset( $noesia_swa_forecast_day['rain_label'] ) ? (string) $noesia_swa_forecast_day['rain_label'] : sprintf( __( 'Rain %d%%', 'noesia-smart-waiter' ), isset( $noesia_swa_forecast_day['pp'] ) ? absint( $noesia_swa_forecast_day['pp'] ) : 0 ) ); 
    ?>
</div>
						</div>
					<?php endforeach; ?>
				<?php endif; ?>
			</div>
		</div>
	</section>

	
	<div id="noesia-swa-dashboard-news-slot" class="noesia-swa-dashboard-news-slot"></div>

	<?php noesia_swa_dashboard_render_registry_area( $noesia_swa_dashboard_widgets_registry, 'footer' ); ?>
</div>

<?php do_action( 'noesia_swa_dashboard_after_grid', $noesia_swa_dashboard_widgets_registry ); ?>
		</div>

		<div class="noesia-swa-dashboard-mode-panel noesia-swa-dashboard-mode-panel--free" data-noesia-swa-dashboard-mode-panel="free" hidden>
			<div class="noesia-swa-dashboard-stream-shell noesia-swa-dashboard-stream-shell--free">
				<div class="noesia-swa-dashboard-stream-head">
					<div class="noesia-swa-dashboard-stream-copy">
						<div class="noesia-swa-dashboard-stream-kicker"><?php esc_html_e( 'LIVE FEED', 'noesia-smart-waiter' ); ?></div>
						<h3><?php esc_html_e( 'Latest headlines', 'noesia-smart-waiter' ); ?></h3>
					</div>
					<button type="button" class="noesia-swa-dashboard-layout-toggle" data-noesia-swa-dashboard-feed-toggle="1" aria-pressed="false">
						<?php esc_html_e( 'Grid view', 'noesia-smart-waiter' ); ?>
					</button>
				</div>
				<p class="noesia-swa-dashboard-stream-status" data-noesia-swa-dashboard-stream-status="free" aria-live="polite"><?php esc_html_e( 'Awaiting telemetry…', 'noesia-smart-waiter' ); ?></p>
				<div class="noesia-swa-dashboard-stream-grid" data-noesia-swa-dashboard-feed-layout="list">
					<ul class="noesia-swa-dashboard-stream-list" data-noesia-swa-dashboard-news-stream="free"></ul>
				</div>
			</div>
		</div>

		<div class="noesia-swa-dashboard-mode-panel noesia-swa-dashboard-mode-panel--matrix" data-noesia-swa-dashboard-mode-panel="matrix" hidden>
			<div class="noesia-swa-dashboard-matrix-shell">
				<div class="noesia-swa-dashboard-matrix-clock" data-noesia-swa-dashboard-matrix-clock="1" aria-label="<?php esc_attr_e( 'Current time', 'noesia-smart-waiter' ); ?>">00:00</div>
				<div class="noesia-swa-dashboard-matrix-cockpit">
					<div class="noesia-swa-dashboard-matrix-column noesia-swa-dashboard-matrix-column--left" data-noesia-swa-dashboard-matrix-left-stack="1">
						<section class="noesia-swa-dashboard-matrix-section noesia-swa-dashboard-matrix-section--bookmarks" aria-labelledby="noesia-swa-dashboard-matrix-bookmarks-title" data-noesia-swa-dashboard-matrix-section-id="bookmarks">
							<div class="noesia-swa-dashboard-matrix-section-head">
								<div>
									<div class="noesia-swa-dashboard-matrix-kicker"><?php esc_html_e( 'BOOKMARKS', 'noesia-smart-waiter' ); ?></div>
									<h3 id="noesia-swa-dashboard-matrix-bookmarks-title"><?php esc_html_e( 'Your saved destinations', 'noesia-smart-waiter' ); ?></h3>
								</div>
								<div class="noesia-swa-dashboard-matrix-section-controls">
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="up" data-noesia-swa-dashboard-matrix-section-target="bookmarks" aria-label="<?php esc_attr_e( 'Move bookmarks up', 'noesia-smart-waiter' ); ?>">↑</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="down" data-noesia-swa-dashboard-matrix-section-target="bookmarks" aria-label="<?php esc_attr_e( 'Move bookmarks down', 'noesia-smart-waiter' ); ?>">↓</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-toggle" data-noesia-swa-dashboard-matrix-section-toggle="1" data-noesia-swa-dashboard-matrix-section-target="bookmarks" aria-expanded="true"><?php esc_html_e( 'Collapse', 'noesia-smart-waiter' ); ?></button>
								</div>
							</div>

							<div class="noesia-swa-dashboard-matrix-section-body" data-noesia-swa-dashboard-matrix-section-body="bookmarks">
								<?php if ( ! empty( $noesia_swa_dashboard_bookmark_menu ) ) : ?>
									<div class="noesia-swa-dashboard-matrix-bookmarks-grid">
										<?php foreach ( $noesia_swa_dashboard_bookmark_menu as $noesia_swa_dashboard_bookmark ) : ?>
											<?php
											$noesia_swa_dashboard_bookmark_label = isset( $noesia_swa_dashboard_bookmark['name'] ) ? (string) $noesia_swa_dashboard_bookmark['name'] : '';
											$noesia_swa_dashboard_bookmark_label = preg_replace( '/[_-]+/', ' ', $noesia_swa_dashboard_bookmark_label );
											$noesia_swa_dashboard_bookmark_label = trim( preg_replace( '/\s+/', ' ', $noesia_swa_dashboard_bookmark_label ) );
											$noesia_swa_dashboard_bookmark_label = '' !== $noesia_swa_dashboard_bookmark_label ? $noesia_swa_dashboard_bookmark_label : __( 'Saved destination', 'noesia-smart-waiter' );
											$noesia_swa_dashboard_bookmark_host  = wp_parse_url( $noesia_swa_dashboard_bookmark['url'], PHP_URL_HOST );
											$noesia_swa_dashboard_bookmark_host  = is_string( $noesia_swa_dashboard_bookmark_host ) ? preg_replace( '/^www\./i', '', $noesia_swa_dashboard_bookmark_host ) : '';
											?>
											<a class="noesia-swa-dashboard-matrix-bookmark" href="<?php echo esc_url( $noesia_swa_dashboard_bookmark['url'] ); ?>" target="_blank" rel="noopener noreferrer">
												<span class="noesia-swa-dashboard-matrix-bookmark-label"><?php echo esc_html( $noesia_swa_dashboard_bookmark_label ); ?></span>
												<span class="noesia-swa-dashboard-matrix-bookmark-meta"><?php echo esc_html( '' !== $noesia_swa_dashboard_bookmark_host ? $noesia_swa_dashboard_bookmark_host : __( 'Open saved destination', 'noesia-smart-waiter' ) ); ?></span>
											</a>
										<?php endforeach; ?>
									</div>
								<?php else : ?>
									<div class="noesia-swa-dashboard-matrix-empty">
										<p><?php esc_html_e( 'No bookmarks yet. Add some now.', 'noesia-smart-waiter' ); ?></p>
										<button type="button" class="noesia-swa-dashboard-matrix-cta" data-noesia-swa-dashboard-prompt-target="settings" data-noesia-swa-dashboard-label="<?php esc_attr_e( 'Open settings', 'noesia-smart-waiter' ); ?>"><?php esc_html_e( 'Open settings', 'noesia-smart-waiter' ); ?></button>
									</div>
								<?php endif; ?>
							</div>
						</section>

						<section class="noesia-swa-dashboard-matrix-section noesia-swa-dashboard-matrix-section--telemetry" aria-labelledby="noesia-swa-dashboard-matrix-telemetry-title" data-noesia-swa-dashboard-matrix-section-id="telemetry">
							<div class="noesia-swa-dashboard-matrix-section-head">
								<div>
									<div class="noesia-swa-dashboard-matrix-kicker"><?php esc_html_e( 'LIVE SYSTEM TELEMETRY', 'noesia-smart-waiter' ); ?></div>
								</div>
								<div class="noesia-swa-dashboard-matrix-section-controls">
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="up" data-noesia-swa-dashboard-matrix-section-target="telemetry" aria-label="<?php esc_attr_e( 'Move telemetry up', 'noesia-smart-waiter' ); ?>">↑</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="down" data-noesia-swa-dashboard-matrix-section-target="telemetry" aria-label="<?php esc_attr_e( 'Move telemetry down', 'noesia-smart-waiter' ); ?>">↓</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-toggle noesia-swa-dashboard-matrix-section-toggle--freeze" data-noesia-swa-dashboard-telemetry-freeze="1" aria-pressed="false"><?php esc_html_e( 'Freeze', 'noesia-smart-waiter' ); ?></button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-toggle" data-noesia-swa-dashboard-matrix-section-toggle="1" data-noesia-swa-dashboard-matrix-section-target="telemetry" aria-expanded="true"><?php esc_html_e( 'Collapse', 'noesia-smart-waiter' ); ?></button>
								</div>
							</div>

							<div class="noesia-swa-dashboard-matrix-section-body" data-noesia-swa-dashboard-matrix-section-body="telemetry">
								<div class="noesia-swa-dashboard-telemetry-shell" data-noesia-swa-dashboard-telemetry-root="1">
									<div class="noesia-swa-dashboard-telemetry-status" data-noesia-swa-dashboard-telemetry-status="1"><?php esc_html_e( 'Awaiting runtime telemetry…', 'noesia-smart-waiter' ); ?></div>
									<div class="noesia-swa-dashboard-telemetry-terminal">
										<div class="noesia-swa-dashboard-telemetry-metrics" data-noesia-swa-dashboard-telemetry-metrics="1">
											<div class="noesia-swa-dashboard-telemetry-empty"><?php esc_html_e( 'Telemetry will populate when the matrix surface becomes active.', 'noesia-smart-waiter' ); ?></div>
										</div>
										<div class="noesia-swa-dashboard-telemetry-stream-head">
											<span><?php esc_html_e( 'LIVE ERROR STREAM', 'noesia-smart-waiter' ); ?></span>
											<span class="noesia-swa-dashboard-telemetry-updated" data-noesia-swa-dashboard-telemetry-updated="1">--:--:--</span>
										</div>
										<ul class="noesia-swa-dashboard-telemetry-stream" data-noesia-swa-dashboard-telemetry-stream="1">
											<li class="noesia-swa-dashboard-telemetry-stream-item is-state-ok"><?php esc_html_e( '[OK] No recent runtime events.', 'noesia-smart-waiter' ); ?></li>
										</ul>
									</div>
								</div>
							</div>
						</section>

						<section class="noesia-swa-dashboard-matrix-section noesia-swa-dashboard-matrix-section--activity" aria-labelledby="noesia-swa-dashboard-matrix-activity-title" data-noesia-swa-dashboard-matrix-section-id="activity">
							<div class="noesia-swa-dashboard-matrix-section-head">
								<div>
									<div class="noesia-swa-dashboard-matrix-kicker"><?php esc_html_e( 'RECENT ACTIVITY', 'noesia-smart-waiter' ); ?></div>
									<h3 id="noesia-swa-dashboard-matrix-activity-title"><?php esc_html_e( 'Latest workspace events', 'noesia-smart-waiter' ); ?></h3>
								</div>
								<div class="noesia-swa-dashboard-matrix-section-controls">
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="up" data-noesia-swa-dashboard-matrix-section-target="activity" aria-label="<?php esc_attr_e( 'Move recent activity up', 'noesia-smart-waiter' ); ?>">↑</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-move" data-noesia-swa-dashboard-matrix-section-move="down" data-noesia-swa-dashboard-matrix-section-target="activity" aria-label="<?php esc_attr_e( 'Move recent activity down', 'noesia-smart-waiter' ); ?>">↓</button>
									<button type="button" class="noesia-swa-dashboard-matrix-section-toggle" data-noesia-swa-dashboard-matrix-section-toggle="1" data-noesia-swa-dashboard-matrix-section-target="activity" aria-expanded="true"><?php esc_html_e( 'Collapse', 'noesia-smart-waiter' ); ?></button>
								</div>
							</div>

							<div class="noesia-swa-dashboard-matrix-section-body" data-noesia-swa-dashboard-matrix-section-body="activity">
								<div class="noesia-swa-dashboard-matrix-logs" aria-label="<?php esc_attr_e( 'Recent activity', 'noesia-smart-waiter' ); ?>">
									<ul class="noesia-swa-dashboard-matrix-activity-list">
										<?php foreach ( $noesia_swa_dashboard_recent_activity as $noesia_swa_dashboard_recent_item ) : ?>
											<li class="noesia-swa-dashboard-matrix-activity-item">
												<span class="noesia-swa-dashboard-matrix-activity-label"><?php echo esc_html( isset( $noesia_swa_dashboard_recent_item['label'] ) ? (string) $noesia_swa_dashboard_recent_item['label'] : '' ); ?></span>
												<span class="noesia-swa-dashboard-matrix-activity-value"><?php echo esc_html( isset( $noesia_swa_dashboard_recent_item['text'] ) ? (string) $noesia_swa_dashboard_recent_item['text'] : '' ); ?></span>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
						</section>
					</div>

					<div class="noesia-swa-dashboard-matrix-column noesia-swa-dashboard-matrix-column--right">
						<section class="noesia-swa-dashboard-matrix-section noesia-swa-dashboard-matrix-section--links" aria-labelledby="noesia-swa-dashboard-matrix-links-title" data-noesia-swa-dashboard-matrix-section-id="links" data-noesia-swa-dashboard-matrix-links-section="1">
							<div class="noesia-swa-dashboard-matrix-section-head">
								<div>
									<div class="noesia-swa-dashboard-matrix-kicker"><?php esc_html_e( 'QUICK LINKS', 'noesia-smart-waiter' ); ?></div>
									<h3 id="noesia-swa-dashboard-matrix-links-title"><?php esc_html_e( 'Run a Noesia command', 'noesia-smart-waiter' ); ?></h3>
								</div>
								<div class="noesia-swa-dashboard-matrix-section-controls">
									<button type="button" class="noesia-swa-dashboard-matrix-section-toggle" data-noesia-swa-dashboard-matrix-section-toggle="1" data-noesia-swa-dashboard-matrix-section-target="links" data-noesia-swa-dashboard-matrix-links-toggle="1" aria-expanded="true"><?php esc_html_e( 'Collapse', 'noesia-smart-waiter' ); ?></button>
								</div>
							</div>

							<div class="noesia-swa-dashboard-matrix-section-body noesia-swa-dashboard-matrix-links-body" data-noesia-swa-dashboard-matrix-section-body="links" data-noesia-swa-dashboard-matrix-links-body="1">
								<div class="noesia-swa-dashboard-matrix-links" aria-label="<?php esc_attr_e( 'Noesia quick actions', 'noesia-smart-waiter' ); ?>" data-noesia-swa-dashboard-quick-links="1">
									<?php foreach ( $noesia_swa_dashboard_quick_links as $noesia_swa_dashboard_quick_link ) : ?>
										<div class="noesia-swa-dashboard-matrix-link-row" data-noesia-swa-dashboard-quick-link-id="<?php echo esc_attr( $noesia_swa_dashboard_quick_link['id'] ); ?>">
											<button type="button" class="noesia-swa-dashboard-matrix-link" data-noesia-swa-dashboard-prompt-target="<?php echo esc_attr( $noesia_swa_dashboard_quick_link['target'] ); ?>" data-noesia-swa-dashboard-label="<?php echo esc_attr( $noesia_swa_dashboard_quick_link['title'] ); ?>"<?php echo ! empty( $noesia_swa_dashboard_quick_link['route'] ) ? ' data-noesia-swa-dashboard-route="' . esc_attr( (string) $noesia_swa_dashboard_quick_link['route'] ) . '"' : ''; ?><?php echo ! empty( $noesia_swa_dashboard_quick_link['pro'] ) ? ' data-noesia-swa-dashboard-pro-link="1"' : ''; ?>>
												<span class="noesia-swa-dashboard-matrix-link-prefix">&gt;</span>
												<span class="noesia-swa-dashboard-matrix-link-copy">
													<span class="noesia-swa-dashboard-matrix-link-title"><?php echo esc_html( $noesia_swa_dashboard_quick_link['title'] ); ?></span>
													<span class="noesia-swa-dashboard-matrix-link-meta"><?php echo esc_html( $noesia_swa_dashboard_quick_link['description'] ); ?></span>
												</span>
											</button>
											<div class="noesia-swa-dashboard-matrix-link-controls">
												<button type="button" class="noesia-swa-dashboard-matrix-link-move" data-noesia-swa-dashboard-quick-link-move="up" data-noesia-swa-dashboard-quick-link-target="<?php echo esc_attr( $noesia_swa_dashboard_quick_link['id'] ); ?>" aria-label="<?php esc_attr_e( 'Move command up', 'noesia-smart-waiter' ); ?>">↑</button>
												<button type="button" class="noesia-swa-dashboard-matrix-link-move" data-noesia-swa-dashboard-quick-link-move="down" data-noesia-swa-dashboard-quick-link-target="<?php echo esc_attr( $noesia_swa_dashboard_quick_link['id'] ); ?>" aria-label="<?php esc_attr_e( 'Move command down', 'noesia-smart-waiter' ); ?>">↓</button>
											</div>
										</div>
									<?php endforeach; ?>
								</div>
							</div>
						</section>
					</div>
				</div>

				<div class="noesia-swa-dashboard-stream-shell noesia-swa-dashboard-stream-shell--matrix">
					<div class="noesia-swa-dashboard-stream-head">
						<div class="noesia-swa-dashboard-stream-copy">
							<div class="noesia-swa-dashboard-stream-kicker"><?php esc_html_e( 'LIVE FEED', 'noesia-smart-waiter' ); ?></div>
							<h3><?php esc_html_e( 'Latest headlines', 'noesia-smart-waiter' ); ?></h3>
						</div>
						<button type="button" class="noesia-swa-dashboard-layout-toggle" data-noesia-swa-dashboard-feed-toggle="1" aria-pressed="false">
							<?php esc_html_e( 'Grid view', 'noesia-smart-waiter' ); ?>
						</button>
					</div>
					<p class="noesia-swa-dashboard-stream-status" data-noesia-swa-dashboard-stream-status="matrix" aria-live="polite"><?php esc_html_e( 'Awaiting telemetry…', 'noesia-smart-waiter' ); ?></p>
					<div class="noesia-swa-dashboard-stream-grid" data-noesia-swa-dashboard-feed-layout="list">
						<ul class="noesia-swa-dashboard-stream-list" data-noesia-swa-dashboard-news-stream="matrix"></ul>
					</div>
				</div>
			</div>
		</div>

		<div class="noesia-swa-dashboard-mode-panel noesia-swa-dashboard-mode-panel--apps" data-noesia-swa-dashboard-mode-panel="apps" hidden>
			<div class="noesia-swa-dashboard-apps-shell" data-noesia-swa-dashboard-apps-shell="1" data-noesia-swa-dashboard-apps-logo-url="<?php echo esc_url( $noesia_swa_dashboard_omni_logo_url ); ?>" data-noesia-swa-dashboard-apps-fallback="<?php echo esc_attr( wp_json_encode( $noesia_swa_dashboard_apps_grid ) ); ?>">
				<div class="noesia-swa-dashboard-apps-grid" data-noesia-swa-dashboard-apps-grid="1" aria-label="<?php esc_attr_e( 'Noesia applications', 'noesia-smart-waiter' ); ?>"></div>
			</div>
		</div>

		<div class="noesia-swa-dashboard-mode-panel noesia-swa-dashboard-mode-panel--world" data-noesia-swa-dashboard-mode-panel="world" hidden>
			<div
				class="noesia-swa-dashboard-world-shell"
				data-noesia-swa-dashboard-world-root="1"
				data-noesia-swa-dashboard-world-live-enabled="<?php echo $world_live_enabled ? '1' : '0'; ?>"
				data-noesia-swa-dashboard-world-locale="<?php echo esc_attr( $noesia_swa_dashboard_world_locale ); ?>"
				data-noesia-swa-dashboard-world-language="<?php echo esc_attr( $dashboard_language ); ?>"
				data-noesia-swa-dashboard-world-focus-local="<?php echo esc_attr( $world_focus_local_label ); ?>"
				data-noesia-swa-dashboard-world-focus-country="<?php echo esc_attr( $world_focus_country_label ); ?>"
				data-noesia-swa-dashboard-world-focus-global="<?php echo esc_attr( $world_focus_global_label ); ?>"
				data-noesia-swa-dashboard-world-news-country="<?php echo esc_attr( $news_country ); ?>"
				data-noesia-swa-dashboard-world-messages="<?php echo esc_attr( wp_json_encode( $noesia_swa_dashboard_world_messages ) ); ?>"
				data-noesia-swa-dashboard-world-map-points="<?php echo esc_attr( wp_json_encode( $world_map_points ) ); ?>"
			>
				<header class="noesia-swa-dashboard-world-hero">
					<div>
						<div class="noesia-swa-dashboard-world-kicker"><?php esc_html_e( 'NOESIA UNIVERSE', 'noesia-smart-waiter' ); ?></div>
						<h3><?php esc_html_e( 'Feel the World', 'noesia-smart-waiter' ); ?></h3>
						<p><?php esc_html_e( 'Focus on your place, compare cities, follow the latest planet signals, and jump from local context to global awareness without leaving the dashboard.', 'noesia-smart-waiter' ); ?></p>
					</div>
				</header>

				<div class="noesia-swa-dashboard-world-grid" data-noesia-swa-dashboard-world-grid="1">
					<section class="noesia-card noesia-swa-dashboard-world-box" data-noesia-swa-dashboard-world-box-id="my-world">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'MY WORLD', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'Local Conditions', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="my-world" aria-label="<?php esc_attr_e( 'Move My World up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="my-world" aria-label="<?php esc_attr_e( 'Move My World down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<div class="noesia-swa-dashboard-world-local-summary">
								<div class="noesia-swa-dashboard-world-local-place"><?php echo esc_html( ! empty( $world_my_world['place'] ) ? (string) $world_my_world['place'] : __( 'Weather location not configured.', 'noesia-smart-waiter' ) ); ?></div>
								<div class="noesia-swa-dashboard-world-local-now"><?php echo esc_html( isset( $world_my_world['now_label'] ) ? (string) $world_my_world['now_label'] : '—' ); ?></div>
								<div class="noesia-swa-dashboard-world-local-condition"><?php echo esc_html( isset( $world_my_world['condition'] ) ? (string) $world_my_world['condition'] : '' ); ?></div>
								<?php if ( ! empty( $world_my_world['tip'] ) ) : ?>
									<p class="noesia-swa-dashboard-world-local-tip"><?php echo esc_html( (string) $world_my_world['tip'] ); ?></p>
								<?php endif; ?>
							</div>

							<div class="noesia-swa-dashboard-world-local-metrics">
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Min', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['min_label'] ) ? (string) $world_my_world['min_label'] : '—' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Max', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['max_label'] ) ? (string) $world_my_world['max_label'] : '—' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Rain', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['rain_label'] ) ? (string) $world_my_world['rain_label'] : '—' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Sunrise', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['sunrise_label'] ) ? (string) $world_my_world['sunrise_label'] : '—' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Sunset', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['sunset_label'] ) ? (string) $world_my_world['sunset_label'] : '—' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Air Quality', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( isset( $world_my_world['air_quality_label'] ) ? (string) $world_my_world['air_quality_label'] : 'AQI —' ); ?></strong>
								</div>
							</div>

							<div class="noesia-swa-dashboard-world-alert is-<?php echo esc_attr( isset( $world_my_world['alert_level'] ) ? (string) $world_my_world['alert_level'] : 'calm' ); ?>">
								<strong><?php echo esc_html( isset( $world_my_world['alert_title'] ) ? (string) $world_my_world['alert_title'] : __( 'Steady service window', 'noesia-smart-waiter' ) ); ?></strong>
								<p><?php echo esc_html( isset( $world_my_world['alert_text'] ) ? (string) $world_my_world['alert_text'] : '' ); ?></p>
							</div>

							<?php if ( ! empty( $world_forecast_days ) ) : ?>
								<div class="noesia-swa-dashboard-world-local-forecast" aria-label="<?php esc_attr_e( '3 day forecast', 'noesia-smart-waiter' ); ?>">
									<?php foreach ( $world_forecast_days as $world_forecast_day ) : ?>
										<div class="noesia-swa-dashboard-world-local-forecast-card">
											<div class="noesia-swa-dashboard-world-local-forecast-head">
												<span class="noesia-swa-dashboard-world-local-forecast-day"><?php echo esc_html( isset( $world_forecast_day['day_name'] ) ? (string) $world_forecast_day['day_name'] : '—' ); ?></span>
												<span class="noesia-swa-dashboard-world-local-forecast-icon"><?php echo esc_html( isset( $world_forecast_day['icon'] ) ? (string) $world_forecast_day['icon'] : '🌡️' ); ?></span>
											</div>
											<strong><?php echo esc_html( trim( ( isset( $world_forecast_day['max_label'] ) ? (string) $world_forecast_day['max_label'] : '—' ) . ' / ' . ( isset( $world_forecast_day['min_label'] ) ? (string) $world_forecast_day['min_label'] : '—' ) ) ); ?></strong>
											<small><?php echo esc_html( isset( $world_forecast_day['rain_label'] ) ? (string) $world_forecast_day['rain_label'] : '—' ); ?></small>
										</div>
									<?php endforeach; ?>
								</div>
							<?php endif; ?>

							<div class="noesia-swa-dashboard-world-meta">
								<span><?php echo esc_html( isset( $world_my_world['source_label'] ) ? (string) $world_my_world['source_label'] : 'Open-Meteo' ); ?></span>
								<span><?php esc_html_e( 'Updated', 'noesia-smart-waiter' ); ?> <?php echo esc_html( isset( $world_my_world['updated_label'] ) ? (string) $world_my_world['updated_label'] : '—' ); ?></span>
							</div>
						</div>
					</section>

					<section class="noesia-card noesia-swa-dashboard-world-box noesia-swa-dashboard-world-box--map noesia-swa-card--span2" data-noesia-swa-dashboard-world-box-id="world-map">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'WORLD SURFACE', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'Planet Surface Map', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="world-map" aria-label="<?php esc_attr_e( 'Move World Map up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="world-map" aria-label="<?php esc_attr_e( 'Move World Map down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<div class="noesia-swa-dashboard-world-layerbar" role="toolbar" aria-label="<?php esc_attr_e( 'World map layers', 'noesia-smart-waiter' ); ?>">
								<button type="button" class="noesia-swa-dashboard-world-layer is-active" data-noesia-swa-dashboard-world-layer="weather" aria-pressed="true"><?php esc_html_e( 'Weather', 'noesia-smart-waiter' ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-layer is-active" data-noesia-swa-dashboard-world-layer="earthquake" aria-pressed="true"><?php esc_html_e( 'Earthquakes', 'noesia-smart-waiter' ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-layer is-active" data-noesia-swa-dashboard-world-layer="disaster" aria-pressed="true"><?php esc_html_e( 'Disasters', 'noesia-smart-waiter' ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-layer is-active" data-noesia-swa-dashboard-world-layer="orbit" aria-pressed="true"><?php esc_html_e( 'Orbit', 'noesia-smart-waiter' ); ?></button>
							</div>

							<div class="noesia-swa-dashboard-world-map-shell">
								<div class="noesia-swa-dashboard-world-map-canvas" data-noesia-swa-dashboard-world-map-canvas="1" aria-label="<?php esc_attr_e( 'World signals map', 'noesia-smart-waiter' ); ?>">
									<div class="noesia-swa-dashboard-world-map-overlay" data-noesia-swa-dashboard-world-map-overlay="1"></div>
									<div class="noesia-swa-dashboard-world-map-popover" data-noesia-swa-dashboard-world-map-popover="1" hidden></div>
									<div class="noesia-swa-dashboard-world-map-empty" data-noesia-swa-dashboard-world-map-empty="1" hidden><?php esc_html_e( 'No world signals available right now.', 'noesia-smart-waiter' ); ?></div>
								</div>

								<div class="noesia-swa-dashboard-world-map-side">
									<div class="noesia-swa-dashboard-world-map-stats">
										<div class="noesia-swa-dashboard-world-map-stat">
											<span><?php esc_html_e( 'Signals', 'noesia-smart-waiter' ); ?></span>
											<strong data-noesia-swa-dashboard-world-signal-count="1"><?php echo esc_html( (string) count( $world_map_points ) ); ?></strong>
										</div>
										<div class="noesia-swa-dashboard-world-map-stat">
											<span><?php esc_html_e( 'Quakes 24h', 'noesia-smart-waiter' ); ?></span>
											<strong data-noesia-swa-dashboard-world-quake-count="1"><?php echo esc_html( isset( $world_earthquakes['count_24h'] ) ? (string) (int) $world_earthquakes['count_24h'] : '0' ); ?></strong>
										</div>
										<div class="noesia-swa-dashboard-world-map-stat">
											<span><?php esc_html_e( 'Major Alerts', 'noesia-smart-waiter' ); ?></span>
											<strong data-noesia-swa-dashboard-world-event-count="1"><?php echo esc_html( isset( $world_events['count'] ) ? (string) (int) $world_events['count'] : '0' ); ?></strong>
										</div>
									</div>
									<div class="noesia-swa-dashboard-world-map-list" data-noesia-swa-dashboard-world-map-list="1"></div>
								</div>
							</div>

							<div class="noesia-swa-dashboard-world-meta">
								<span><?php esc_html_e( 'Sources', 'noesia-smart-waiter' ); ?>: Open-Meteo, USGS, GDACS, wheretheiss.at</span>
								<span><?php esc_html_e( 'Tap a signal to inspect it, then open the source in a new tab.', 'noesia-smart-waiter' ); ?></span>
							</div>
						</div>
					</section>

					<section class="noesia-card noesia-swa-dashboard-world-box noesia-swa-card--span2" data-noesia-swa-dashboard-world-box-id="world-window">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'ISS LIVE', 'noesia-smart-waiter' ); ?></div>
								<h4><?php echo esc_html( isset( $world_window['title'] ) ? (string) $world_window['title'] : __( 'ISS Live', 'noesia-smart-waiter' ) ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="world-window" aria-label="<?php esc_attr_e( 'Move ISS Live up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="world-window" aria-label="<?php esc_attr_e( 'Move ISS Live down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<div class="noesia-swa-dashboard-world-window-shell">
								<div class="noesia-swa-dashboard-world-window-frame">
									<div
										class="noesia-swa-dashboard-world-orbit-scene"
										data-noesia-swa-dashboard-world-orbit-scene="1"
										data-noesia-swa-dashboard-world-scene="earth"
										data-noesia-swa-dashboard-world-orbit-lat="<?php echo esc_attr( isset( $world_iss['lat'] ) ? (string) $world_iss['lat'] : '' ); ?>"
										data-noesia-swa-dashboard-world-orbit-lng="<?php echo esc_attr( isset( $world_iss['lng'] ) ? (string) $world_iss['lng'] : '' ); ?>"
									>
										<div class="noesia-swa-dashboard-world-orbit-ring"></div>
										<div class="noesia-swa-dashboard-world-orbit-ring noesia-swa-dashboard-world-orbit-ring--secondary"></div>
										<div class="noesia-swa-dashboard-world-orbit-ring noesia-swa-dashboard-world-orbit-ring--tertiary"></div>
										<div class="noesia-swa-dashboard-world-orbit-path"></div>
										<div class="noesia-swa-dashboard-world-orbit-earth"></div>
										<div class="noesia-swa-dashboard-world-orbit-earth noesia-swa-dashboard-world-orbit-earth--layer"></div>
										<div class="noesia-swa-dashboard-world-orbit-marker" data-noesia-swa-dashboard-world-orbit-marker="1"></div>
									<div class="noesia-swa-dashboard-world-orbit-caption">
										<span><?php esc_html_e( 'Live ISS telemetry', 'noesia-smart-waiter' ); ?></span>
										<strong data-noesia-swa-dashboard-world-window-region="1"><?php echo esc_html( isset( $world_iss['region_label'] ) ? (string) $world_iss['region_label'] : __( 'Live orbit unavailable right now', 'noesia-smart-waiter' ) ); ?></strong>
									</div>
									</div>
								</div>

								<div class="noesia-swa-dashboard-world-window-copy">
									<p data-noesia-swa-dashboard-world-window-description="1"><?php echo esc_html( isset( $world_window['description'] ) ? (string) $world_window['description'] : '' ); ?></p>
									<div class="noesia-swa-dashboard-world-local-metrics noesia-swa-dashboard-world-local-metrics--focus">
										<div class="noesia-swa-dashboard-world-local-metric">
											<span><?php esc_html_e( 'ISS now above', 'noesia-smart-waiter' ); ?></span>
											<strong data-noesia-swa-dashboard-world-window-label="1"><?php echo esc_html( isset( $world_window['window_label'] ) ? (string) $world_window['window_label'] : __( 'ISS now above Earth', 'noesia-smart-waiter' ) ); ?></strong>
										</div>
										<div class="noesia-swa-dashboard-world-local-metric">
											<span><?php esc_html_e( 'Altitude', 'noesia-smart-waiter' ); ?></span>
											<strong><?php echo esc_html( isset( $world_iss['altitude_label'] ) ? (string) $world_iss['altitude_label'] : '—' ); ?></strong>
										</div>
										<div class="noesia-swa-dashboard-world-local-metric">
											<span><?php esc_html_e( 'Coordinates', 'noesia-smart-waiter' ); ?></span>
											<strong data-noesia-swa-dashboard-world-window-coordinates="1"><?php echo esc_html( $world_iss_coordinates ); ?></strong>
										</div>
									</div>
									<div class="noesia-swa-dashboard-world-window-actions">
										<a class="noesia-swa-dashboard-world-window-watch" href="<?php echo esc_url( isset( $world_window['watch_url'] ) ? (string) $world_window['watch_url'] : 'https://www.nasa.gov/live/' ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( isset( $world_window['watch_label'] ) ? (string) $world_window['watch_label'] : $noesia_swa_dashboard_world_messages['world_window_watch'] ); ?></a>
										<div class="noesia-swa-dashboard-world-meta">
											<span><?php echo esc_html( isset( $world_window['source_label'] ) ? (string) $world_window['source_label'] : __( 'Official NASA gateway', 'noesia-smart-waiter' ) ); ?></span>
											<span data-noesia-swa-dashboard-world-window-updated="1"><?php esc_html_e( 'Updated', 'noesia-smart-waiter' ); ?> <?php echo esc_html( isset( $world_iss['updated_label'] ) ? (string) $world_iss['updated_label'] : '—' ); ?></span>
										</div>
									</div>
								</div>
							</div>
						</div>
					</section>

					<section class="noesia-card noesia-swa-dashboard-world-box" data-noesia-swa-dashboard-world-box-id="world-brief">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'WORLD BRIEF WITH FOCUS', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'What Matters Now', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="world-brief" aria-label="<?php esc_attr_e( 'Move World Brief up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="world-brief" aria-label="<?php esc_attr_e( 'Move World Brief down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<div class="noesia-swa-dashboard-world-brief-focus-label" data-noesia-swa-dashboard-world-brief-focus-label="1"><?php echo esc_html( $world_focus_country_label ); ?></div>
						<p class="noesia-swa-dashboard-world-focus-copy noesia-swa-dashboard-world-focus-copy--brief"><?php esc_html_e( 'This brief follows Jump To A Place and uses your selected dashboard language whenever a matching feed is available.', 'noesia-smart-waiter' ); ?></p>
						<p class="noesia-swa-dashboard-world-brief-status" data-noesia-swa-dashboard-world-brief-status="1"><?php echo esc_html( $noesia_swa_dashboard_world_messages['awaiting_brief'] ); ?></p>
							<ul class="noesia-swa-dashboard-world-brief-list" data-noesia-swa-dashboard-world-brief-list="1">
								<li class="noesia-swa-dashboard-world-brief-placeholder"><span></span></li>
								<li class="noesia-swa-dashboard-world-brief-placeholder"><span></span></li>
								<li class="noesia-swa-dashboard-world-brief-placeholder"><span></span></li>
								<li class="noesia-swa-dashboard-world-brief-placeholder"><span></span></li>
								<li class="noesia-swa-dashboard-world-brief-placeholder"><span></span></li>
							</ul>
						</div>
					</section>

					<section class="noesia-card noesia-swa-dashboard-world-box" data-noesia-swa-dashboard-world-box-id="earth-live">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'PLANET TIMELINE', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'Signals On The Planet', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="earth-live" aria-label="<?php esc_attr_e( 'Move Signals On The Planet up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="earth-live" aria-label="<?php esc_attr_e( 'Move Signals On The Planet down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<div class="noesia-swa-dashboard-world-earth-metrics">
								<div class="noesia-swa-dashboard-world-earth-metric">
									<span><?php esc_html_e( 'Quakes 24h', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-earth-quake-count="1"><?php echo esc_html( isset( $world_earthquakes['count_24h'] ) ? (string) (int) $world_earthquakes['count_24h'] : '0' ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-earth-metric">
									<span><?php esc_html_e( 'Largest Event', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-earth-largest="1"><?php echo esc_html( isset( $world_earthquakes['largest_label'] ) ? (string) $world_earthquakes['largest_label'] : '—' ); ?></strong>
									<small data-noesia-swa-dashboard-world-earth-largest-place="1"><?php echo esc_html( isset( $world_earthquakes['largest_place'] ) ? (string) $world_earthquakes['largest_place'] : '' ); ?></small>
								</div>
								<div class="noesia-swa-dashboard-world-earth-metric">
									<span><?php esc_html_e( 'Live Alerts', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-earth-event-count="1"><?php echo esc_html( isset( $world_events['count'] ) ? (string) (int) $world_events['count'] : '0' ); ?></strong>
									<small><?php esc_html_e( 'GDACS major events', 'noesia-smart-waiter' ); ?></small>
								</div>
							</div>

							<div class="noesia-swa-dashboard-world-earth-stream">
								<?php if ( ! empty( $world_live_stream ) && is_array( $world_live_stream ) ) : ?>
									<ul class="noesia-swa-dashboard-world-earth-list" data-noesia-swa-dashboard-world-earth-list="1">
										<?php foreach ( $world_live_stream as $world_live_item ) : ?>
											<li class="noesia-swa-dashboard-world-earth-item">
												<?php $world_live_href = ! empty( $world_live_item['source_url'] ) ? esc_url( (string) $world_live_item['source_url'] ) : ''; ?>
												<?php if ( '' !== $world_live_href ) : ?>
													<a class="noesia-swa-dashboard-world-earth-item-link" href="<?php echo esc_url( $world_live_href ); ?>" target="_blank" rel="noopener noreferrer">
												<?php endif; ?>
													<div class="noesia-swa-dashboard-world-earth-item-copy">
														<div class="noesia-swa-dashboard-world-earth-item-topline">
															<strong><?php echo esc_html( isset( $world_live_item['label'] ) ? (string) $world_live_item['label'] : __( 'Signal', 'noesia-smart-waiter' ) ); ?></strong>
															<?php if ( ! empty( $world_live_item['pill_label'] ) ) : ?>
																<span class="noesia-swa-dashboard-world-earth-item-pill is-<?php echo esc_attr( ! empty( $world_live_item['pill_class'] ) ? sanitize_html_class( (string) $world_live_item['pill_class'] ) : 'moderate' ); ?>"><?php echo esc_html( (string) $world_live_item['pill_label'] ); ?></span>
															<?php endif; ?>
														</div>
														<span><?php echo esc_html( isset( $world_live_item['meta'] ) ? (string) $world_live_item['meta'] : '—' ); ?></span>
													</div>
													<?php if ( '' !== $world_live_href ) : ?>
														<span class="noesia-swa-dashboard-world-earth-item-cta"><?php echo esc_html( isset( $world_live_item['action_label'] ) ? (string) $world_live_item['action_label'] : __( 'Open report', 'noesia-smart-waiter' ) ); ?></span>
													<?php endif; ?>
												<?php if ( '' !== $world_live_href ) : ?>
													</a>
												<?php endif; ?>
											</li>
										<?php endforeach; ?>
									</ul>
								<?php elseif ( ! empty( $world_earthquakes['items'] ) && is_array( $world_earthquakes['items'] ) ) : ?>
									<ul class="noesia-swa-dashboard-world-earth-list" data-noesia-swa-dashboard-world-earth-list="1">
										<?php foreach ( $world_earthquakes['items'] as $world_quake ) : ?>
											<li class="noesia-swa-dashboard-world-earth-item">
												<?php $world_quake_href = ! empty( $world_quake['source_url'] ) ? esc_url( (string) $world_quake['source_url'] ) : ''; ?>
												<?php if ( '' !== $world_quake_href ) : ?>
													<a class="noesia-swa-dashboard-world-earth-item-link" href="<?php echo esc_url( $world_quake_href ); ?>" target="_blank" rel="noopener noreferrer">
												<?php endif; ?>
													<div class="noesia-swa-dashboard-world-earth-item-copy">
														<div class="noesia-swa-dashboard-world-earth-item-topline">
															<strong><?php echo esc_html( isset( $world_quake['label'] ) ? (string) $world_quake['label'] : __( 'Earthquake', 'noesia-smart-waiter' ) ); ?></strong>
															<?php if ( ! empty( $world_quake['severity'] ) ) : ?>
																<span class="noesia-swa-dashboard-world-earth-item-pill is-<?php echo esc_attr( sanitize_html_class( (string) $world_quake['severity'] ) ); ?>"><?php echo esc_html( ucfirst( (string) $world_quake['severity'] ) ); ?></span>
															<?php endif; ?>
														</div>
														<span><?php echo esc_html( isset( $world_quake['updated_label'] ) ? (string) $world_quake['updated_label'] : '—' ); ?></span>
													</div>
													<?php if ( '' !== $world_quake_href ) : ?>
														<span class="noesia-swa-dashboard-world-earth-item-cta"><?php esc_html_e( 'Open report', 'noesia-smart-waiter' ); ?></span>
													<?php endif; ?>
												<?php if ( '' !== $world_quake_href ) : ?>
													</a>
												<?php endif; ?>
											</li>
										<?php endforeach; ?>
									</ul>
								<?php else : ?>
									<div class="noesia-swa-dashboard-world-empty-note" data-noesia-swa-dashboard-world-earth-list="1"><?php esc_html_e( 'Planet feed is waiting for the next update.', 'noesia-smart-waiter' ); ?></div>
								<?php endif; ?>
							</div>

							<div class="noesia-swa-dashboard-world-meta">
								<span><?php esc_html_e( 'Sources', 'noesia-smart-waiter' ); ?>: USGS, GDACS, wheretheiss.at</span>
								<span data-noesia-swa-dashboard-world-earth-updated="1"><?php esc_html_e( 'Updated', 'noesia-smart-waiter' ); ?> <?php echo esc_html( isset( $world_earthquakes['updated_label'] ) ? (string) $world_earthquakes['updated_label'] : '—' ); ?></span>
							</div>
						</div>
					</section>

					<section class="noesia-card noesia-swa-dashboard-world-box" data-noesia-swa-dashboard-world-box-id="world-focus">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'WORLD FOCUS', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'Jump To A Place', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="world-focus" aria-label="<?php esc_attr_e( 'Move World Focus up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="world-focus" aria-label="<?php esc_attr_e( 'Move World Focus down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
							<p class="noesia-swa-dashboard-world-focus-copy"><?php esc_html_e( 'Choose your place, your country or the whole planet. You can also type a city or country to move the globe, the brief and the compare cards around that area.', 'noesia-smart-waiter' ); ?></p>

							<div class="noesia-swa-dashboard-world-focus-bar" role="tablist" aria-label="<?php esc_attr_e( 'World focus', 'noesia-smart-waiter' ); ?>">
								<button type="button" class="noesia-swa-dashboard-world-focus-button is-active" data-noesia-swa-dashboard-world-focus="local" aria-pressed="true"><?php echo esc_html( $world_focus_local_label ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-focus-button" data-noesia-swa-dashboard-world-focus="country" aria-pressed="false"><?php echo esc_html( $world_focus_country_label ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-focus-button" data-noesia-swa-dashboard-world-focus="global" aria-pressed="false"><?php echo esc_html( $world_focus_global_label ); ?></button>
							</div>

							<div class="noesia-swa-dashboard-world-focus-search" data-noesia-swa-dashboard-world-search-form="1">
								<input
									type="search"
									class="noesia-swa-dashboard-world-focus-search-input"
									data-noesia-swa-dashboard-world-search-input="1"
									placeholder="<?php echo esc_attr( $noesia_swa_dashboard_world_messages['world_focus_search_placeholder'] ); ?>"
									autocomplete="off"
									spellcheck="false"
								/>
								<button type="button" class="noesia-swa-dashboard-world-focus-search-button" data-noesia-swa-dashboard-world-search-submit="1"><?php echo esc_html( $noesia_swa_dashboard_world_messages['world_focus_search_button'] ); ?></button>
								<button type="button" class="noesia-swa-dashboard-world-focus-search-clear" data-noesia-swa-dashboard-world-search-clear="1" hidden><?php echo esc_html( $noesia_swa_dashboard_world_messages['world_focus_clear'] ); ?></button>
							</div>

							<div class="noesia-swa-dashboard-world-focus-status" data-noesia-swa-dashboard-world-search-status="1"><?php echo esc_html( $noesia_swa_dashboard_world_messages['world_focus_hint'] ); ?></div>

							<div class="noesia-swa-dashboard-world-recent-searches" data-noesia-swa-dashboard-world-recent-searches="1" hidden>
								<span><?php esc_html_e( 'Recent searches', 'noesia-smart-waiter' ); ?></span>
								<div class="noesia-swa-dashboard-world-recent-searches-list" data-noesia-swa-dashboard-world-recent-searches-list="1"></div>
							</div>

							<div class="noesia-swa-dashboard-world-local-metrics noesia-swa-dashboard-world-local-metrics--focus">
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'View', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-focus-active-label="1"><?php echo esc_html( $world_focus_local_label ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric">
									<span><?php esc_html_e( 'Looking At', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-focus-target-label="1"><?php echo esc_html( $world_focus_default_target ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric noesia-swa-dashboard-world-local-metric--telemetry">
									<span><?php esc_html_e( 'ISS Now Above', 'noesia-smart-waiter' ); ?></span>
									<strong><?php echo esc_html( ! empty( $world_iss['region_label'] ) ? (string) $world_iss['region_label'] : __( 'Live orbit unavailable right now', 'noesia-smart-waiter' ) ); ?></strong>
								</div>
								<div class="noesia-swa-dashboard-world-local-metric noesia-swa-dashboard-world-local-metric--telemetry">
									<span><?php esc_html_e( 'Live Coordinates', 'noesia-smart-waiter' ); ?></span>
									<strong data-noesia-swa-dashboard-world-focus-coordinates="1"><?php echo esc_html( $world_iss_coordinates ); ?></strong>
								</div>
							</div>

							<div class="noesia-swa-dashboard-world-meta">
								<span><?php esc_html_e( 'Search can snap the globe to a city or country when matching live signals or compare cities are available.', 'noesia-smart-waiter' ); ?></span>
								<span><?php esc_html_e( 'Orbit labels stay honest at continent or ocean level until a country-level dataset is added.', 'noesia-smart-waiter' ); ?></span>
							</div>
						</div>
					</section>

				<section class="noesia-card noesia-swa-dashboard-world-box" data-noesia-swa-dashboard-world-box-id="world-compare">
						<div class="noesia-swa-dashboard-world-box-head">
							<div>
								<div class="noesia-swa-dashboard-world-box-kicker"><?php esc_html_e( 'WORLD COMPARE', 'noesia-smart-waiter' ); ?></div>
								<h4><?php esc_html_e( 'Cities In Motion', 'noesia-smart-waiter' ); ?></h4>
							</div>
							<div class="noesia-swa-dashboard-world-box-controls">
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="up" data-noesia-swa-dashboard-world-box-target="world-compare" aria-label="<?php esc_attr_e( 'Move World Compare up', 'noesia-smart-waiter' ); ?>">↑</button>
								<button type="button" class="noesia-swa-dashboard-world-box-move" data-noesia-swa-dashboard-world-box-move="down" data-noesia-swa-dashboard-world-box-target="world-compare" aria-label="<?php esc_attr_e( 'Move World Compare down', 'noesia-smart-waiter' ); ?>">↓</button>
							</div>
						</div>

						<div class="noesia-swa-dashboard-world-box-body">
								<div class="noesia-swa-dashboard-world-brief-focus-label"><?php esc_html_e( 'Time, temperature and daylight rhythm across your selected cities.', 'noesia-smart-waiter' ); ?></div>
								<div class="noesia-swa-dashboard-world-clocks" data-noesia-swa-dashboard-world-clocks="1">
									<?php if ( ! empty( $world_clocks ) ) : ?>
										<?php foreach ( $world_clocks as $world_clock ) : ?>
											<?php
											$world_clock_search_text = strtolower(
												trim(
													implode(
														' ',
														array_filter(
															array(
																isset( $world_clock['city'] ) ? (string) $world_clock['city'] : '',
																isset( $world_clock['country_name'] ) ? (string) $world_clock['country_name'] : '',
																isset( $world_clock['country'] ) ? (string) $world_clock['country'] : '',
															)
														)
													)
												)
											);
											?>
											<div
												class="noesia-swa-dashboard-world-clock"
												data-noesia-swa-dashboard-world-clock-item="1"
												data-noesia-swa-dashboard-world-timezone="<?php echo esc_attr( isset( $world_clock['timezone'] ) ? (string) $world_clock['timezone'] : '' ); ?>"
												data-noesia-swa-dashboard-world-clock-search="<?php echo esc_attr( $world_clock_search_text ); ?>"
											>
											<div class="noesia-swa-dashboard-world-clock-headline">
												<div class="noesia-swa-dashboard-world-clock-city"><?php echo esc_html( isset( $world_clock['city'] ) ? (string) $world_clock['city'] : __( 'City', 'noesia-smart-waiter' ) ); ?></div>
												<div class="noesia-swa-dashboard-world-clock-temp"><?php echo esc_html( isset( $world_clock['temp_label'] ) ? (string) $world_clock['temp_label'] : '—' ); ?></div>
											</div>
											<div class="noesia-swa-dashboard-world-clock-subline">
												<span class="noesia-swa-dashboard-world-clock-country"><?php echo esc_html( ! empty( $world_clock['country_name'] ) ? (string) $world_clock['country_name'] : ( isset( $world_clock['country'] ) ? (string) $world_clock['country'] : '' ) ); ?></span>
												<span class="noesia-swa-dashboard-world-clock-pill"><?php echo esc_html( isset( $world_clock['daylight_state'] ) ? (string) $world_clock['daylight_state'] : __( 'Day', 'noesia-smart-waiter' ) ); ?></span>
											</div>
											<div class="noesia-swa-dashboard-world-clock-time" data-noesia-swa-dashboard-world-clock-time="1"><?php echo esc_html( isset( $world_clock['time_label'] ) ? (string) $world_clock['time_label'] : '—' ); ?></div>
											<div class="noesia-swa-dashboard-world-clock-day" data-noesia-swa-dashboard-world-clock-day="1"><?php echo esc_html( isset( $world_clock['day_label'] ) ? (string) $world_clock['day_label'] : '' ); ?></div>
											<div class="noesia-swa-dashboard-world-clock-meta-grid">
												<div class="noesia-swa-dashboard-world-clock-meta">
													<span><?php esc_html_e( 'Rain', 'noesia-smart-waiter' ); ?></span>
													<strong><?php echo esc_html( isset( $world_clock['rain_label'] ) ? (string) $world_clock['rain_label'] : '—' ); ?></strong>
												</div>
												<div class="noesia-swa-dashboard-world-clock-meta">
													<span><?php esc_html_e( 'Wind', 'noesia-smart-waiter' ); ?></span>
													<strong><?php echo esc_html( isset( $world_clock['wind_label'] ) ? (string) $world_clock['wind_label'] : '—' ); ?></strong>
												</div>
												<div class="noesia-swa-dashboard-world-clock-meta noesia-swa-dashboard-world-clock-meta--wide">
													<span><?php esc_html_e( 'Daylight', 'noesia-smart-waiter' ); ?></span>
													<strong><?php echo esc_html( isset( $world_clock['daylight_label'] ) ? (string) $world_clock['daylight_label'] : '—' ); ?></strong>
												</div>
											</div>
										</div>
									<?php endforeach; ?>
								<?php else : ?>
									<div class="noesia-swa-dashboard-world-empty-note"><?php esc_html_e( 'Add city names in Settings, like Athens or Tokyo, JP.', 'noesia-smart-waiter' ); ?></div>
								<?php endif; ?>
							</div>
						</div>
					</section>
				</div>
			</div>
		</div>

	<div class="noesia-swa-dashboard-news-bridge" data-noesia-swa-dashboard-news-bridge="1" hidden aria-hidden="true">
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="general"></ul>
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="business"></ul>
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="health"></ul>
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="economy"></ul>
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="politics"></ul>
		<ul class="noesia-swa-dashboard-news-bridge-list" data-noesia-swa-dashboard-news-bridge-list="world"></ul>
	</div>

	<div
		class="noesia-swa-dashboard-news-shorts-modal"
		data-noesia-swa-dashboard-news-shorts-modal="1"
		data-noesia-swa-dashboard-news-shorts-loading-label="<?php echo esc_attr__( 'Loading stream…', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-empty-title="<?php echo esc_attr__( 'No stories available right now', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-empty-text="<?php echo esc_attr__( 'Refresh the stream and try again in a moment.', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-end-title="<?php echo esc_attr__( 'Start again', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-end-text="<?php echo esc_attr__( 'You reached the end of this stream. Restart it or pull a fresh batch.', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-refresh-label="<?php echo esc_attr__( 'Refresh stream', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-restart-label="<?php echo esc_attr__( 'Start again', 'noesia-smart-waiter' ); ?>"
		data-noesia-swa-dashboard-news-shorts-open-source-label="<?php echo esc_attr__( 'Open source', 'noesia-smart-waiter' ); ?>"
		hidden
	>
		<div class="noesia-swa-dashboard-news-shorts-backdrop" data-noesia-swa-dashboard-news-shorts-close="1"></div>
		<div class="noesia-swa-dashboard-news-shorts-shell" role="dialog" aria-modal="true" aria-labelledby="noesia-swa-dashboard-news-shorts-title">
			<div class="noesia-swa-dashboard-news-shorts-ambient" aria-hidden="true"></div>
			<header class="noesia-swa-dashboard-news-shorts-head">
				<div class="noesia-swa-dashboard-news-shorts-brand">
					<?php if ( '' !== $noesia_swa_dashboard_omni_logo_url ) : ?>
						<img src="<?php echo esc_url( $noesia_swa_dashboard_omni_logo_url ); ?>" alt="<?php esc_attr_e( 'Noesia', 'noesia-smart-waiter' ); ?>" />
					<?php else : ?>
						<span><?php esc_html_e( 'Noesia', 'noesia-smart-waiter' ); ?></span>
					<?php endif; ?>
				</div>
				<div class="noesia-swa-dashboard-news-shorts-topics" role="tablist" aria-label="<?php esc_attr_e( 'News topics', 'noesia-smart-waiter' ); ?>">
					<?php foreach ( $noesia_swa_dashboard_news_shorts_categories as $noesia_swa_dashboard_news_shorts_key => $noesia_swa_dashboard_news_shorts_category ) : ?>
						<button
							type="button"
							class="noesia-swa-dashboard-news-shorts-topic<?php echo 'top' === $noesia_swa_dashboard_news_shorts_key ? ' is-active' : ''; ?>"
							data-noesia-swa-dashboard-news-shorts-topic="<?php echo esc_attr( $noesia_swa_dashboard_news_shorts_key ); ?>"
							aria-pressed="<?php echo 'top' === $noesia_swa_dashboard_news_shorts_key ? 'true' : 'false'; ?>"
						>
							<?php echo esc_html( isset( $noesia_swa_dashboard_news_shorts_category['label'] ) ? (string) $noesia_swa_dashboard_news_shorts_category['label'] : ucfirst( (string) $noesia_swa_dashboard_news_shorts_key ) ); ?>
						</button>
					<?php endforeach; ?>
				</div>
				<button type="button" class="noesia-swa-dashboard-news-shorts-close" data-noesia-swa-dashboard-news-shorts-close="1" aria-label="<?php esc_attr_e( 'Close News Shorts', 'noesia-smart-waiter' ); ?>">×</button>
			</header>
			<div class="noesia-swa-dashboard-news-shorts-stage">
				<div class="noesia-swa-dashboard-news-shorts-viewport" data-noesia-swa-dashboard-news-shorts-viewport="1" aria-label="<?php esc_attr_e( 'News Shorts stream', 'noesia-smart-waiter' ); ?>">
					<div class="noesia-swa-dashboard-news-shorts-track" data-noesia-swa-dashboard-news-shorts-track="1"></div>
				</div>
			</div>
		</div>
	</div>

	<div class="noesia-swa-dashboard-pro-modal" data-noesia-swa-dashboard-pro-modal="1" hidden>
		<div class="noesia-swa-dashboard-pro-modal-backdrop" data-noesia-swa-dashboard-pro-close="1"></div>
		<div class="noesia-swa-dashboard-pro-modal-dialog" role="dialog" aria-modal="true" aria-labelledby="noesia-swa-dashboard-pro-title">
			<div class="noesia-swa-dashboard-pro-modal-kicker"><?php esc_html_e( 'NOESIA PRO ACCESS', 'noesia-smart-waiter' ); ?></div>
			<h3 id="noesia-swa-dashboard-pro-title"><?php esc_html_e( 'This is a Pro feature', 'noesia-smart-waiter' ); ?></h3>
			<p data-noesia-swa-dashboard-pro-message="1"><?php esc_html_e( 'Unlock the full Noesia Matrix experience to access this destination.', 'noesia-smart-waiter' ); ?></p>
			<div class="noesia-swa-dashboard-pro-modal-actions">
				<button type="button" class="button button-primary" data-noesia-swa-dashboard-pro-open="1"><?php esc_html_e( 'View Pro access', 'noesia-smart-waiter' ); ?></button>
				<button type="button" class="button button-secondary" data-noesia-swa-dashboard-pro-close="1"><?php esc_html_e( 'Not now', 'noesia-smart-waiter' ); ?></button>
			</div>
		</div>
	</div>
</div>
