{"context":{"brandSettings":{"accentColor1":{"hex":"#ffffff"},"accentColor2":{"hex":"#FF9900"},"accentColor3":null,"bodyFont":null,"colors":[{"hex":"#26598A"},{"hex":"#26598a"},{"hex":"#ffffff"}],"fallbackFont":null,"favicon":{"domain":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/Arkan%20logo.blog%20aurther.png"},"favicons":[{"domain":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/Arkan%20logo.blog%20aurther.png"},{"domain":null,"name":"Sitec Information Technology","src":"https://f.hubspotusercontent10.net/hubfs/8101468/logo-sitec-2x.png"}],"fonts":[],"logo":{"alt":"Arkan Integrated","domain":null,"height":333,"link":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/ArkanNewLogoMedium.png","width":545},"logos":[{"alt":"Arkan Integrated","domain":null,"height":333,"link":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/ArkanNewLogoMedium.png","width":545},{"alt":"Sitec Information Technology","domain":null,"height":300,"link":"http://www.sitec.ae/uploads/1/1/7/8/117882802/editor/sitec-logo-2018_4.png?1546996575","name":"Sitec Information Technology","src":"https://f.hubspotusercontent10.net/hubfs/8101468/sitec_logo_03-1.png","width":800},{"alt":"Arkan logo","domain":"content.arkan.international","height":107,"link":"https://www.linkedin.com/company/arkan-integrated-solutions/","name":"Arkan logo","src":"https://f.hubspotusercontent10.net/hubfs/8101468/mmm.png","width":200}],"primaryColor":{"hex":"#26598A"},"primaryFavicon":{"domain":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/Arkan%20logo.blog%20aurther.png"},"primaryFont":null,"primaryLogo":{"alt":"Arkan Integrated","domain":null,"height":333,"link":null,"name":"Arkan Integrated","src":"https://f.hubspotusercontent10.net/hubfs/8101468/ArkanNewLogoMedium.png","width":545},"secondaryColor":{"hex":"#FF9900"}},"menuData":{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"About Arkan","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":211856284295,"pageTitle":"About Us","parentGuid":null,"slug":"en/about-arkan","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/about-arkan","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/about-arkan"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Our Clients","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":200959049340,"pageTitle":"Clients Page","parentGuid":null,"slug":"en/clients","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/clients","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/clients"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Cybersecurity & Compliance","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":176047868544,"pageTitle":"Cybersecurity & Compliance","parentGuid":null,"slug":"en/security_and_compliance","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/security_and_compliance","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/security_and_compliance"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"News","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":180577027709,"pageTitle":"Arkan News","parentGuid":null,"slug":"en/news","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/news","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/news"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Company","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Contact Center cloud System","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":168971642181,"pageTitle":"Contact Center Solutions","parentGuid":null,"slug":"en/contact-center-solutions","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/contact-center-solutions","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/contact-center-solutions"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Arkan Microsoft Teams SBCaaS","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":167615533915,"pageTitle":"MS Teams Managed Services","parentGuid":null,"slug":"en/ms-teams-managed-services","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/ms-teams-managed-services","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/ms-teams-managed-services"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Arkan Cloud Connect","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":168057928313,"pageTitle":"Arkan Cloud Connect","parentGuid":null,"slug":"en/arkan_cloud_connect","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/arkan_cloud_connect","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/arkan_cloud_connect"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Solutions","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"3CX Hosted Managed Service","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":172640626186,"pageTitle":"3CX Hosted Managed Service","parentGuid":null,"slug":"en/3cx-hosted-managed-service","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/3cx-hosted-managed-service","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/3cx-hosted-managed-service"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"MS Teams Managed Services ","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":167615533915,"pageTitle":"MS Teams Managed Services","parentGuid":null,"slug":"en/ms-teams-managed-services","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/ms-teams-managed-services","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/ms-teams-managed-services"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"MS Teams Direct Routing as a Service ","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":172640627722,"pageTitle":"MS Teams Direct Routing as a Service","parentGuid":null,"slug":"en/ms-teams-direct-routing-as-a-service","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/ms-teams-direct-routing-as-a-service","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/ms-teams-direct-routing-as-a-service"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Product","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Support Center","level":2,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"https://help.arkan.international","urlParamStr":"","urlWithoutAnchor":"https://help.arkan.international"},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Service Status","level":2,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/service-status#","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/service-status#"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Support","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":1,"children":[],"contentGroupId":null,"contentType":"site_page","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"SBCaaS (Session Border Controller as a Service)","level":2,"linkTarget":null,"live":true,"nodeType":2,"pageId":177217420662,"pageTitle":"Arkan voice product","parentGuid":null,"slug":"en/arkan-voice-products","state":"PUBLISHED_OR_SCHEDULED","subcategory":"site_page","topLevelAncestorGuid":null,"url":"https://www.arkan.solutions/en/arkan-voice-products","urlParamStr":"","urlWithoutAnchor":"https://www.arkan.solutions/en/arkan-voice-products"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Cloud Services & Plan","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""},{"activeBranch":false,"activeNode":false,"blogNode":false,"categoryId":null,"children":[{"activeBranch":false,"activeNode":false,"blogNode":true,"categoryId":3,"children":[],"contentGroupId":33253730431,"contentType":"blog","errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Blog","level":2,"linkTarget":null,"live":true,"nodeType":1,"pageId":null,"pageTitle":"Blogs","parentGuid":null,"slug":"en","state":"PUBLISHED","subcategory":null,"topLevelAncestorGuid":null,"url":"https://blog.arkan.international/en","urlParamStr":"","urlWithoutAnchor":"https://blog.arkan.international/en"}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":"Knowledge Hub","level":1,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":"","urlParamStr":"","urlWithoutAnchor":""}],"contentGroupId":null,"contentType":null,"errorMessage":null,"guid":null,"isDeleted":false,"isNonLinkingNode":false,"isPublished":true,"label":null,"level":0,"linkTarget":null,"live":true,"nodeType":3,"pageId":null,"pageTitle":null,"parentGuid":null,"slug":null,"state":null,"subcategory":null,"topLevelAncestorGuid":null,"url":null,"urlParamStr":"","urlWithoutAnchor":"null"},"themeSettings":{"bodyFont":{"casing":null,"color":null,"css":"","fallback":null,"font":null,"font_set":"DEFAULT","letter_spacing":null,"line_height":null,"size":null,"size_unit":null,"style":null,"styles":null,"variant":null},"primaryFont":{"casing":null,"color":null,"css":"","fallback":null,"font":null,"font_set":"DEFAULT","letter_spacing":null,"line_height":null,"size":null,"size_unit":null,"style":null,"styles":null,"variant":null},"trellisBorderRadius":"rounded","trellisColorFillPrimaryDefault":{"color":"#26598A","css":"#26598A","hex":"#26598A","opacity":null,"rgb":"rgb(38, 89, 138)","rgba":"rgba(38, 89, 138, 1)"},"trellisColorFillSecondaryDefault":{"color":"#FF9900","css":"#FF9900","hex":"#FF9900","opacity":null,"rgb":"rgb(255, 153, 0)","rgba":"rgba(255, 153, 0, 1)"},"trellisColorFillSurfaceDefault":"light","trellisColorFillTertiaryDefault":{"color":"#ffffff","css":"#ffffff","hex":"#ffffff","opacity":null,"rgb":"rgb(255, 255, 255)","rgba":"rgba(255, 255, 255, 1)"},"trellisColorTextInteractiveDefault":{"color":"#666666","css":"#666666","hex":"#666666","opacity":null,"rgb":"rgb(102, 102, 102)","rgba":"rgba(102, 102, 102, 1)"}},"companyName":"Arkan integrated"},"modules":{},"dndAreas":{},"globalPartials":{},"headHtml":"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> \n<meta property=\"og:description\" content=\"\"> \n<meta property=\"og:title\" content=\"\"> \n<meta name=\"twitter:description\" content=\"\"> \n<meta name=\"twitter:title\" content=\"\"> \n<style>\na.cta_button{-moz-box-sizing:content-box !important;-webkit-box-sizing:content-box !important;box-sizing:content-box !important;vertical-align:middle}.hs-breadcrumb-menu{list-style-type:none;margin:0px 0px 0px 0px;padding:0px 0px 0px 0px}.hs-breadcrumb-menu-item{float:left;padding:10px 0px 10px 10px}.hs-breadcrumb-menu-divider:before{content:'›';padding-left:10px}.hs-featured-image-link{border:0}.hs-featured-image{float:right;margin:0 0 20px 20px;max-width:50%}@media (max-width: 568px){.hs-featured-image{float:none;margin:0;width:100%;max-width:100%}}.hs-screen-reader-text{clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute !important;width:1px}\n</style> \n<!--  Added by GoogleAnalytics4 integration --> \n<script>\nvar _hsp = window._hsp = window._hsp || [];\nwindow.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\n\nvar useGoogleConsentModeV2 = true;\nvar waitForUpdateMillis = 1000;\n\n\nif (!window._hsGoogleConsentRunOnce) {\n  window._hsGoogleConsentRunOnce = true;\n\n  gtag('consent', 'default', {\n    'ad_storage': 'denied',\n    'analytics_storage': 'denied',\n    'ad_user_data': 'denied',\n    'ad_personalization': 'denied',\n    'wait_for_update': waitForUpdateMillis\n  });\n\n  if (useGoogleConsentModeV2) {\n    _hsp.push(['useGoogleConsentModeV2'])\n  } else {\n    _hsp.push(['addPrivacyConsentListener', function(consent){\n      var hasAnalyticsConsent = consent && (consent.allowed || (consent.categories && consent.categories.analytics));\n      var hasAdsConsent = consent && (consent.allowed || (consent.categories && consent.categories.advertisement));\n\n      gtag('consent', 'update', {\n        'ad_storage': hasAdsConsent ? 'granted' : 'denied',\n        'analytics_storage': hasAnalyticsConsent ? 'granted' : 'denied',\n        'ad_user_data': hasAdsConsent ? 'granted' : 'denied',\n        'ad_personalization': hasAdsConsent ? 'granted' : 'denied'\n      });\n    }]);\n  }\n}\n\ngtag('js', new Date());\ngtag('set', 'developer_id.dZTQ1Zm', true);\ngtag('config', 'G-28BYD4869J');\n</script> \n<script async src=\"https://www.googletagmanager.com/gtag/js?id=G-28BYD4869J\"></script> \n<!-- /Added by GoogleAnalytics4 integration --> \n<!--  Added by GoogleTagManager integration --> \n<script>\nvar _hsp = window._hsp = window._hsp || [];\nwindow.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\n\nvar useGoogleConsentModeV2 = true;\nvar waitForUpdateMillis = 1000;\n\n\n\nvar hsLoadGtm = function loadGtm() {\n    if(window._hsGtmLoadOnce) {\n      return;\n    }\n\n    if (useGoogleConsentModeV2) {\n\n      gtag('set','developer_id.dZTQ1Zm',true);\n\n      gtag('consent', 'default', {\n      'ad_storage': 'denied',\n      'analytics_storage': 'denied',\n      'ad_user_data': 'denied',\n      'ad_personalization': 'denied',\n      'wait_for_update': waitForUpdateMillis\n      });\n\n      _hsp.push(['useGoogleConsentModeV2'])\n    }\n\n    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n    })(window,document,'script','dataLayer','GTM-NSKKDQZ8');\n\n    window._hsGtmLoadOnce = true;\n};\n\n_hsp.push(['addPrivacyConsentListener', function(consent){\n  if(consent.allowed || (consent.categories && consent.categories.analytics)){\n    hsLoadGtm();\n  }\n}]);\n\n</script> \n<!-- /Added by GoogleTagManager integration --> \n<link rel=\"canonical\" href=\"https://help.arkan.international/hs/portals/customer-portal-app/brand\"> \n<meta property=\"og:url\" content=\"https://help.arkan.international/hs/portals/customer-portal-app/brand\"> \n<meta http-equiv=\"content-language\" content=\"en\">","footerHtml":"<script src=\"/hs/hsstatic/jquery-libs/static-1.1/jquery/jquery-1.7.1.js\"></script> \n<script>hsjQuery = window['jQuery'];</script> \n<!-- HubSpot performance collection script --> \n<script defer src=\"/hs/hsstatic/content-cwv-embed/static-1.1293/embed.js\"></script> \n<!-- Start of HubSpot Analytics Code --> \n<script type=\"text/javascript\">\nvar _hsq = _hsq || [];\n_hsq.push([\"setContentType\", \"app-page\"]);\n_hsq.push([\"setCanonicalUrl\", \"https:\\/\\/help.arkan.international\\/hs\\/portals\\/customer-portal-app\\/brand\"]);\n_hsq.push([\"setPageId\", \"457396549872\"]);\n_hsq.push([\"setContentMetadata\", {\n    \"contentPageId\": 457396549872,\n    \"legacyPageId\": \"457396549872\",\n    \"contentFolderId\": null,\n    \"contentGroupId\": null,\n    \"abTestId\": null,\n    \"languageVariantId\": 457396549872,\n    \"languageCode\": \"en\",\n    \n    \n}]);\n</script> \n<script type=\"text/javascript\" id=\"hs-script-loader\" async defer src=\"/hs/scriptloader/8101468.js\"></script> \n<!-- End of HubSpot Analytics Code --> \n<script type=\"text/javascript\">\nvar hsVars = {\n    render_id: \"601e325f-1064-4cc8-9a55-01d562125c87\",\n    ticks: 1787477728848,\n    page_id: 457396549872,\n    \n    content_group_id: 0,\n    portal_id: 8101468,\n    app_hs_base_url: \"https://app-eu1.hubspot.com\",\n    cp_hs_base_url: \"https://cp-eu1.hubspot.com\",\n    language: \"en\",\n    analytics_page_type: \"app-page\",\n    scp_content_type: \"\",\n    \n    analytics_page_id: \"457396549872\",\n    category_id: 20,\n    folder_id: 0,\n    is_hubspot_user: false\n}\n</script> \n<script defer src=\"/hs/hsstatic/HubspotToolsMenu/static-1.640/js/index.js\"></script> \n<!-- ============================================================\n     ARKAN SOLUTIONS — AI CHAT WIDGET v4.4 (SLA Rev 062026)\n     Deploy via: HubSpot > Settings > Website > Pages > Footer HTML\n     Requires: Arkan Proxy v4.3 (HttpProxy.js) on Azure Functions\n     CHANGES vs deployed baseline:\n       1. P1 response corrected 15 min -> 30 min (SLA table + prompt)\n       2. SLA coverage added: P1/P2 24x7, P3/P4 business hours\n          (Sun-Thu 08:00-18:00 KSA) — table footnote, prompt, and\n          ticket confirmation message\n       3. HubSpot priority mapping fixed: P1->URGENT, P2->HIGH,\n          P3->MEDIUM, P4->LOW (was P1/P2->HIGH, P3/P4->MEDIUM)\n       4. Verified fact added: service credits below 99.8% per T&C\n     Aligned with: Support & Escalation Matrix Handbook Rev 062026,\n     Service Terms & Conditions June 2026 (clause 6.5)\n     ============================================================ --> \n<style>\n#ark-launcher{position:fixed;bottom:24px;right:24px;z-index:99999;font-family:Arial,sans-serif}\n#ark-btn{width:58px;height:58px;border-radius:50%;background:#2E5F8A;border:none;cursor:pointer;\n  display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(46,95,138,0.45);\n  transition:transform .2s,box-shadow .2s;position:relative}\n#ark-btn:hover{transform:scale(1.07);box-shadow:0 6px 20px rgba(46,95,138,0.55)}\n#ark-btn svg{width:26px;height:26px}\n#ark-badge{position:absolute;top:-3px;right:-3px;width:18px;height:18px;border-radius:50%;\n  background:#F7A800;color:#fff;font-size:10px;font-weight:700;\n  display:flex;align-items:center;justify-content:center;display:none}\n#ark-panel{position:fixed;bottom:94px;right:24px;width:370px;height:580px;\n  background:#fff;border-radius:16px;box-shadow:0 8px 40px rgba(0,0,0,0.18);\n  display:none;flex-direction:column;overflow:hidden;z-index:99998;\n  border:0.5px solid rgba(0,0,0,0.08)}\n@media(max-width:440px){\n  #ark-panel{width:calc(100vw - 20px);right:10px;bottom:80px;height:75vh}}\n/* --- Header --- */\n.ark-hdr{background:#2E5F8A;padding:12px 14px;display:flex;align-items:center;gap:9px;flex-shrink:0}\n.ark-av{width:36px;height:36px;border-radius:50%;background:#F7A800;display:flex;align-items:center;\n  justify-content:center;font-weight:700;font-size:12px;color:#fff;flex-shrink:0}\n.ark-hi{flex:1}\n.ark-hn{color:#fff;font-size:13px;font-weight:600}\n.ark-hs{color:rgba(255,255,255,0.75);font-size:10px;display:flex;align-items:center;gap:4px;margin-top:2px}\n.ark-dot{width:6px;height:6px;border-radius:50%;background:#4CAF50}\n.ark-hbtns{display:flex;gap:5px}\n.ark-hb{background:rgba(255,255,255,0.15);border:none;color:#fff;font-size:10px;\n  padding:3px 8px;border-radius:8px;cursor:pointer;font-family:Arial,sans-serif;white-space:nowrap}\n.ark-hb:hover{background:rgba(255,255,255,0.28)}\n.ark-hb.esc{background:rgba(247,168,0,0.85)}.ark-hb.esc:hover{background:#F7A800}\n.ark-lb{background:rgba(255,255,255,0.2);color:#fff;font-size:10px;padding:2px 7px;border-radius:8px}\n.ark-close{background:none;border:none;color:rgba(255,255,255,0.8);cursor:pointer;\n  font-size:18px;padding:0 0 0 6px;line-height:1}\n/* --- Office hours banner --- */\n.ark-ohb{background:#fff3e0;border-bottom:1px solid #ffe0b2;padding:6px 12px;\n  font-size:11px;color:#e65100;display:none;align-items:center;gap:5px;flex-shrink:0}\n/* --- Pre-chat survey --- */\n#ark-prechat{flex:1;overflow-y:auto;padding:14px;background:#f8f9fa}\n.ark-pc-logo{text-align:center;margin-bottom:12px}\n.ark-pc-logo-circle{width:50px;height:50px;border-radius:50%;background:#F7A800;\n  display:inline-flex;align-items:center;justify-content:center;font-size:18px;color:#fff}\n.ark-pc-title{font-size:15px;font-weight:600;color:#2E5F8A;text-align:center;margin-bottom:4px}\n.ark-pc-sub{font-size:12px;color:#666;text-align:center;margin-bottom:12px}\n.ark-sc{background:#fff;border-radius:10px;padding:14px;border:0.5px solid #e0e0e0}\n.ark-sc label{display:block;font-size:11px;color:#666;margin-bottom:3px;margin-top:8px;font-weight:500}\n.ark-sc label:first-of-type{margin-top:0}\n.ark-sc input,.ark-sc select{width:100%;border:1px solid #ddd;border-radius:6px;padding:7px 10px;\n  font-size:12px;font-family:Arial,sans-serif;outline:none;color:#1A1A2E;background:#fff}\n.ark-sc input:focus,.ark-sc select:focus{border-color:#2E5F8A}\n.ark-it-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:6px}\n.ark-it-btn{border:1px solid #ddd;border-radius:8px;padding:8px 6px;text-align:center;\n  cursor:pointer;font-size:11px;font-family:Arial,sans-serif;background:#fff;color:#333;transition:all .15s}\n.ark-it-btn:hover{border-color:#2E5F8A;background:#EAF2F8;color:#2E5F8A}\n.ark-it-btn.sel{border-color:#2E5F8A;background:#EAF2F8;color:#2E5F8A;font-weight:600}\n.ark-it-icon{font-size:15px;display:block;margin-bottom:3px}\n/* --- Chat body --- */\n#ark-chatbody{display:none;flex:1;flex-direction:column;overflow:hidden}\n.ark-ma{flex:1;overflow-y:auto;padding:10px 10px 4px;display:flex;flex-direction:column;gap:8px;background:#f8f9fa}\n.ark-mr{display:flex;gap:6px;max-width:100%}\n.ark-mr.usr{flex-direction:row-reverse}\n.ark-mb{max-width:82%;padding:8px 12px;border-radius:14px;font-size:13px;line-height:1.5;word-break:break-word}\n.ark-mr.bot .ark-mb{background:#fff;color:#1A1A2E;border-bottom-left-radius:4px;border:0.5px solid #e8e8e8}\n.ark-mr.usr .ark-mb{background:#2E5F8A;color:#fff;border-bottom-right-radius:4px}\n.ark-mr.sys .ark-mb{background:rgba(247,168,0,0.1);color:#F7A800;font-size:11px;text-align:center;\n  border-radius:8px;border:0.5px solid rgba(247,168,0,0.35);max-width:100%;width:100%}\n.ark-mt{font-size:10px;color:#999;margin-top:2px}\n.ark-mr.usr .ark-mt{text-align:right}\n.ark-bav{width:26px;height:26px;border-radius:50%;background:#F7A800;display:flex;\n  align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;flex-shrink:0;margin-top:1px}\n.ark-typing{background:#fff;border-radius:14px;border-bottom-left-radius:4px;\n  padding:10px 12px;display:flex;gap:4px;align-items:center;border:0.5px solid #e8e8e8}\n.ark-typing span{width:6px;height:6px;border-radius:50%;background:#ccc;animation:ark-bop 1.2s infinite}\n.ark-typing span:nth-child(2){animation-delay:.2s}.ark-typing span:nth-child(3){animation-delay:.4s}\n@keyframes ark-bop{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-5px)}}\n.ark-qr{padding:6px 10px 4px;display:flex;flex-wrap:wrap;gap:5px;background:#f8f9fa;flex-shrink:0}\n.ark-qb{background:#fff;border:0.5px solid #2E5F8A;color:#2E5F8A;font-size:11px;\n  padding:4px 9px;border-radius:12px;cursor:pointer;font-family:Arial,sans-serif;transition:background .15s}\n.ark-qb:hover{background:#EAF2F8}\n/* --- CRM bar --- */\n.ark-cbar{background:#EAF2F8;border-top:0.5px solid #d0e4f0;padding:5px 10px;\n  font-size:10px;color:#1A1A2E;display:none;align-items:center;gap:4px;flex-shrink:0}\n.ark-cbar.show{display:flex}\n/* --- Input bar --- */\n.ark-ibar{padding:8px 10px;border-top:1px solid #eee;display:flex;gap:7px;\n  align-items:flex-end;flex-shrink:0;background:#fff}\n#ark-ui{flex:1;border:1px solid #ddd;border-radius:16px;padding:8px 12px;\n  font-size:13px;font-family:Arial,sans-serif;resize:none;outline:none;\n  background:#fff;color:#1A1A2E;line-height:1.4;min-height:34px;max-height:80px}\n#ark-ui:focus{border-color:#2E5F8A}\n#ark-ui.rtl{direction:rtl;text-align:right}\n#ark-sb{width:34px;height:34px;border-radius:50%;background:#2E5F8A;border:none;\n  cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s}\n#ark-sb:hover{background:#245275}#ark-sb:disabled{background:#ccc;cursor:not-allowed}\n/* --- Cards (forms inside chat) --- */\n.ark-card{background:#fff;border-radius:10px;padding:12px;border-left:3px solid #F7A800;\n  width:100%;font-size:12px;margin-top:4px;border:1px solid #e8e8e8;border-left:3px solid #F7A800}\n.ark-card.rtl-c{border-left:none;border-right:3px solid #F7A800;direction:rtl}\n.ark-card h4{font-size:13px;font-weight:600;color:#2E5F8A;margin-bottom:8px}\n.ark-card label{display:block;font-size:11px;color:#666;margin-bottom:3px;margin-top:6px;font-weight:500}\n.ark-card input,.ark-card select,.ark-card textarea{width:100%;border:1px solid #ddd;\n  border-radius:6px;padding:6px 9px;font-size:12px;font-family:Arial,sans-serif;\n  background:#fff;color:#1A1A2E;outline:none}\n.ark-card textarea{resize:none;height:52px}\n.ark-card input:focus,.ark-card select:focus,.ark-card textarea:focus{border-color:#2E5F8A}\n.ark-card .r2{display:grid;grid-template-columns:1fr 1fr;gap:6px}\n.ark-btn-p{background:#F7A800;border:none;color:#fff;font-size:12px;font-family:Arial,sans-serif;\n  padding:6px 13px;border-radius:6px;cursor:pointer;font-weight:600;margin-top:7px;margin-right:5px}\n.ark-btn-s{background:transparent;border:1px solid #ddd;color:#666;font-size:12px;\n  font-family:Arial,sans-serif;padding:6px 11px;border-radius:6px;cursor:pointer;margin-top:7px}\n/* --- SLA --- */\n.ark-sla-chip{display:inline-block;font-size:10px;padding:2px 7px;border-radius:9px;font-weight:600;margin-left:4px}\n.p1c{background:#fdecea;color:#c62828}.p2c{background:#fff3e0;color:#e65100}\n.p3c{background:#e8f5e9;color:#2e7d32}.p4c{background:#e3f2fd;color:#0d47a1}\n.ark-sla-box{border:1px solid #eee;border-radius:8px;margin-top:8px;overflow:hidden;font-size:11px}\n.ark-sla-row{display:grid;grid-template-columns:1fr 1.3fr 70px 70px;padding:5px 8px;border-bottom:1px solid #eee;gap:4px}\n.ark-sla-row:last-child{border-bottom:none}\n.ark-sla-row.hd{background:#2E5F8A;color:#fff;font-weight:600;font-size:10px}\n.ark-sla-foot{padding:5px 8px;font-size:10px;color:#888;background:#fafafa;border-top:1px solid #eee}\n/* --- Stars --- */\n.ark-stars{display:flex;gap:6px;justify-content:center;margin:8px 0}\n.ark-star{font-size:22px;cursor:pointer;color:#ddd;transition:color .15s;user-select:none}\n.ark-star.on{color:#F7A800}\n/* --- Step dots --- */\n.ark-dots{display:flex;gap:5px;justify-content:center;margin-bottom:8px}\n.ark-dot2{width:7px;height:7px;border-radius:50%;background:#ddd}\n.ark-dot2.on{background:#2E5F8A}\n/* --- Powered by --- */\n.ark-pw{font-size:10px;color:#bbb;text-align:center;padding:5px 0 2px;background:#f8f9fa;flex-shrink:0}\n.ark-pw a{color:#bbb;text-decoration:none}\n</style> \n<!-- Launcher button --> \n<div id=\"ark-launcher\"> \n <div id=\"ark-btn\" onclick=\"arkToggle()\" title=\"Chat with Arkan Solutions\"> \n  <svg id=\"ark-icon-chat\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"> \n   <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"></path> \n  </svg> \n  <svg id=\"ark-icon-close\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"display:none\"> \n   <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n   <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line> \n  </svg> \n  <div id=\"ark-badge\">\n   1\n  </div> \n </div> \n</div> \n<!-- Chat panel --> \n<div id=\"ark-panel\"> \n <!-- Header --> \n <div class=\"ark-hdr\"> \n  <div class=\"ark-av\">\n   AS\n  </div> \n  <div class=\"ark-hi\"> \n   <div class=\"ark-hn\" id=\"ark-aname\">\n    Arkan Solutions\n   </div> \n   <div class=\"ark-hs\">\n    <span class=\"ark-dot\"></span>\n    <span id=\"ark-ast\">Cloud Voice Expert · Online</span>\n   </div> \n  </div> \n  <div class=\"ark-hbtns\"> \n   <span class=\"ark-lb\" id=\"ark-lb\">EN</span> \n   <button class=\"ark-hb\" onclick=\"arkOpenTicket()\">+ Ticket</button> \n   <button class=\"ark-hb esc\" onclick=\"arkOpenEsc()\">✉ Human</button> \n   <button class=\"ark-hb\" onclick=\"arkShowRating()\">★</button> \n   <button class=\"ark-close\" onclick=\"arkToggle()\">✕</button> \n  </div> \n </div> \n <!-- Office hours banner --> \n <div class=\"ark-ohb\" id=\"ark-ohb\"> \n  <span>☼</span>\n  <span id=\"ark-ohmsg\"></span> \n </div> \n <!-- Pre-chat survey --> \n <div id=\"ark-prechat\" style=\"flex:1;overflow-y:auto;padding:14px;background:#f8f9fa\"> \n  <div class=\"ark-pc-logo\"> \n   <div class=\"ark-pc-logo-circle\">\n    📞\n   </div> \n  </div> \n  <div class=\"ark-pc-title\" id=\"ark-pc-title\">\n   Welcome to Arkan Solutions\n  </div> \n  <div class=\"ark-pc-sub\" id=\"ark-pc-sub\">\n   Help us serve you better — takes 20 seconds.\n  </div> \n  <div class=\"ark-sc\" id=\"ark-sc\"> \n   <label id=\"ark-lbl-name\">Full name</label> \n   <input type=\"text\" id=\"ark-pc-name\" placeholder=\"e.g. Ahmed Al-Rashidi\"> \n   <label id=\"ark-lbl-co\">Company</label> \n   <input type=\"text\" id=\"ark-pc-co\" placeholder=\"e.g. Saudi Telecom Co.\"> \n   <label id=\"ark-lbl-plat\">Current or target voice platform</label> \n   <select id=\"ark-pc-plat\"> <option value=\"\">-- Select --</option> <option>MS Teams</option> <option>Zoom Phone</option> <option>Zoom Contact Center</option> <option>Genesys Cloud CX</option> <option>3CX</option> <option>AI / LLM Voice Agent</option> <option>Custom API / CPaaS</option> <option>Not sure yet</option> </select> \n   <label id=\"ark-lbl-type\">How can we help?</label> \n   <div class=\"ark-it-grid\"> \n    <div class=\"ark-it-btn\" id=\"ark-it-sales\" onclick=\"arkSelIT('sales')\">\n     <span class=\"ark-it-icon\">📈</span>\n     <span id=\"ark-itl-sales\">Sales inquiry</span>\n    </div> \n    <div class=\"ark-it-btn\" id=\"ark-it-tech\" onclick=\"arkSelIT('tech')\">\n     <span class=\"ark-it-icon\">🔧</span>\n     <span id=\"ark-itl-tech\">Technical support</span>\n    </div> \n    <div class=\"ark-it-btn\" id=\"ark-it-onb\" onclick=\"arkSelIT('onb')\">\n     <span class=\"ark-it-icon\">🚀</span>\n     <span id=\"ark-itl-onb\">Onboarding help</span>\n    </div> \n    <div class=\"ark-it-btn\" id=\"ark-it-gen\" onclick=\"arkSelIT('gen')\">\n     <span class=\"ark-it-icon\">💬</span>\n     <span id=\"ark-itl-gen\">General question</span>\n    </div> \n   </div> \n  </div> \n  <button class=\"ark-btn-p\" style=\"width:100%;text-align:center;padding:10px;margin-top:12px\" onclick=\"arkStartChat()\" id=\"ark-pc-btn\">Start Chat</button> \n  <div style=\"font-size:10px;color:#bbb;text-align:center;margin-top:6px\" id=\"ark-pc-foot\">\n   By chatting you agree to our \n   <a href=\"https://arkan.solutions/privacy\" style=\"color:#bbb\">privacy policy</a>\n  </div> \n </div> \n <!-- Chat body (hidden until survey done) --> \n <div id=\"ark-chatbody\" style=\"display:none;flex:1;flex-direction:column;overflow:hidden\"> \n  <div class=\"ark-ma\" id=\"ark-ma\"></div> \n  <div class=\"ark-qr\" id=\"ark-qr\"></div> \n </div> \n <!-- CRM status bar --> \n <div class=\"ark-cbar\" id=\"ark-cbar\"> \n  <span style=\"color:#F7A800\">●</span> \n  <span style=\"color:#666\" id=\"ark-clbl\">CRM:</span> \n  <span style=\"color:#2E5F8A;font-weight:600\" id=\"ark-cval\"></span> \n </div> \n <!-- Input bar --> \n <div class=\"ark-ibar\" id=\"ark-ibar\" style=\"display:none\"> \n  <textarea id=\"ark-ui\" placeholder=\"Type your message...\" rows=\"1\" onkeydown=\"arkHK(event)\" oninput=\"arkAR(this)\"></textarea> \n  <button id=\"ark-sb\" onclick=\"arkHS()\"> \n   <svg width=\"14\" height=\"14\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"> \n    <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\"></line>\n    <polygon points=\"22 2 15 22 11 13 2 9 22 2\"></polygon> \n   </svg> </button> \n </div> \n <div class=\"ark-pw\">\n  Powered by \n  <a href=\"https://arkan.solutions\" target=\"_blank\">Arkan Solutions</a>\n </div> \n</div> \n<script>\n// ============================================================\n// CONFIGURATION — update PROXY_URL after deploying the worker\n// ============================================================\nconst ARK_CONFIG = {\nPROXY_URL: 'https://arkanchatproxy-func.azurewebsites.net/api/proxy/chat',\nHS_PROXY_URL: 'https://arkanchatproxy-func.azurewebsites.net/api/proxy/hubspot',\n  BRAND: { name: 'Arkan Solutions', color: '#2E5F8A', accent: '#F7A800' },\n  OFFICE_HOURS: { tzRegion: 'Asia/Riyadh', startHour: 8, endHour: 18, workDays: [0,1,2,3,4] }\n};\n// ============================================================\n\n// SLA Rev 062026 — P1 response 30 min (was 15); coverage added.\n// hs = HubSpot hs_ticket_priority value (P1->URGENT, P2->HIGH, P3->MEDIUM, P4->LOW)\nconst ARK_SLA=[\n  {p:'P1',lbl:'Critical',crit:'Complete outage — 0% calls',resp:'30 min',res:'4 hrs',cov:'24×7',covAr:'٢٤×٧',cls:'p1c',hs:'URGENT'},\n  {p:'P2',lbl:'High',crit:'>50% calls failing',resp:'1 hr',res:'8 hrs',cov:'24×7',covAr:'٢٤×٧',cls:'p2c',hs:'HIGH'},\n  {p:'P3',lbl:'Medium',crit:'Intermittent / partial',resp:'4 hrs',res:'24 hrs',cov:'business hours',covAr:'ساعات العمل',cls:'p3c',hs:'MEDIUM'},\n  {p:'P4',lbl:'Low',crit:'Single user / config / billing',resp:'8 hrs',res:'72 hrs',cov:'business hours',covAr:'ساعات العمل',cls:'p4c',hs:'LOW'}\n];\nconst ARK_ISSUES={\n  'MS Teams Cloud Connect':['Registration / trunk failure','Inbound calls not routing','Outbound calls failing','Poor call quality / echo','DTMF / IVR not working','TLS/SRTP certificate error','Number porting','Config change request','Billing'],\n  'Zoom Cloud Connect Phone':['SIP trunk registration failure','Inbound routing failure','Outbound call failure','Call quality degradation','Codec mismatch','SRTP error','Number porting','Config change','Billing'],\n  'Zoom Cloud Connect Contact Center':['Agent connectivity failure','SIP trunk down','IVR routing failure','Recording failure','WebRTC quality issue','Outbound failure','Config change','Billing'],\n  'Genesys Cloud Connect':['SIP trunk registration failure','Inbound routing failure','Outbound call failure','WebRTC agent audio issue','DTMF not passing','TLS handshake failure','Number porting','Config change','Billing'],\n  '3CX':['SIP trunk failure','Extension registration failure','Outbound calls failing','Audio quality issue','TLS certificate error','Config change','Billing'],\n  default:['Service outage','Call quality issue','Registration failure','Routing problem','TLS/SRTP error','Number porting','Config change','Billing','General inquiry']\n};\nconst ARK_SP=`You are Arkan Solutions' bilingual website chat agent (English and Arabic). Arkan Solutions (arkan.solutions) is a Saudi-headquartered enterprise and government cloud voice connectivity vendor — NOT a system integrator.\n\nLANGUAGE: Detect from visitor's message. Respond in same language. Arabic: formal MSA.\n\nPRODUCTS (Arkan Cloud Connect):\n1. MS Teams Cloud Connect — Direct Routing & Operator Connect\n2. Zoom Cloud Connect Phone — BYOC Zoom Phone\n3. Zoom Cloud Connect Contact Center — BYOC Zoom Contact Center\n4. Genesys Cloud Connect — BYOC Genesys Cloud CX\n5. AI Voice Connect — SIP for AI/LLM voice agents (Vapi, Retell AI, Bland AI, ElevenLabs, LiveKit, AWS Connect, Google CCAI, etc.)\n6. API/Programmable Voice Cloud Connect — CPaaS/API\nManaged service (licensing, deployment, change management) available for: MS Teams, Zoom Phone, Zoom Contact Center, 3CX. Connectivity-only for the rest.\n\nVERIFIED FACTS (the only commercial facts you may state):\n- Coverage: 80+ countries on a single contract\n- SLA: 99.99% uptime per calendar month — contractually backed, uniform for all customers\n- Service credits apply when monthly uptime falls below 99.8%, per the published Service Terms & Conditions (arkan.solutions/en/terms-conditions)\n- Dedicated Session Border Controller (SBC) per Enterprise Client; geographically redundant\n- Standard go-live: 3–5 business days from contract signature\n- 24/7 NOC monitoring\n- ISO/IEC 27001 certified (certified by Intertek) — share this proactively with government and regulated-industry visitors; certificate available on request\n- Two PSTN models, surface BOTH in every sales conversation: (a) Arkan Managed PSTN — Arkan provides numbers, porting, termination; one vendor, one invoice. (b) BYOA (Bring Your Own Agreement) — visitor keeps their existing telco contract; Arkan provides SBC and interconnect. Best for regulated industries.\n- Approved reference Enterprise Clients (free to name): DHL, PepsiCo, Lucid Motors, ThyssenKrupp, Qatari Diar, ABK, Hassan Allam, RAYA, HyperMax, Betterhomes, Naqel, SIXT, AMICO, Jisr, TravelNET\n\nTERMINOLOGY — POC vs PRE-GO-LIVE PILOT (important internal distinction):\n- \"POC\" (Proof of Concept) = pre-sale feasibility evaluation for a PROSPECT still deciding. Requires Arkan approval to initiate.\n- \"Pre-Go-Live Pilot\" = accelerated scaled-down production setup for a COMMITTED customer before full go-live. Not a POC.\nIf a committed/contracted customer says \"our POC\", they almost certainly mean their Pre-Go-Live Pilot — use the correct term gently and route any related issue as a normal support matter, not a sales inquiry.\n\nCOMMERCIAL RULES (current quoting policy — reflect but never generate quotes):\n- DID SKUs MUST be bundled with PSTN channel SKUs of the same country. A DID cannot be sold standalone.\n- PSTN channels are sold ONLY in quantities of 10 or 50. If a visitor asks for another quantity, explain the bundling rule and route to pre-sales for a formal quote.\n- Never state specific prices, channel rates, setup fees, or discounts. Pricing comes from formal quotes only.\n\nANTI-HALLUCINATION GUARDRAILS — you DO NOT KNOW and must NEVER state:\n- Country-specific porting timelines. Say: \"Porting timelines depend on the country and the losing carrier; the team will provide a realistic estimate during discovery.\"\n- Country-specific delivery models (direct vs partner per country). Say coverage spans 80+ countries; specifics confirmed by pre-sales.\n- Concurrent-call ratios per agent/user — ASK the visitor for their channel estimate; never invent one.\n- Direct Routing vs Operator Connect recommendations — present both honestly; the discovery call decides.\n- Vendor roadmaps (Microsoft/Zoom/Genesys), SBC IPs, SIP proxy addresses, or internal infrastructure details.\nIf you do not know, say so and hand off. A handoff is always better than an invented specific.\n\nTECHNICAL:\n- Ribbon SBC SWe Edge, SIP TLS port 5061, SRTP MKI=0\n- E.164: WITH + toward cloud platforms; WITHOUT + toward Arkan SIP proxies\n- Codecs: G.711 (PCMA/PCMU), G.729, Opus (WebRTC)\n- SIP errors: 403 auth/config, 404 DID routing, 408 timeout/firewall, 480 unavailable, 486 busy, 488 codec, 503 overload, 504 proxy timeout\n- You may HYPOTHESIZE causes of a reported issue but always mark them as hypotheses (\"the engineer will confirm\"). Never state a diagnosis as fact.\n\nTECHNICAL SUPPORT SLA (Rev 062026): P1 30min/4hr (24x7) | P2 1hr/8hr (24x7) | P3 4hr/24hr (business hours) | P4 8hr/72hr (business hours).\nSLA CLOCK RULES: P1 and P2 are measured in elapsed time around the clock, including weekends and public holidays (on-call framework). P3 and P4 are measured in business hours only (Sun–Thu 08:00–18:00 KSA); the clock pauses outside that window. At any priority, the clock pauses while waiting for information from the customer. If a visitor asks about the SLA, state these times and coverage exactly — never the old 15-minute P1 figure.\n\nSALES & DISCOVERY HANDOFF: Pre-Sales reaches out within 1–2 business days; proposals follow within 3 business days of the discovery call. Never promise hours or same-day callbacks. Be honest; do not over-promise.\n\n—— HUMAN ADAPTATION (this is the most important section) ——\n\nYou are talking to real people, not filling forms. Be human, not scripted.\n\nMIRROR the visitor: their formality, their pace, their warmth, their level of detail. If they write short, you write short. If they write detailed, you can elaborate. If they're warm and chatty, allow yourself a friendly aside. If they're terse and businesslike, get to the point.\n\nREAD EMOTION:\n- Frustration → empathize first, solve second. Don't be cheerful at the wrong moment.\n- Excitement → match their energy.\n- Urgency → cut padding, give concrete next steps fast.\n- Confusion → simplify, slow down, check understanding.\n- Hesitation → give them space, don't push.\n\nCULTURAL CONTEXT (Arkan operates across these regions — adapt naturally):\n- Saudi Arabia & Gulf (UAE, Kuwait, Bahrain, Qatar, Oman): formal courtesy, respect for hierarchy, allow time for relationship-building before business specifics. Honorifics matter.\n- Egypt & Levant (Jordan, Lebanon): warmer, more conversational, balance respect with friendliness. A bit of human warmth lands well.\n- North Africa (Algeria, Morocco, Tunisia): often bilingual French/Arabic; can be more direct than Gulf.\n- Germany & broader Europe: precise, structured, factual. Less small talk. Get to specifics quickly.\n- Sub-Saharan Africa (Uganda, Kenya, Nigeria, etc): English business-formal, often relational and respectful.\n- If you don't know the visitor's region: stay neutral-professional and let their style guide you.\n\nARABIC NUANCE: default to MSA, but if you detect dialect markers, soften your phrasing accordingly. Egyptian markers (إيه، ازاي، عاوز): warmer, less stiff. Gulf markers (وش، شلون، ابغى): more formal courtesy. If unsure, MSA is always safe. Reciprocate religious greetings appropriately (السلام عليكم → وعليكم السلام ورحمة الله وبركاته).\n\nDON'T over-format. If a flowing 2–3 sentence answer fits, write it as flowing sentences — not bullets, not tables, not headers. Reserve structure for genuinely structured content (e.g. SLA tiers, pricing breakdowns, multi-country options). Never use bullets for greeting, empathy, or simple Q&A.\n\nUSE NAMES sparingly. Once when greeting, occasionally for warmth, but not every turn.\n\nACKNOWLEDGE their context: their country, their time zone, their platform, what they already told you. Don't re-ask things they already answered.\n\nBe HUMAN: a brief acknowledgment (\"that makes sense\"), a small empathetic note (\"multi-country deployments are always tricky\"), even a tasteful aside is fine when it fits naturally. But never force warmth where it's not invited.\n\n—— SIGNALS (append silently at end of message — no quotes, no explanation) ——\n\n[COLLECT_LEAD] — visitor needs a follow-up; opens lead form\n[OPEN_TICKET] — visitor described a technical issue; opens ticket form\n[ESCALATE] — visitor wants human or situation is sensitive; opens handoff form\n[RATE_CHAT] — after resolving, invites satisfaction rating (NOT during an unresolved P1/P2 incident)\n[HS_CREATE:name|email|company] — quick contact creation\n[HS_LOOKUP:email] — find existing contact\n\n[SALES_HANDOFF::name=...|email=...|company=...|phone=...|platform=...|preferredTime=...|summary=...]\n   Use only when the visitor has CONFIRMED a sales/discovery follow-up AND provided email + phone.\n   The widget creates contact + deal + assigned tasks + reference number, and displays the reference.\n   DO NOT include a reference number yourself — the system generates and displays it.\n   Summary: one natural paragraph of their interest, scale, and requirements.\n\n—— HANDOFF DISAMBIGUATION (CRITICAL) ——\nBefore any handoff, confirm what the visitor actually needs:\n(a) Sales / pricing / demo / quote / discovery → [SALES_HANDOFF::...] after email + phone. Creates a Deal. NEVER a ticket.\n(b) Active technical issue or outage → [OPEN_TICKET]. The ticket form creates a Ticket.\n(c) Genuinely ambiguous \"talk to a human\" → [ESCALATE]. Creates contact + callback task. NO ticket. NO deal.\n(d) Billing / contract follow-up on existing service → [ESCALATE]. Billing is not technical support.\nNEVER use [ESCALATE] for an active sales conversation — sales must go through [SALES_HANDOFF].\nIf intent is unclear, ASK: \"Are you looking for sales information, or is there a technical issue we should look at?\" / \"هل استفسارك يخص المبيعات أم لديك مشكلة فنية تحتاج معالجة؟\"\n\nTONE: Confident, professional, human. 2-4 sentences per turn. No markdown.`;\n\nlet arkMsgs=[],arkLang='en',arkBusy=false,arkCtct=null,arkPcData={},arkSelInq='',arkOpen=false,arkRated=false,arkStarVal=0,arkTktStep=1,arkTktData={};\n\nfunction arkToggle(){\n  arkOpen=!arkOpen;\n  document.getElementById('ark-panel').style.display=arkOpen?'flex':'none';\n  document.getElementById('ark-icon-chat').style.display=arkOpen?'none':'block';\n  document.getElementById('ark-icon-close').style.display=arkOpen?'block':'none';\n  document.getElementById('ark-badge').style.display='none';\n  if(arkOpen&&!arkPcData.started) arkCheckLang();\n}\n\nfunction arkCheckLang(){\n  const ua=navigator.language||'';\n  if(ua.startsWith('ar')) arkInitArabic();\n}\n\nfunction arkIsAr(t){return /[\\u0600-\\u06FF]/.test(t)}\nfunction arkGT(){return new Date().toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'})}\n\nfunction arkCheckOH(){\n  const now=new Date();\n  const ksa=new Date(now.toLocaleString('en-US',{timeZone:ARK_CONFIG.OFFICE_HOURS.tzRegion}));\n  const day=ksa.getDay();\n  const hr=ksa.getHours()+ksa.getMinutes()/60;\n  const ok=ARK_CONFIG.OFFICE_HOURS.workDays.includes(day)&&hr>=ARK_CONFIG.OFFICE_HOURS.startHour&&hr<ARK_CONFIG.OFFICE_HOURS.endHour;\n  if(!ok){\n    const ohb=document.getElementById('ark-ohb');\n    ohb.style.display='flex';\n    document.getElementById('ark-ohmsg').textContent=arkLang==='ar'\n      ?'خارج أوقات العمل (الأحد–الخميس ٨ص–٦م بتوقيت الرياض). الحالات الحرجة (P1/P2) تُعالج على مدار الساعة. سنرد على باقي الطلبات فور عودة الفريق.'\n      :'Outside office hours (Sun–Thu 8:00 AM–6:00 PM KSA). Critical incidents (P1/P2) are handled 24×7. Other requests will be answered when the team is back.';\n  }\n}\n\nfunction arkSelIT(t){\n  ['sales','tech','onb','gen'].forEach(x=>document.getElementById('ark-it-'+x).classList.remove('sel'));\n  document.getElementById('ark-it-'+t).classList.add('sel');\n  arkSelInq=t;\n}\n\nfunction arkStartChat(){\n  const n=document.getElementById('ark-pc-name').value.trim();\n  const c=document.getElementById('ark-pc-co').value.trim();\n  const p=document.getElementById('ark-pc-plat').value;\n  if(!n){alert(arkLang==='ar'?'يرجى إدخال اسمك.':'Please enter your name.');return}\n  arkPcData={name:n,company:c,platform:p,inquiry:arkSelInq,started:true};\n  arkCtct={name:n,company:c};\n  document.getElementById('ark-prechat').style.display='none';\n  const cb=document.getElementById('ark-chatbody');\n  cb.style.display='flex';cb.style.flexDirection='column';\n  document.getElementById('ark-ibar').style.display='flex';\n  arkCheckOH();\n  arkBuildQR();\n  const gr=arkGreeting(n,p,arkSelInq);\n  arkMsgs.push({role:'assistant',content:gr});\n  arkAddMsg('bot',gr);\n\n  // Auto-create HubSpot contact from survey data\n  if(n&&c) arkHSCall(`Create or update HubSpot contact: Name: ${n}, Company: ${c}. Source: Website Chat Widget. Confirm.`).then(r=>arkSetCrm('Contact:',r.slice(0,45))).catch(()=>{});\n}\n\nfunction arkGreeting(name,plat,inq){\n  const platMsg=plat&&plat!=='Not sure yet'?' regarding '+plat:'';\n  const inqMsg={sales:' Our team is ready to walk you through Arkan Cloud Connect.',tech:' Our technical support team is standing by.',onb:' Let us guide you through the onboarding process.',gen:''}[inq]||'';\n  if(arkLang==='ar') return `أهلاً ${name}! مرحباً بك في أركان سوليوشنز. ${plat&&plat!=='Not sure yet'?'يسعدنا مساعدتك بشأن '+plat+'.':''} كيف يمكنني مساعدتك اليوم؟`;\n  return `Welcome, ${name}! I am your cloud voice connectivity specialist at Arkan Solutions${platMsg}.${inqMsg} How can I assist you today?`;\n}\n\nfunction arkBuildQR(){\n  const qr=document.getElementById('ark-qr');qr.innerHTML='';\n  const chips=arkPcData.inquiry==='tech'\n    ?['Report a call issue','SLA commitments','Config change request','Track open ticket']\n    :arkLang==='ar'?['الإبلاغ عن مشكلة','تفاصيل SLA','طلب تغيير إعدادات','تحدث مع المبيعات']\n    :['Arkan Cloud Connect overview','MS Teams Direct Routing','Genesys Cloud CX','Request a demo'];\n  chips.forEach(t=>{const b=document.createElement('button');b.className='ark-qb';b.textContent=t;b.onclick=()=>arkSQ(t);qr.appendChild(b)});\n}\n\nfunction arkAddMsg(role,text,extra){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr '+role;\n  if(role==='bot'){const av=document.createElement('div');av.className='ark-bav';av.textContent='AS';row.appendChild(av)}\n  const col=document.createElement('div');\n  col.style.cssText='display:flex;flex-direction:column;max-width:82%';\n  if(role==='usr')col.style.alignItems='flex-end';\n  const bub=document.createElement('div');bub.className='ark-mb';\n  if(arkIsAr(text)){bub.style.direction='rtl';bub.style.textAlign='right'}\n  bub.textContent=text;col.appendChild(bub);\n  const tm=document.createElement('div');tm.className='ark-mt';tm.textContent=arkGT();col.appendChild(tm);\n  if(extra)col.appendChild(extra);\n  row.appendChild(col);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\n\nfunction arkAddSys(t){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr sys';\n  const b=document.createElement('div');b.className='ark-mb';\n  if(arkIsAr(t)){b.style.direction='rtl'}b.textContent=t;\n  row.appendChild(b);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\n\nfunction arkShowTyping(){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr bot';row.id='ark-trow';\n  const av=document.createElement('div');av.className='ark-bav';av.textContent='AS';\n  const b=document.createElement('div');b.className='ark-typing';\n  b.innerHTML='<span></span><span></span><span></span>';\n  row.appendChild(av);row.appendChild(b);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\nfunction arkRmTyping(){const el=document.getElementById('ark-trow');if(el)el.remove()}\n\nfunction arkSetCrm(l,v){\n  const bar=document.getElementById('ark-cbar');bar.classList.add('show');\n  document.getElementById('ark-clbl').textContent=l;\n  document.getElementById('ark-cval').textContent=v;\n}\n\nfunction arkSetLang(l){\n  arkLang=l;\n  document.getElementById('ark-lb').textContent=l==='ar'?'ع':'EN';\n  const inp=document.getElementById('ark-ui');\n  if(l==='ar'){inp.classList.add('rtl');inp.placeholder='اكتب رسالتك...';\n    document.getElementById('ark-aname').textContent='أركان سوليوشنز';\n    document.getElementById('ark-ast').textContent='خبير الاتصالات السحابية · متاح'}\n  else{inp.classList.remove('rtl');inp.placeholder='Type your message...';\n    document.getElementById('ark-aname').textContent='Arkan Solutions';\n    document.getElementById('ark-ast').textContent='Cloud Voice Expert · Online'}\n}\n\nfunction arkInitArabic(){\n  arkSetLang('ar');\n  document.getElementById('ark-pc-title').textContent='أهلاً بك في أركان سوليوشنز';\n  document.getElementById('ark-pc-sub').textContent='ساعدنا لنخدمك بشكل أفضل — 20 ثانية فقط.';\n  document.getElementById('ark-pc-btn').textContent='ابدأ المحادثة';\n  document.getElementById('ark-lbl-name').textContent='الاسم الكامل';\n  document.getElementById('ark-lbl-co').textContent='الشركة';\n  document.getElementById('ark-lbl-plat').textContent='المنصة الحالية أو المستهدفة';\n  document.getElementById('ark-lbl-type').textContent='كيف يمكننا مساعدتك؟';\n  document.getElementById('ark-itl-sales').textContent='استفسار مبيعات';\n  document.getElementById('ark-itl-tech').textContent='دعم تقني';\n  document.getElementById('ark-itl-onb').textContent='مساعدة تفعيل';\n  document.getElementById('ark-itl-gen').textContent='سؤال عام';\n  document.getElementById('ark-pc-name').placeholder='مثال: أحمد الراشدي';\n  document.getElementById('ark-pc-co').placeholder='مثال: شركة الاتصالات السعودية';\n  document.getElementById('ark-sc').style.direction='rtl';\n}\n\nasync function arkHSCall(prompt){\n  const r=await fetch(ARK_CONFIG.HS_PROXY_URL,{method:'POST',\n    headers:{'Content-Type':'application/json'},\n    body:JSON.stringify({prompt})});\n  const d=await r.json();\n  return d.result||'Done';\n}\n\n// Generate reference number client-side (matches worker format)\nfunction arkGenRef(name){\n  const initials=(name||'XX').split(' ').map(w=>w[0]||'').join('').toUpperCase().slice(0,2)||'XX';\n  const date=new Date().toISOString().slice(0,10).replace(/-/g,'');\n  const rand=Math.floor(Math.random()*100).toString().padStart(2,'0');\n  return `ARK-${date}-${initials}${rand}`;\n}\n\n// Sales handoff: contact + deal + tasks + reference number\n\nasync function arkProcessSalesHandoff(payload) {\n  const ref = arkGenRef(arkCtct?.name || arkPcData.name || 'XX');\n  arkSetCrm(arkLang === 'ar' ? 'جاري المعالجة...' : 'Processing handoff...', 'HubSpot');\n  const isAr = arkLang === 'ar';\n\n  // Parse the SALES_HANDOFF::key=value|key=value format the bot emitted\n  const fields = {};\n  payload.split('|').forEach(pair => {\n    const i = pair.indexOf('=');\n    if (i > 0) fields[pair.slice(0, i).trim()] = pair.slice(i + 1).trim();\n  });\n  fields.reference = ref;\n\n  try {\n    const r = await arkCrmCall('sales_handoff', fields);\n    arkSetCrm(arkLang === 'ar' ? 'تم الحفظ:' : 'CRM saved:', ref);\n    arkAddSys(isAr\n      ? `✅ تم حفظ بياناتك في HubSpot\n📋 الرقم المرجعي: ${ref}\n👤 جهة اتصال أُنشئت\n💼 فرصة بيع مفتوحة\n📅 مهام مُعيّنة لفرق المبيعات والتقني`\n      : `✅ Saved to HubSpot\n📋 Reference: ${ref}\n👤 Contact created\n💼 Deal opened in pipeline\n📅 Tasks assigned to Pre-Sales & Operations`);\n    setTimeout(() => {\n      arkAddMsg('bot', isAr\n        ? `الرقم المرجعي لطلبك هو ${ref} — احتفظ به للرجوع إليه. سيتواصل معك متخصص أركان خلال 1-2 يوم عمل لتنسيق المكالمة.`\n        : `Your reference number is ${ref} — please keep it for follow-up. An Arkan specialist will contact you within 1–2 business days to schedule the discovery call.`);\n      if (!arkRated) setTimeout(() => arkShowRating(), 2000);\n    }, 600);\n  } catch (e) {\n    arkSetCrm('Handoff:', 'Queued');\n    arkAddSys(isAr\n      ? '⚠️ تم استلام طلبك وسيتم معالجته عند استعادة الاتصال.'\n      : '⚠️ Handoff queued — will sync when connection is restored.');\n  }\n}\n\nasync function arkSendMsg(txt){\n  if(arkBusy)return;arkBusy=true;\n  document.getElementById('ark-sb').disabled=true;\n  document.getElementById('ark-qr').style.display='none';\n  if(arkIsAr(txt)&&arkLang!=='ar')arkSetLang('ar');\n  arkMsgs.push({role:'user',content:txt});\n  arkAddMsg('usr',txt);arkShowTyping();\n  try{\n    const res=await fetch(ARK_CONFIG.PROXY_URL,{method:'POST',\n      headers:{'Content-Type':'application/json'},\n      body:JSON.stringify({system:ARK_SP,messages:arkMsgs})});\n    const d=await res.json();\n    let bot=d.content||'';\n    let extra=null;\n    if(bot.includes('[COLLECT_LEAD]')){bot=bot.replace('[COLLECT_LEAD]','').trim();extra=arkBuildLeadForm()}\n    if(bot.includes('[OPEN_TICKET]')){bot=bot.replace('[OPEN_TICKET]','').trim();setTimeout(()=>arkOpenTicket(),400)}\n    if(bot.includes('[ESCALATE]')){bot=bot.replace('[ESCALATE]','').trim();setTimeout(()=>arkDoEscalate(true),300)}\n    if(bot.includes('[RATE_CHAT]')&&!arkRated){bot=bot.replace('[RATE_CHAT]','').trim();setTimeout(()=>arkShowRating(),800)}\n    const cm=bot.match(/\\[HS_CREATE:([^\\]]+)\\]/);\n    const lm=bot.match(/\\[HS_LOOKUP:([^\\]]+)\\]/);\n    const sh=bot.match(/\\[SALES_HANDOFF::([^\\]]+)\\]/);\n    if(cm){bot=bot.replace(cm[0],'').trim();const[n,e,c]=cm[1].split('|');\n      arkHSCall(`Create or update HubSpot contact: Name: ${n}, Email: ${e}, Company: ${c||'Unknown'}.`).then(r=>arkSetCrm('CRM:',r.slice(0,45))).catch(()=>{})}\n    if(lm){bot=bot.replace(lm[0],'').trim();\n      arkHSCall(`Look up HubSpot contact: ${lm[1]}. Return name, company, lifecycle.`).then(r=>arkSetCrm('CRM:',r.slice(0,45))).catch(()=>{})}\n    if(sh){bot=bot.replace(sh[0],'').trim();arkProcessSalesHandoff(sh[1])}\n    arkRmTyping();arkMsgs.push({role:'assistant',content:bot});arkAddMsg('bot',bot,extra);\n  }catch(e){arkRmTyping();arkAddMsg('bot',arkLang==='ar'?'عذراً، خطأ في الاتصال. يرجى المحاولة مرة أخرى.':'Apologies — connectivity issue. Please try again.')}\n  arkBusy=false;document.getElementById('ark-sb').disabled=false;\n}\n\nfunction arkBuildLeadForm(){\n  const w=document.createElement('div');w.className='ark-card'+(arkLang==='ar'?' rtl-c':'');w.id='ark-lform';\n  const isAr=arkLang==='ar';\n  w.innerHTML=`<h4>${isAr?'بياناتك للتواصل':'Your contact details'}</h4>\n    <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-ln\" value=\"${arkCtct?.name||''}\" />\n    <label>${isAr?'الشركة':'Company'}</label><input type=\"text\" id=\"ark-lc\" value=\"${arkCtct?.company||''}\" />\n    <label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-le\" />\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitLead()\">${isAr?'إرسال':'Submit'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-lform').remove()\">${isAr?'لاحقاً':'Later'}</button>`;\n  return w;\n}\nasync function arkSubmitLead(){\n  const n=document.getElementById('ark-ln').value.trim();\n  const c=document.getElementById('ark-lc').value.trim();\n  const e=document.getElementById('ark-le').value.trim();\n  if(!n||!e){alert(arkLang==='ar'?'يرجى إدخال الاسم والبريد.':'Enter name and email.');return}\n  arkCtct={...arkCtct,name:n,company:c,email:e};\n  document.getElementById('ark-lform').remove();\n  arkSetCrm(arkLang==='ar'?'جاري الحفظ...':'Saving...',n);\n  try{const r=await arkHSCall(`Create or update HubSpot contact: Name: ${n}, Email: ${e}, Company: ${c||'Unknown'}. Source: Website Chat.`);arkSetCrm(arkLang==='ar'?'تم:':'Saved:',`${n} · ${c||e}`);arkAddSys(arkLang==='ar'?'✓ تم حفظ بياناتك':'✓ Contact saved to HubSpot')}catch(err){}\n  await arkSendMsg(arkLang==='ar'?`اسمي ${n} من ${c}، بريدي ${e}`:`My name is ${n} from ${c}, email ${e}`);\n}\n\nfunction arkOpenTicket(){\n  const old=document.getElementById('ark-tkt');if(old)old.remove();\n  arkTktStep=1;arkTktData={};arkRenderTkt();\n}\nfunction arkRenderTkt(){\n  const old=document.getElementById('ark-tkt');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-tkt';\n  const isAr=arkLang==='ar';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');card.style.width='100%';\n  const dots=`<div class=\"ark-dots\">${[1,2,3].map(i=>`<div class=\"ark-dot2${arkTktStep>=i?' on':''}\"></div>`).join('')}</div>`;\n  if(arkTktStep===1){\n    const plat=arkPcData.platform||'';\n    const issues=(ARK_ISSUES[Object.keys(ARK_ISSUES).find(k=>k.includes(plat.split(' ')[0]))||'default']||ARK_ISSUES.default);\n    card.innerHTML=`${dots}<h4>${isAr?'تذكرة دعم — الخطوة 1/3':'Support Ticket — Step 1 of 3'}</h4>\n      <label>${isAr?'المنتج المتأثر':'Affected product'}</label>\n      <select id=\"ark-t-prod\">${['MS Teams Cloud Connect','Zoom Cloud Connect Phone','Zoom Cloud Connect Contact Center','Genesys Cloud Connect','AI Voice Connect','API / Programmable Voice Cloud Connect'].map(p=>`<option${plat&&p.toLowerCase().includes(plat.toLowerCase().split(' ')[0])?' selected':''}>${p}</option>`).join('')}</select>\n      <label>${isAr?'نوع المشكلة':'Issue type'}</label>\n      <select id=\"ark-t-issue\"><option value=\"\">-- ${isAr?'اختر':'Select'} --</option>${issues.map(i=>`<option>${i}</option>`).join('')}</select>\n      <label style=\"margin-top:10px\">${isAr?'مستوى الخطورة':'Severity & SLA commitment'}</label>\n      <div class=\"ark-sla-box\">\n        <div class=\"ark-sla-row hd\"><div>${isAr?'الأولوية':'Priority'}</div><div>${isAr?'المعيار':'Criteria'}</div><div>${isAr?'رد':'Response'}</div><div>${isAr?'حل':'Resolve'}</div></div>\n        ${ARK_SLA.map(s=>`<div class=\"ark-sla-row\"><div><span class=\"ark-sla-chip ${s.cls}\">${s.p}</span>${s.lbl}</div><div style=\"font-size:10px;color:#888\">${s.crit}</div><div style=\"text-align:center\">${s.resp}</div><div style=\"text-align:center\">${s.res}</div></div>`).join('')}\n        <div class=\"ark-sla-foot\">${isAr?'تغطية P1–P2: على مدار الساعة (٢٤×٧). تغطية P3–P4: ساعات العمل (الأحد–الخميس ٨ص–٦م بتوقيت الرياض)؛ يتوقف عدّاد SLA خارجها.':'P1–P2 coverage: 24×7, measured in elapsed time. P3–P4: business hours (Sun–Thu 8 AM–6 PM KSA); the SLA clock pauses outside this window.'}</div>\n        <div style=\"padding:6px 8px\"><select id=\"ark-t-sev\"><option value=\"\">-- ${isAr?'اختر الأولوية':'Select priority'} --</option>${ARK_SLA.map(s=>`<option>${s.p} — ${s.lbl}</option>`).join('')}</select></div>\n      </div>\n      <button class=\"ark-btn-p\" onclick=\"arkAdvTkt(2)\">${isAr?'التالي →':'Next →'}</button>\n      <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-tkt').remove()\">${isAr?'إلغاء':'Cancel'}</button>`;\n  }\n  else if(arkTktStep===2){\n    const notTech=['Configuration change request','Config change','Billing','General inquiry'].includes(arkTktData.issue);\n    card.innerHTML=`${dots}<h4>${isAr?'تفاصيل تقنية — 2/3':'Technical details — Step 2 of 3'}</h4>\n      <label>${isAr?'وصف المشكلة':'Issue description'}</label>\n      <textarea id=\"ark-t-desc\" placeholder=\"${isAr?'صف المشكلة — متى بدأت؟ ما الخطوات التي اتخذتها؟':'Describe the issue — when did it start? What steps have you taken?'}\"></textarea>\n      ${notTech?'': `<div class=\"r2\">\n        <div><label>${isAr?'كود SIP':'SIP response code'}</label>\n        <select id=\"ark-t-sip\"><option value=\"\">None/Unknown</option><option>403 Forbidden</option><option>404 Not Found</option><option>408 Timeout</option><option>480 Unavailable</option><option>486 Busy</option><option>488 Codec mismatch</option><option>503 Unavailable</option><option>504 Gateway Timeout</option><option>Other</option></select></div>\n        <div><label>${isAr?'المستخدمون المتأثرون':'Users affected'}</label>\n        <input type=\"number\" id=\"ark-t-users\" placeholder=\"e.g. 50\" /></div></div>\n        <label>${isAr?'الأرقام المتأثرة (E.164 +966XXXXXXXXX)':'Affected DIDs (E.164 +966XXXXXXXXX)'}</label>\n        <input type=\"text\" id=\"ark-t-dids\" placeholder=\"+966XXXXXXXXX, +966XXXXXXXXX\" />\n        <div class=\"r2\">\n          <div><label>${isAr?'وقت بدء المشكلة':'Issue start time'}</label><input type=\"text\" id=\"ark-t-since\" placeholder=\"e.g. 2026-04-29 09:30 KSA\" /></div>\n          <div><label>${isAr?'تغييرات أجريت مؤخراً':'Recent changes'}</label><input type=\"text\" id=\"ark-t-changes\" placeholder=\"e.g. SBC firmware update\" /></div>\n        </div>\n        <label>${isAr?'SBC hostname / IP (اختياري)':'SBC hostname / IP (optional)'}</label>\n        <input type=\"text\" id=\"ark-t-sbc\" placeholder=\"sbc.arkan.solutions or 10.x.x.x\" />`}\n      <button class=\"ark-btn-p\" onclick=\"arkAdvTkt(3)\">${isAr?'التالي →':'Next →'}</button>\n      <button class=\"ark-btn-s\" onclick=\"arkAdvTkt(1)\">${isAr?'← رجوع':'← Back'}</button>`;\n  }\n  else{\n    const p=ARK_SLA.find(s=>arkTktData.priority&&arkTktData.priority.startsWith(s.p))||ARK_SLA[2];\n    card.innerHTML=`${dots}<h4>${isAr?'بيانات التواصل — 3/3':'Contact details — Step 3 of 3'}</h4>\n      <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-t-name\" value=\"${arkCtct?.name||arkPcData.name||''}\" />\n      <div class=\"r2\">\n        <div><label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-t-email\" value=\"${arkCtct?.email||''}\" /></div>\n        <div><label>${isAr?'الهاتف':'Phone'}</label><input type=\"tel\" id=\"ark-t-phone\" placeholder=\"+966XXXXXXXXX\" /></div>\n      </div>\n      <div style=\"background:#EAF2F8;border-radius:8px;padding:8px;margin-top:9px;font-size:11px\">\n        <div style=\"font-weight:600;color:#2E5F8A;margin-bottom:4px\">${isAr?'ملخص التذكرة':'Ticket summary'}</div>\n        <div style=\"color:#666\">${isAr?'المنتج':'Product'}: <strong style=\"color:#1A1A2E\">${arkTktData.product||'—'}</strong><br>\n        ${isAr?'المشكلة':'Issue'}: <strong style=\"color:#1A1A2E\">${arkTktData.issue||'—'}</strong><br>\n        ${isAr?'الأولوية':'Priority'}: <span class=\"ark-sla-chip ${p.cls}\">${p.p}</span>\n        ${isAr?'رد خلال':'Response'}: <strong>${p.resp}</strong> · ${isAr?'حل خلال':'Resolve'}: <strong>${p.res}</strong> · ${isAr?'التغطية':'Coverage'}: <strong>${isAr?p.covAr:p.cov}</strong></div>\n      </div>\n      <button class=\"ark-btn-p\" onclick=\"arkSubmitTkt()\">${isAr?'رفع التذكرة':'Submit Ticket'}</button>\n      <button class=\"ark-btn-s\" onclick=\"arkAdvTkt(2)\">${isAr?'← رجوع':'← Back'}</button>`;\n  }\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n}\nfunction arkAdvTkt(s){\n  if(arkTktStep===1){\n    arkTktData.product=document.getElementById('ark-t-prod')?.value;\n    arkTktData.issue=document.getElementById('ark-t-issue')?.value;\n    arkTktData.priority=document.getElementById('ark-t-sev')?.value;\n    if(!arkTktData.product||!arkTktData.issue||!arkTktData.priority){alert(arkLang==='ar'?'يرجى اختيار جميع الحقول.':'Please complete all fields.');return}\n  }\n  if(arkTktStep===2){\n    arkTktData.description=document.getElementById('ark-t-desc')?.value.trim();\n    if(!arkTktData.description){alert(arkLang==='ar'?'يرجى وصف المشكلة.':'Please describe the issue.');return}\n    arkTktData.sipCode=document.getElementById('ark-t-sip')?.value||'';\n    arkTktData.users=document.getElementById('ark-t-users')?.value||'';\n    arkTktData.dids=document.getElementById('ark-t-dids')?.value||'';\n    arkTktData.since=document.getElementById('ark-t-since')?.value||'';\n    arkTktData.changes=document.getElementById('ark-t-changes')?.value||'';\n    arkTktData.sbc=document.getElementById('ark-t-sbc')?.value||'';\n  }\n  arkTktStep=s;arkRenderTkt();\n}\n  async function arkCrmCall(intent, fields) {\n  const r = await fetch(ARK_CONFIG.HS_PROXY_URL, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ intent, fields }),\n  });\n  const d = await r.json();\n  return d.result || 'Done';\n}\n\nasync function arkSubmitTkt() {\n  const name = document.getElementById('ark-t-name')?.value.trim() || arkCtct?.name || arkPcData.name || 'Unknown';\n  const email = document.getElementById('ark-t-email')?.value.trim() || arkCtct?.email || '';\n  const phone = document.getElementById('ark-t-phone')?.value.trim() || '';\n  const sla = ARK_SLA.find(s => arkTktData.priority && arkTktData.priority.startsWith(s.p)) || ARK_SLA[2];\n\n  document.getElementById('ark-tkt').remove();\n  arkSetCrm(arkLang === 'ar' ? 'رفع تذكرة...' : 'Creating ticket...', 'HubSpot');\n  arkAddSys(arkLang === 'ar' ? 'جاري رفع تذكرة الدعم...' : 'Submitting support ticket...');\n\n  const fields = {\n    name,\n    email,\n    phone,\n    company: arkCtct?.company || arkPcData.company || '',\n    platform: arkPcData.platform || '',\n    product: arkTktData.product || '',\n    issue: arkTktData.issue || '',\n    priority: sla.hs,\n    description: arkTktData.description || '',\n    sipCode: arkTktData.sipCode || '',\n    users: arkTktData.users || '',\n    dids: arkTktData.dids || '',\n    since: arkTktData.since || '',\n    changes: arkTktData.changes || '',\n    sbc: arkTktData.sbc || '',\n    subject: `[${sla.p}] ${arkTktData.product} — ${arkTktData.issue}`,\n  };\n\n  try {\n    const r = await arkCrmCall('tech_ticket', fields);\n    arkSetCrm(arkLang === 'ar' ? 'تذكرة:' : 'Ticket:', r.slice(0, 60));\n    arkAddSys(arkLang === 'ar'\n      ? `✓ تم رفع التذكرة: ${fields.subject}`\n      : `✓ Ticket submitted: ${fields.subject}`);\n    arkAddMsg('bot', arkLang === 'ar'\n      ? `تم إنشاء تذكرة الدعم. بناءً على أولوية ${sla.p}، سيتواصل معك فريق أركان خلال ${sla.resp} (${sla.covAr})، والحل المستهدف خلال ${sla.res}.`\n      : `Ticket created. Based on ${sla.p} — ${sla.lbl} priority, the Arkan Solutions team will respond within ${sla.resp} (${sla.cov} coverage) and resolve within ${sla.res}.`);\n    if (!arkRated) setTimeout(() => arkShowRating(), 1200);\n  } catch (e) {\n    arkAddSys(arkLang === 'ar'\n      ? 'تذكرة معلقة — ستُرفع فور استعادة الاتصال.'\n      : 'Ticket queued — will submit when connection is restored.');\n  }\n}\nfunction arkOpenEsc(){arkDoEscalate(false)}\nfunction arkDoEscalate(auto){\n  const old=document.getElementById('ark-escf');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const isAr=arkLang==='ar';\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-escf';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');card.style.width='100%';\n  card.innerHTML=`<h4 style=\"color:#2E5F8A\">${isAr?'التحويل إلى متخصص بشري':'Escalate to Human Specialist'}</h4>\n    <p style=\"font-size:12px;color:#666;margin-bottom:8px\">${isAr?'سيتواصل معك متخصص أركان. يرجى تأكيد بياناتك:':'An Arkan specialist will contact you. Please confirm your details:'}</p>\n    <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-en\" value=\"${arkCtct?.name||arkPcData.name||''}\" />\n    <label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-ee\" value=\"${arkCtct?.email||''}\" />\n    <label>${isAr?'الهاتف (اختياري)':'Phone (optional)'}</label><input type=\"tel\" id=\"ark-ep\" placeholder=\"+966XXXXXXXXX\" />\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitEsc()\">${isAr?'طلب التحويل':'Request Handoff'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-escf').remove()\">${isAr?'إلغاء':'Cancel'}</button>`;\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n  if(!auto)arkAddMsg('bot',isAr?'بالتأكيد. يرجى تعبئة بياناتك وسيتواصل معك أحد متخصصينا.':'Of course. Please fill in the form and a specialist will reach out shortly.');\n}\nasync function arkSubmitEsc() {\n  const n = document.getElementById('ark-en').value.trim();\n  const e = document.getElementById('ark-ee').value.trim();\n  const p = document.getElementById('ark-ep').value.trim();\n  if (!n || !e) {\n    alert(arkLang === 'ar' ? 'يرجى إدخال الاسم والبريد.' : 'Enter name and email.');\n    return;\n  }\n  document.getElementById('ark-escf').remove();\n  arkSetCrm(arkLang === 'ar' ? 'تحويل:' : 'Handoff:', arkLang === 'ar' ? 'جاري...' : 'Processing...');\n\n  // CRITICAL FIX: Decide which intent based on inquiry type from the pre-chat survey.\n  // Sales/commercial → sales_handoff (Deal + Tasks, NO ticket)\n  // Tech/support     → support_handoff (Tasks + Note, NO ticket either — only\n  //                    tech_ticket creates tickets, and that's only via the\n  //                    explicit \"+Ticket\" button)\n  // General/unknown  → support_handoff (routes to sales triage as fallback)\n\n  const inq = (arkPcData.inquiry || '').toLowerCase();\n  const ctx = arkMsgs.slice(-6).map(m => m.role + ': ' + m.content).join('\\n');\n\n  // Build summary from chat context for the CRM record\n  const summary = `Inquiry type: ${arkPcData.inquiry || 'unknown'}\\nVisitor requested handoff to a human agent.\\n\\nRecent chat:\\n${ctx}`;\n\n  // Determine intent\n  const isSales = inq === 'sales' || inq.includes('commercial') || inq.includes('pricing');\n\n  const intent = isSales ? 'sales_handoff' : 'support_handoff';\n  const fields = {\n    name: n,\n    email: e,\n    phone: p,\n    company: arkCtct?.company || arkPcData.company || '',\n    platform: arkPcData.platform || '',\n    inquiry: arkPcData.inquiry || 'general',\n    preferredTime: arkPcData.preferredTime || '',\n    summary,\n  };\n\n  try {\n    const r = await arkCrmCall(intent, fields);\n    arkSetCrm(arkLang === 'ar' ? 'تحويل:' : 'Handoff:', r.slice(0, 50));\n    arkAddSys(\n      arkLang === 'ar'\n        ? `✓ تم توجيه طلبك — سيتواصل معك متخصص أركان على ${e}`\n        : `✓ Handoff submitted — Arkan specialist will contact you at ${e}`\n    );\n    arkAddMsg('bot',\n      arkLang === 'ar'\n        ? `شكراً ${n}. تم إرسال طلبك إلى فريق أركان سوليوشنز وسيتواصلون معك على ${e} خلال 1-2 يوم عمل.`\n        : `Thank you, ${n}. Your request has been routed to Arkan Solutions and a specialist will contact you at ${e} within 1–2 business days (Sun–Thu, KSA).`\n    );\n    if (!arkRated) setTimeout(() => arkShowRating(), 1200);\n  } catch (err) {\n    arkSetCrm('Handoff:', 'Queued');\n  }\n}\nfunction arkShowRating(){\n  if(arkRated)return;\n  const old=document.getElementById('ark-rating');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const isAr=arkLang==='ar';\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-rating';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');\n  card.style.cssText='width:100%;text-align:center';\n  card.innerHTML=`<h4>${isAr?'كيف كانت تجربتك؟':'How was your experience?'}</h4>\n    <p style=\"font-size:12px;color:#666;margin:5px 0 9px\">${isAr?'يرجى تقييم جودة خدمة اليوم:':'Please rate today\\'s service quality:'}</p>\n    <div class=\"ark-stars\" id=\"ark-stars\">\n      ${[1,2,3,4,5].map(i=>`<span class=\"ark-star\" onclick=\"arkSetStar(${i})\" onmouseover=\"arkHoverStar(${i})\" onmouseout=\"arkResetStars()\" data-v=\"${i}\">&#9733;</span>`).join('')}\n    </div>\n    <div id=\"ark-star-lbl\" style=\"font-size:12px;color:#999;height:16px;margin-bottom:6px\"></div>\n    <textarea id=\"ark-r-comment\" style=\"width:100%;border:1px solid #ddd;border-radius:6px;padding:6px 9px;font-size:12px;font-family:Arial,sans-serif;resize:none;height:42px;outline:none;color:#1A1A2E\" placeholder=\"${isAr?'تعليق اختياري...':'Optional comment...'}\"></textarea>\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitRating()\">${isAr?'إرسال التقييم':'Submit rating'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-rating').remove()\">${isAr?'تخطي':'Skip'}</button>`;\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n}\nconst ARK_LABELS=['','Poor','Fair','Good','Very good','Excellent'];\nconst ARK_LABELS_AR=['','ضعيف','مقبول','جيد','جيد جداً','ممتاز'];\nfunction arkHoverStar(n){document.querySelectorAll('.ark-star').forEach((s,i)=>s.classList.toggle('on',i<n));const el=document.getElementById('ark-star-lbl');if(el)el.textContent=arkLang==='ar'?ARK_LABELS_AR[n]:ARK_LABELS[n]}\nfunction arkResetStars(){document.querySelectorAll('.ark-star').forEach((s,i)=>s.classList.toggle('on',i<arkStarVal));const el=document.getElementById('ark-star-lbl');if(el)el.textContent=arkStarVal?(arkLang==='ar'?ARK_LABELS_AR[arkStarVal]:ARK_LABELS[arkStarVal]):''}\nfunction arkSetStar(n){arkStarVal=n;arkResetStars()}\nasync function arkSubmitRating(){\n  if(!arkStarVal){alert(arkLang==='ar'?'يرجى اختيار تقييم.':'Please select a rating.');return}\n  const comment=document.getElementById('ark-r-comment')?.value.trim()||'';\n  document.getElementById('ark-rating').remove();\n  arkRated=true;\n  const lbl=arkLang==='ar'?ARK_LABELS_AR[arkStarVal]:ARK_LABELS[arkStarVal];\n  arkAddSys(arkLang==='ar'?`✓ شكراً على تقييمك: ${lbl} (${arkStarVal}/5)`:`✓ Thank you for your rating: ${lbl} (${arkStarVal}/5)`);\n  arkAddMsg('bot',arkLang==='ar'?'شكراً جزيلاً على تقييمك! ملاحظاتكم تساعدنا على الارتقاء بمستوى خدماتنا. يسعدنا دائماً خدمتك.':'Thank you for your feedback! Your rating helps us continuously improve. It has been a pleasure assisting you at Arkan Solutions.');\n  if(arkCtct?.email&&(arkStarVal||comment)){\n    arkHSCall(`Add note to HubSpot contact ${arkCtct.email}: \"Chat rating: ${arkStarVal}/5 — ${lbl}. Comment: ${comment||'None'}. Platform: ${arkPcData.platform||'N/A'}. Date: ${new Date().toISOString().split('T')[0]}\"`).catch(()=>{});\n  }\n}\n\nfunction arkSQ(t){document.getElementById('ark-ui').value='';arkSendMsg(t)}\nfunction arkHS(){const i=document.getElementById('ark-ui');const t=i.value.trim();if(!t||arkBusy)return;i.value='';i.style.height='auto';arkSendMsg(t)}\nfunction arkHK(e){if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();arkHS()}}\nfunction arkAR(el){el.style.height='auto';el.style.height=Math.min(el.scrollHeight,80)+'px'}\n\n// Show unread badge after 8s if panel not yet opened\nsetTimeout(()=>{if(!arkOpen){document.getElementById('ark-badge').style.display='flex'}},8000);\n</script>","headElements":[{"tag":"meta","attributes":{"name":"viewport","content":"width=device-width, initial-scale=1"}},{"tag":"meta","attributes":{"property":"og:description","content":""}},{"tag":"meta","attributes":{"property":"og:title","content":""}},{"tag":"meta","attributes":{"name":"twitter:description","content":""}},{"tag":"meta","attributes":{"name":"twitter:title","content":""}},{"tag":"style","children":[{"tag":"#text","text":"a.cta_button{-moz-box-sizing:content-box !important;-webkit-box-sizing:content-box !important;box-sizing:content-box !important;vertical-align:middle}.hs-breadcrumb-menu{list-style-type:none;margin:0px 0px 0px 0px;padding:0px 0px 0px 0px}.hs-breadcrumb-menu-item{float:left;padding:10px 0px 10px 10px}.hs-breadcrumb-menu-divider:before{content:'›';padding-left:10px}.hs-featured-image-link{border:0}.hs-featured-image{float:right;margin:0 0 20px 20px;max-width:50%}@media (max-width: 568px){.hs-featured-image{float:none;margin:0;width:100%;max-width:100%}}.hs-screen-reader-text{clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute !important;width:1px}"}]},{"tag":"script","children":[{"tag":"#text","text":"var _hsp = window._hsp = window._hsp || [];\nwindow.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\n\nvar useGoogleConsentModeV2 = true;\nvar waitForUpdateMillis = 1000;\n\n\nif (!window._hsGoogleConsentRunOnce) {\n  window._hsGoogleConsentRunOnce = true;\n\n  gtag('consent', 'default', {\n    'ad_storage': 'denied',\n    'analytics_storage': 'denied',\n    'ad_user_data': 'denied',\n    'ad_personalization': 'denied',\n    'wait_for_update': waitForUpdateMillis\n  });\n\n  if (useGoogleConsentModeV2) {\n    _hsp.push(['useGoogleConsentModeV2'])\n  } else {\n    _hsp.push(['addPrivacyConsentListener', function(consent){\n      var hasAnalyticsConsent = consent && (consent.allowed || (consent.categories && consent.categories.analytics));\n      var hasAdsConsent = consent && (consent.allowed || (consent.categories && consent.categories.advertisement));\n\n      gtag('consent', 'update', {\n        'ad_storage': hasAdsConsent ? 'granted' : 'denied',\n        'analytics_storage': hasAnalyticsConsent ? 'granted' : 'denied',\n        'ad_user_data': hasAdsConsent ? 'granted' : 'denied',\n        'ad_personalization': hasAdsConsent ? 'granted' : 'denied'\n      });\n    }]);\n  }\n}\n\ngtag('js', new Date());\ngtag('set', 'developer_id.dZTQ1Zm', true);\ngtag('config', 'G-28BYD4869J');"}]},{"tag":"script","attributes":{"async":"","src":"https://www.googletagmanager.com/gtag/js?id=G-28BYD4869J"}},{"tag":"script","children":[{"tag":"#text","text":"var _hsp = window._hsp = window._hsp || [];\nwindow.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\n\nvar useGoogleConsentModeV2 = true;\nvar waitForUpdateMillis = 1000;\n\n\n\nvar hsLoadGtm = function loadGtm() {\n    if(window._hsGtmLoadOnce) {\n      return;\n    }\n\n    if (useGoogleConsentModeV2) {\n\n      gtag('set','developer_id.dZTQ1Zm',true);\n\n      gtag('consent', 'default', {\n      'ad_storage': 'denied',\n      'analytics_storage': 'denied',\n      'ad_user_data': 'denied',\n      'ad_personalization': 'denied',\n      'wait_for_update': waitForUpdateMillis\n      });\n\n      _hsp.push(['useGoogleConsentModeV2'])\n    }\n\n    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n    })(window,document,'script','dataLayer','GTM-NSKKDQZ8');\n\n    window._hsGtmLoadOnce = true;\n};\n\n_hsp.push(['addPrivacyConsentListener', function(consent){\n  if(consent.allowed || (consent.categories && consent.categories.analytics)){\n    hsLoadGtm();\n  }\n}]);"}]},{"tag":"link","attributes":{"rel":"canonical","href":"https://help.arkan.international/hs/portals/customer-portal-app/brand"}},{"tag":"meta","attributes":{"property":"og:url","content":"https://help.arkan.international/hs/portals/customer-portal-app/brand"}},{"tag":"meta","attributes":{"http-equiv":"content-language","content":"en"}}],"footerElements":[{"tag":"script","attributes":{"src":"/hs/hsstatic/jquery-libs/static-1.1/jquery/jquery-1.7.1.js"}},{"tag":"script","children":[{"tag":"#text","text":"hsjQuery = window['jQuery'];"}]},{"tag":"script","attributes":{"defer":"","src":"/hs/hsstatic/content-cwv-embed/static-1.1293/embed.js"}},{"tag":"script","children":[{"tag":"#text","text":"var _hsq = _hsq || [];\n_hsq.push([\"setContentType\", \"app-page\"]);\n_hsq.push([\"setCanonicalUrl\", \"https:\\/\\/help.arkan.international\\/hs\\/portals\\/customer-portal-app\\/brand\"]);\n_hsq.push([\"setPageId\", \"457396549872\"]);\n_hsq.push([\"setContentMetadata\", {\n    \"contentPageId\": 457396549872,\n    \"legacyPageId\": \"457396549872\",\n    \"contentFolderId\": null,\n    \"contentGroupId\": null,\n    \"abTestId\": null,\n    \"languageVariantId\": 457396549872,\n    \"languageCode\": \"en\",\n    \n    \n}]);"}],"attributes":{"type":"text/javascript"}},{"tag":"script","id":"hs-script-loader","attributes":{"async":"","defer":"","src":"/hs/scriptloader/8101468.js","type":"text/javascript"}},{"tag":"script","children":[{"tag":"#text","text":"var hsVars = {\n    render_id: \"601e325f-1064-4cc8-9a55-01d562125c87\",\n    ticks: 1787477728848,\n    page_id: 457396549872,\n    \n    content_group_id: 0,\n    portal_id: 8101468,\n    app_hs_base_url: \"https://app-eu1.hubspot.com\",\n    cp_hs_base_url: \"https://cp-eu1.hubspot.com\",\n    language: \"en\",\n    analytics_page_type: \"app-page\",\n    scp_content_type: \"\",\n    \n    analytics_page_id: \"457396549872\",\n    category_id: 20,\n    folder_id: 0,\n    is_hubspot_user: false\n}"}],"attributes":{"type":"text/javascript"}},{"tag":"script","attributes":{"defer":"","src":"/hs/hsstatic/HubspotToolsMenu/static-1.640/js/index.js"}},{"tag":"style","children":[{"tag":"#text","text":"#ark-launcher{position:fixed;bottom:24px;right:24px;z-index:99999;font-family:Arial,sans-serif}\n#ark-btn{width:58px;height:58px;border-radius:50%;background:#2E5F8A;border:none;cursor:pointer;\n  display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(46,95,138,0.45);\n  transition:transform .2s,box-shadow .2s;position:relative}\n#ark-btn:hover{transform:scale(1.07);box-shadow:0 6px 20px rgba(46,95,138,0.55)}\n#ark-btn svg{width:26px;height:26px}\n#ark-badge{position:absolute;top:-3px;right:-3px;width:18px;height:18px;border-radius:50%;\n  background:#F7A800;color:#fff;font-size:10px;font-weight:700;\n  display:flex;align-items:center;justify-content:center;display:none}\n#ark-panel{position:fixed;bottom:94px;right:24px;width:370px;height:580px;\n  background:#fff;border-radius:16px;box-shadow:0 8px 40px rgba(0,0,0,0.18);\n  display:none;flex-direction:column;overflow:hidden;z-index:99998;\n  border:0.5px solid rgba(0,0,0,0.08)}\n@media(max-width:440px){\n  #ark-panel{width:calc(100vw - 20px);right:10px;bottom:80px;height:75vh}}\n/* --- Header --- */\n.ark-hdr{background:#2E5F8A;padding:12px 14px;display:flex;align-items:center;gap:9px;flex-shrink:0}\n.ark-av{width:36px;height:36px;border-radius:50%;background:#F7A800;display:flex;align-items:center;\n  justify-content:center;font-weight:700;font-size:12px;color:#fff;flex-shrink:0}\n.ark-hi{flex:1}\n.ark-hn{color:#fff;font-size:13px;font-weight:600}\n.ark-hs{color:rgba(255,255,255,0.75);font-size:10px;display:flex;align-items:center;gap:4px;margin-top:2px}\n.ark-dot{width:6px;height:6px;border-radius:50%;background:#4CAF50}\n.ark-hbtns{display:flex;gap:5px}\n.ark-hb{background:rgba(255,255,255,0.15);border:none;color:#fff;font-size:10px;\n  padding:3px 8px;border-radius:8px;cursor:pointer;font-family:Arial,sans-serif;white-space:nowrap}\n.ark-hb:hover{background:rgba(255,255,255,0.28)}\n.ark-hb.esc{background:rgba(247,168,0,0.85)}.ark-hb.esc:hover{background:#F7A800}\n.ark-lb{background:rgba(255,255,255,0.2);color:#fff;font-size:10px;padding:2px 7px;border-radius:8px}\n.ark-close{background:none;border:none;color:rgba(255,255,255,0.8);cursor:pointer;\n  font-size:18px;padding:0 0 0 6px;line-height:1}\n/* --- Office hours banner --- */\n.ark-ohb{background:#fff3e0;border-bottom:1px solid #ffe0b2;padding:6px 12px;\n  font-size:11px;color:#e65100;display:none;align-items:center;gap:5px;flex-shrink:0}\n/* --- Pre-chat survey --- */\n#ark-prechat{flex:1;overflow-y:auto;padding:14px;background:#f8f9fa}\n.ark-pc-logo{text-align:center;margin-bottom:12px}\n.ark-pc-logo-circle{width:50px;height:50px;border-radius:50%;background:#F7A800;\n  display:inline-flex;align-items:center;justify-content:center;font-size:18px;color:#fff}\n.ark-pc-title{font-size:15px;font-weight:600;color:#2E5F8A;text-align:center;margin-bottom:4px}\n.ark-pc-sub{font-size:12px;color:#666;text-align:center;margin-bottom:12px}\n.ark-sc{background:#fff;border-radius:10px;padding:14px;border:0.5px solid #e0e0e0}\n.ark-sc label{display:block;font-size:11px;color:#666;margin-bottom:3px;margin-top:8px;font-weight:500}\n.ark-sc label:first-of-type{margin-top:0}\n.ark-sc input,.ark-sc select{width:100%;border:1px solid #ddd;border-radius:6px;padding:7px 10px;\n  font-size:12px;font-family:Arial,sans-serif;outline:none;color:#1A1A2E;background:#fff}\n.ark-sc input:focus,.ark-sc select:focus{border-color:#2E5F8A}\n.ark-it-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:6px}\n.ark-it-btn{border:1px solid #ddd;border-radius:8px;padding:8px 6px;text-align:center;\n  cursor:pointer;font-size:11px;font-family:Arial,sans-serif;background:#fff;color:#333;transition:all .15s}\n.ark-it-btn:hover{border-color:#2E5F8A;background:#EAF2F8;color:#2E5F8A}\n.ark-it-btn.sel{border-color:#2E5F8A;background:#EAF2F8;color:#2E5F8A;font-weight:600}\n.ark-it-icon{font-size:15px;display:block;margin-bottom:3px}\n/* --- Chat body --- */\n#ark-chatbody{display:none;flex:1;flex-direction:column;overflow:hidden}\n.ark-ma{flex:1;overflow-y:auto;padding:10px 10px 4px;display:flex;flex-direction:column;gap:8px;background:#f8f9fa}\n.ark-mr{display:flex;gap:6px;max-width:100%}\n.ark-mr.usr{flex-direction:row-reverse}\n.ark-mb{max-width:82%;padding:8px 12px;border-radius:14px;font-size:13px;line-height:1.5;word-break:break-word}\n.ark-mr.bot .ark-mb{background:#fff;color:#1A1A2E;border-bottom-left-radius:4px;border:0.5px solid #e8e8e8}\n.ark-mr.usr .ark-mb{background:#2E5F8A;color:#fff;border-bottom-right-radius:4px}\n.ark-mr.sys .ark-mb{background:rgba(247,168,0,0.1);color:#F7A800;font-size:11px;text-align:center;\n  border-radius:8px;border:0.5px solid rgba(247,168,0,0.35);max-width:100%;width:100%}\n.ark-mt{font-size:10px;color:#999;margin-top:2px}\n.ark-mr.usr .ark-mt{text-align:right}\n.ark-bav{width:26px;height:26px;border-radius:50%;background:#F7A800;display:flex;\n  align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;flex-shrink:0;margin-top:1px}\n.ark-typing{background:#fff;border-radius:14px;border-bottom-left-radius:4px;\n  padding:10px 12px;display:flex;gap:4px;align-items:center;border:0.5px solid #e8e8e8}\n.ark-typing span{width:6px;height:6px;border-radius:50%;background:#ccc;animation:ark-bop 1.2s infinite}\n.ark-typing span:nth-child(2){animation-delay:.2s}.ark-typing span:nth-child(3){animation-delay:.4s}\n@keyframes ark-bop{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-5px)}}\n.ark-qr{padding:6px 10px 4px;display:flex;flex-wrap:wrap;gap:5px;background:#f8f9fa;flex-shrink:0}\n.ark-qb{background:#fff;border:0.5px solid #2E5F8A;color:#2E5F8A;font-size:11px;\n  padding:4px 9px;border-radius:12px;cursor:pointer;font-family:Arial,sans-serif;transition:background .15s}\n.ark-qb:hover{background:#EAF2F8}\n/* --- CRM bar --- */\n.ark-cbar{background:#EAF2F8;border-top:0.5px solid #d0e4f0;padding:5px 10px;\n  font-size:10px;color:#1A1A2E;display:none;align-items:center;gap:4px;flex-shrink:0}\n.ark-cbar.show{display:flex}\n/* --- Input bar --- */\n.ark-ibar{padding:8px 10px;border-top:1px solid #eee;display:flex;gap:7px;\n  align-items:flex-end;flex-shrink:0;background:#fff}\n#ark-ui{flex:1;border:1px solid #ddd;border-radius:16px;padding:8px 12px;\n  font-size:13px;font-family:Arial,sans-serif;resize:none;outline:none;\n  background:#fff;color:#1A1A2E;line-height:1.4;min-height:34px;max-height:80px}\n#ark-ui:focus{border-color:#2E5F8A}\n#ark-ui.rtl{direction:rtl;text-align:right}\n#ark-sb{width:34px;height:34px;border-radius:50%;background:#2E5F8A;border:none;\n  cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s}\n#ark-sb:hover{background:#245275}#ark-sb:disabled{background:#ccc;cursor:not-allowed}\n/* --- Cards (forms inside chat) --- */\n.ark-card{background:#fff;border-radius:10px;padding:12px;border-left:3px solid #F7A800;\n  width:100%;font-size:12px;margin-top:4px;border:1px solid #e8e8e8;border-left:3px solid #F7A800}\n.ark-card.rtl-c{border-left:none;border-right:3px solid #F7A800;direction:rtl}\n.ark-card h4{font-size:13px;font-weight:600;color:#2E5F8A;margin-bottom:8px}\n.ark-card label{display:block;font-size:11px;color:#666;margin-bottom:3px;margin-top:6px;font-weight:500}\n.ark-card input,.ark-card select,.ark-card textarea{width:100%;border:1px solid #ddd;\n  border-radius:6px;padding:6px 9px;font-size:12px;font-family:Arial,sans-serif;\n  background:#fff;color:#1A1A2E;outline:none}\n.ark-card textarea{resize:none;height:52px}\n.ark-card input:focus,.ark-card select:focus,.ark-card textarea:focus{border-color:#2E5F8A}\n.ark-card .r2{display:grid;grid-template-columns:1fr 1fr;gap:6px}\n.ark-btn-p{background:#F7A800;border:none;color:#fff;font-size:12px;font-family:Arial,sans-serif;\n  padding:6px 13px;border-radius:6px;cursor:pointer;font-weight:600;margin-top:7px;margin-right:5px}\n.ark-btn-s{background:transparent;border:1px solid #ddd;color:#666;font-size:12px;\n  font-family:Arial,sans-serif;padding:6px 11px;border-radius:6px;cursor:pointer;margin-top:7px}\n/* --- SLA --- */\n.ark-sla-chip{display:inline-block;font-size:10px;padding:2px 7px;border-radius:9px;font-weight:600;margin-left:4px}\n.p1c{background:#fdecea;color:#c62828}.p2c{background:#fff3e0;color:#e65100}\n.p3c{background:#e8f5e9;color:#2e7d32}.p4c{background:#e3f2fd;color:#0d47a1}\n.ark-sla-box{border:1px solid #eee;border-radius:8px;margin-top:8px;overflow:hidden;font-size:11px}\n.ark-sla-row{display:grid;grid-template-columns:1fr 1.3fr 70px 70px;padding:5px 8px;border-bottom:1px solid #eee;gap:4px}\n.ark-sla-row:last-child{border-bottom:none}\n.ark-sla-row.hd{background:#2E5F8A;color:#fff;font-weight:600;font-size:10px}\n.ark-sla-foot{padding:5px 8px;font-size:10px;color:#888;background:#fafafa;border-top:1px solid #eee}\n/* --- Stars --- */\n.ark-stars{display:flex;gap:6px;justify-content:center;margin:8px 0}\n.ark-star{font-size:22px;cursor:pointer;color:#ddd;transition:color .15s;user-select:none}\n.ark-star.on{color:#F7A800}\n/* --- Step dots --- */\n.ark-dots{display:flex;gap:5px;justify-content:center;margin-bottom:8px}\n.ark-dot2{width:7px;height:7px;border-radius:50%;background:#ddd}\n.ark-dot2.on{background:#2E5F8A}\n/* --- Powered by --- */\n.ark-pw{font-size:10px;color:#bbb;text-align:center;padding:5px 0 2px;background:#f8f9fa;flex-shrink:0}\n.ark-pw a{color:#bbb;text-decoration:none}"}]},{"tag":"div","id":"ark-launcher","children":[{"tag":"div","id":"ark-btn","children":[{"tag":"svg","id":"ark-icon-chat","children":[{"tag":"path","attributes":{"d":"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}}],"attributes":{"viewbox":"0 0 24 24","stroke-linejoin":"round","stroke-width":"2","fill":"none","stroke":"#fff","stroke-linecap":"round"}},{"tag":"svg","id":"ark-icon-close","children":[{"tag":"line","attributes":{"y1":"6","x1":"18","y2":"18","x2":"6"}},{"tag":"line","attributes":{"y1":"6","x1":"6","y2":"18","x2":"18"}}],"attributes":{"viewbox":"0 0 24 24","stroke-linejoin":"round","stroke-width":"2.5","fill":"none","stroke":"#fff","stroke-linecap":"round"},"style":{"display":"none"}},{"tag":"div","id":"ark-badge"}],"attributes":{"onclick":"arkToggle()","title":"Chat with Arkan Solutions"}}]},{"tag":"div","id":"ark-panel","children":[{"tag":"div","className":"ark-hdr","children":[{"tag":"div","className":"ark-av"},{"tag":"div","className":"ark-hi","children":[{"tag":"div","id":"ark-aname","className":"ark-hn"},{"tag":"div","className":"ark-hs","children":[{"tag":"span","className":"ark-dot"},{"tag":"span","id":"ark-ast"}]}]},{"tag":"div","className":"ark-hbtns","children":[{"tag":"span","id":"ark-lb","className":"ark-lb"},{"tag":"button","className":"ark-hb","attributes":{"onclick":"arkOpenTicket()"}},{"tag":"button","className":"ark-hb esc","attributes":{"onclick":"arkOpenEsc()"}},{"tag":"button","className":"ark-hb","attributes":{"onclick":"arkShowRating()"}},{"tag":"button","className":"ark-close","attributes":{"onclick":"arkToggle()"}}]}]},{"tag":"div","id":"ark-ohb","className":"ark-ohb","children":[{"tag":"span"},{"tag":"span","id":"ark-ohmsg"}]},{"tag":"div","id":"ark-prechat","children":[{"tag":"div","className":"ark-pc-logo","children":[{"tag":"div","className":"ark-pc-logo-circle"}]},{"tag":"div","id":"ark-pc-title","className":"ark-pc-title"},{"tag":"div","id":"ark-pc-sub","className":"ark-pc-sub"},{"tag":"div","id":"ark-sc","className":"ark-sc","children":[{"tag":"label","id":"ark-lbl-name"},{"tag":"input","id":"ark-pc-name","attributes":{"placeholder":"e.g. Ahmed Al-Rashidi","type":"text"}},{"tag":"label","id":"ark-lbl-co"},{"tag":"input","id":"ark-pc-co","attributes":{"placeholder":"e.g. Saudi Telecom Co.","type":"text"}},{"tag":"label","id":"ark-lbl-plat"},{"tag":"select","id":"ark-pc-plat","children":[{"tag":"option","attributes":{"value":""}},{"tag":"option"},{"tag":"option"},{"tag":"option"},{"tag":"option"},{"tag":"option"},{"tag":"option"},{"tag":"option"},{"tag":"option"}]},{"tag":"label","id":"ark-lbl-type"},{"tag":"div","className":"ark-it-grid","children":[{"tag":"div","id":"ark-it-sales","className":"ark-it-btn","children":[{"tag":"span","className":"ark-it-icon"},{"tag":"span","id":"ark-itl-sales"}],"attributes":{"onclick":"arkSelIT('sales')"}},{"tag":"div","id":"ark-it-tech","className":"ark-it-btn","children":[{"tag":"span","className":"ark-it-icon"},{"tag":"span","id":"ark-itl-tech"}],"attributes":{"onclick":"arkSelIT('tech')"}},{"tag":"div","id":"ark-it-onb","className":"ark-it-btn","children":[{"tag":"span","className":"ark-it-icon"},{"tag":"span","id":"ark-itl-onb"}],"attributes":{"onclick":"arkSelIT('onb')"}},{"tag":"div","id":"ark-it-gen","className":"ark-it-btn","children":[{"tag":"span","className":"ark-it-icon"},{"tag":"span","id":"ark-itl-gen"}],"attributes":{"onclick":"arkSelIT('gen')"}}]}]},{"tag":"button","id":"ark-pc-btn","className":"ark-btn-p","attributes":{"onclick":"arkStartChat()"},"style":{"padding":"10px","width":"100%","margin-top":"12px","text-align":"center"}},{"tag":"div","id":"ark-pc-foot","children":[{"tag":"a","attributes":{"href":"https://arkan.solutions/privacy"},"style":{"color":"#bbb"}}],"style":{"color":"#bbb","font-size":"10px","margin-top":"6px","text-align":"center"}}],"style":{"padding":"14px","flex":"1","background":"#f8f9fa","overflow-y":"auto"}},{"tag":"div","id":"ark-chatbody","children":[{"tag":"div","id":"ark-ma","className":"ark-ma"},{"tag":"div","id":"ark-qr","className":"ark-qr"}],"style":{"flex-direction":"column","overflow":"hidden","flex":"1","display":"none"}},{"tag":"div","id":"ark-cbar","className":"ark-cbar","children":[{"tag":"span","style":{"color":"#F7A800"}},{"tag":"span","id":"ark-clbl","style":{"color":"#666"}},{"tag":"span","id":"ark-cval","style":{"color":"#2E5F8A","font-weight":"600"}}]},{"tag":"div","id":"ark-ibar","className":"ark-ibar","children":[{"tag":"textarea","id":"ark-ui","attributes":{"placeholder":"Type your message...","onkeydown":"arkHK(event)","rows":"1","oninput":"arkAR(this)"}},{"tag":"button","id":"ark-sb","children":[{"tag":"svg","children":[{"tag":"line","attributes":{"y1":"2","x1":"22","y2":"13","x2":"11"}},{"tag":"polygon","attributes":{"points":"22 2 15 22 11 13 2 9 22 2"}}],"attributes":{"viewbox":"0 0 24 24","width":"14","stroke-linejoin":"round","stroke-width":"2.5","fill":"none","stroke":"#fff","stroke-linecap":"round","height":"14"}}],"attributes":{"onclick":"arkHS()"}}],"style":{"display":"none"}},{"tag":"div","className":"ark-pw","children":[{"tag":"a","attributes":{"href":"https://arkan.solutions","target":"_blank"}}]}]},{"tag":"script","children":[{"tag":"#text","text":"// ============================================================\n// CONFIGURATION — update PROXY_URL after deploying the worker\n// ============================================================\nconst ARK_CONFIG = {\nPROXY_URL: 'https://arkanchatproxy-func.azurewebsites.net/api/proxy/chat',\nHS_PROXY_URL: 'https://arkanchatproxy-func.azurewebsites.net/api/proxy/hubspot',\n  BRAND: { name: 'Arkan Solutions', color: '#2E5F8A', accent: '#F7A800' },\n  OFFICE_HOURS: { tzRegion: 'Asia/Riyadh', startHour: 8, endHour: 18, workDays: [0,1,2,3,4] }\n};\n// ============================================================\n\n// SLA Rev 062026 — P1 response 30 min (was 15); coverage added.\n// hs = HubSpot hs_ticket_priority value (P1->URGENT, P2->HIGH, P3->MEDIUM, P4->LOW)\nconst ARK_SLA=[\n  {p:'P1',lbl:'Critical',crit:'Complete outage — 0% calls',resp:'30 min',res:'4 hrs',cov:'24×7',covAr:'٢٤×٧',cls:'p1c',hs:'URGENT'},\n  {p:'P2',lbl:'High',crit:'>50% calls failing',resp:'1 hr',res:'8 hrs',cov:'24×7',covAr:'٢٤×٧',cls:'p2c',hs:'HIGH'},\n  {p:'P3',lbl:'Medium',crit:'Intermittent / partial',resp:'4 hrs',res:'24 hrs',cov:'business hours',covAr:'ساعات العمل',cls:'p3c',hs:'MEDIUM'},\n  {p:'P4',lbl:'Low',crit:'Single user / config / billing',resp:'8 hrs',res:'72 hrs',cov:'business hours',covAr:'ساعات العمل',cls:'p4c',hs:'LOW'}\n];\nconst ARK_ISSUES={\n  'MS Teams Cloud Connect':['Registration / trunk failure','Inbound calls not routing','Outbound calls failing','Poor call quality / echo','DTMF / IVR not working','TLS/SRTP certificate error','Number porting','Config change request','Billing'],\n  'Zoom Cloud Connect Phone':['SIP trunk registration failure','Inbound routing failure','Outbound call failure','Call quality degradation','Codec mismatch','SRTP error','Number porting','Config change','Billing'],\n  'Zoom Cloud Connect Contact Center':['Agent connectivity failure','SIP trunk down','IVR routing failure','Recording failure','WebRTC quality issue','Outbound failure','Config change','Billing'],\n  'Genesys Cloud Connect':['SIP trunk registration failure','Inbound routing failure','Outbound call failure','WebRTC agent audio issue','DTMF not passing','TLS handshake failure','Number porting','Config change','Billing'],\n  '3CX':['SIP trunk failure','Extension registration failure','Outbound calls failing','Audio quality issue','TLS certificate error','Config change','Billing'],\n  default:['Service outage','Call quality issue','Registration failure','Routing problem','TLS/SRTP error','Number porting','Config change','Billing','General inquiry']\n};\nconst ARK_SP=`You are Arkan Solutions' bilingual website chat agent (English and Arabic). Arkan Solutions (arkan.solutions) is a Saudi-headquartered enterprise and government cloud voice connectivity vendor — NOT a system integrator.\n\nLANGUAGE: Detect from visitor's message. Respond in same language. Arabic: formal MSA.\n\nPRODUCTS (Arkan Cloud Connect):\n1. MS Teams Cloud Connect — Direct Routing & Operator Connect\n2. Zoom Cloud Connect Phone — BYOC Zoom Phone\n3. Zoom Cloud Connect Contact Center — BYOC Zoom Contact Center\n4. Genesys Cloud Connect — BYOC Genesys Cloud CX\n5. AI Voice Connect — SIP for AI/LLM voice agents (Vapi, Retell AI, Bland AI, ElevenLabs, LiveKit, AWS Connect, Google CCAI, etc.)\n6. API/Programmable Voice Cloud Connect — CPaaS/API\nManaged service (licensing, deployment, change management) available for: MS Teams, Zoom Phone, Zoom Contact Center, 3CX. Connectivity-only for the rest.\n\nVERIFIED FACTS (the only commercial facts you may state):\n- Coverage: 80+ countries on a single contract\n- SLA: 99.99% uptime per calendar month — contractually backed, uniform for all customers\n- Service credits apply when monthly uptime falls below 99.8%, per the published Service Terms & Conditions (arkan.solutions/en/terms-conditions)\n- Dedicated Session Border Controller (SBC) per Enterprise Client; geographically redundant\n- Standard go-live: 3–5 business days from contract signature\n- 24/7 NOC monitoring\n- ISO/IEC 27001 certified (certified by Intertek) — share this proactively with government and regulated-industry visitors; certificate available on request\n- Two PSTN models, surface BOTH in every sales conversation: (a) Arkan Managed PSTN — Arkan provides numbers, porting, termination; one vendor, one invoice. (b) BYOA (Bring Your Own Agreement) — visitor keeps their existing telco contract; Arkan provides SBC and interconnect. Best for regulated industries.\n- Approved reference Enterprise Clients (free to name): DHL, PepsiCo, Lucid Motors, ThyssenKrupp, Qatari Diar, ABK, Hassan Allam, RAYA, HyperMax, Betterhomes, Naqel, SIXT, AMICO, Jisr, TravelNET\n\nTERMINOLOGY — POC vs PRE-GO-LIVE PILOT (important internal distinction):\n- \"POC\" (Proof of Concept) = pre-sale feasibility evaluation for a PROSPECT still deciding. Requires Arkan approval to initiate.\n- \"Pre-Go-Live Pilot\" = accelerated scaled-down production setup for a COMMITTED customer before full go-live. Not a POC.\nIf a committed/contracted customer says \"our POC\", they almost certainly mean their Pre-Go-Live Pilot — use the correct term gently and route any related issue as a normal support matter, not a sales inquiry.\n\nCOMMERCIAL RULES (current quoting policy — reflect but never generate quotes):\n- DID SKUs MUST be bundled with PSTN channel SKUs of the same country. A DID cannot be sold standalone.\n- PSTN channels are sold ONLY in quantities of 10 or 50. If a visitor asks for another quantity, explain the bundling rule and route to pre-sales for a formal quote.\n- Never state specific prices, channel rates, setup fees, or discounts. Pricing comes from formal quotes only.\n\nANTI-HALLUCINATION GUARDRAILS — you DO NOT KNOW and must NEVER state:\n- Country-specific porting timelines. Say: \"Porting timelines depend on the country and the losing carrier; the team will provide a realistic estimate during discovery.\"\n- Country-specific delivery models (direct vs partner per country). Say coverage spans 80+ countries; specifics confirmed by pre-sales.\n- Concurrent-call ratios per agent/user — ASK the visitor for their channel estimate; never invent one.\n- Direct Routing vs Operator Connect recommendations — present both honestly; the discovery call decides.\n- Vendor roadmaps (Microsoft/Zoom/Genesys), SBC IPs, SIP proxy addresses, or internal infrastructure details.\nIf you do not know, say so and hand off. A handoff is always better than an invented specific.\n\nTECHNICAL:\n- Ribbon SBC SWe Edge, SIP TLS port 5061, SRTP MKI=0\n- E.164: WITH + toward cloud platforms; WITHOUT + toward Arkan SIP proxies\n- Codecs: G.711 (PCMA/PCMU), G.729, Opus (WebRTC)\n- SIP errors: 403 auth/config, 404 DID routing, 408 timeout/firewall, 480 unavailable, 486 busy, 488 codec, 503 overload, 504 proxy timeout\n- You may HYPOTHESIZE causes of a reported issue but always mark them as hypotheses (\"the engineer will confirm\"). Never state a diagnosis as fact.\n\nTECHNICAL SUPPORT SLA (Rev 062026): P1 30min/4hr (24x7) | P2 1hr/8hr (24x7) | P3 4hr/24hr (business hours) | P4 8hr/72hr (business hours).\nSLA CLOCK RULES: P1 and P2 are measured in elapsed time around the clock, including weekends and public holidays (on-call framework). P3 and P4 are measured in business hours only (Sun–Thu 08:00–18:00 KSA); the clock pauses outside that window. At any priority, the clock pauses while waiting for information from the customer. If a visitor asks about the SLA, state these times and coverage exactly — never the old 15-minute P1 figure.\n\nSALES & DISCOVERY HANDOFF: Pre-Sales reaches out within 1–2 business days; proposals follow within 3 business days of the discovery call. Never promise hours or same-day callbacks. Be honest; do not over-promise.\n\n—— HUMAN ADAPTATION (this is the most important section) ——\n\nYou are talking to real people, not filling forms. Be human, not scripted.\n\nMIRROR the visitor: their formality, their pace, their warmth, their level of detail. If they write short, you write short. If they write detailed, you can elaborate. If they're warm and chatty, allow yourself a friendly aside. If they're terse and businesslike, get to the point.\n\nREAD EMOTION:\n- Frustration → empathize first, solve second. Don't be cheerful at the wrong moment.\n- Excitement → match their energy.\n- Urgency → cut padding, give concrete next steps fast.\n- Confusion → simplify, slow down, check understanding.\n- Hesitation → give them space, don't push.\n\nCULTURAL CONTEXT (Arkan operates across these regions — adapt naturally):\n- Saudi Arabia & Gulf (UAE, Kuwait, Bahrain, Qatar, Oman): formal courtesy, respect for hierarchy, allow time for relationship-building before business specifics. Honorifics matter.\n- Egypt & Levant (Jordan, Lebanon): warmer, more conversational, balance respect with friendliness. A bit of human warmth lands well.\n- North Africa (Algeria, Morocco, Tunisia): often bilingual French/Arabic; can be more direct than Gulf.\n- Germany & broader Europe: precise, structured, factual. Less small talk. Get to specifics quickly.\n- Sub-Saharan Africa (Uganda, Kenya, Nigeria, etc): English business-formal, often relational and respectful.\n- If you don't know the visitor's region: stay neutral-professional and let their style guide you.\n\nARABIC NUANCE: default to MSA, but if you detect dialect markers, soften your phrasing accordingly. Egyptian markers (إيه، ازاي، عاوز): warmer, less stiff. Gulf markers (وش، شلون، ابغى): more formal courtesy. If unsure, MSA is always safe. Reciprocate religious greetings appropriately (السلام عليكم → وعليكم السلام ورحمة الله وبركاته).\n\nDON'T over-format. If a flowing 2–3 sentence answer fits, write it as flowing sentences — not bullets, not tables, not headers. Reserve structure for genuinely structured content (e.g. SLA tiers, pricing breakdowns, multi-country options). Never use bullets for greeting, empathy, or simple Q&A.\n\nUSE NAMES sparingly. Once when greeting, occasionally for warmth, but not every turn.\n\nACKNOWLEDGE their context: their country, their time zone, their platform, what they already told you. Don't re-ask things they already answered.\n\nBe HUMAN: a brief acknowledgment (\"that makes sense\"), a small empathetic note (\"multi-country deployments are always tricky\"), even a tasteful aside is fine when it fits naturally. But never force warmth where it's not invited.\n\n—— SIGNALS (append silently at end of message — no quotes, no explanation) ——\n\n[COLLECT_LEAD] — visitor needs a follow-up; opens lead form\n[OPEN_TICKET] — visitor described a technical issue; opens ticket form\n[ESCALATE] — visitor wants human or situation is sensitive; opens handoff form\n[RATE_CHAT] — after resolving, invites satisfaction rating (NOT during an unresolved P1/P2 incident)\n[HS_CREATE:name|email|company] — quick contact creation\n[HS_LOOKUP:email] — find existing contact\n\n[SALES_HANDOFF::name=...|email=...|company=...|phone=...|platform=...|preferredTime=...|summary=...]\n   Use only when the visitor has CONFIRMED a sales/discovery follow-up AND provided email + phone.\n   The widget creates contact + deal + assigned tasks + reference number, and displays the reference.\n   DO NOT include a reference number yourself — the system generates and displays it.\n   Summary: one natural paragraph of their interest, scale, and requirements.\n\n—— HANDOFF DISAMBIGUATION (CRITICAL) ——\nBefore any handoff, confirm what the visitor actually needs:\n(a) Sales / pricing / demo / quote / discovery → [SALES_HANDOFF::...] after email + phone. Creates a Deal. NEVER a ticket.\n(b) Active technical issue or outage → [OPEN_TICKET]. The ticket form creates a Ticket.\n(c) Genuinely ambiguous \"talk to a human\" → [ESCALATE]. Creates contact + callback task. NO ticket. NO deal.\n(d) Billing / contract follow-up on existing service → [ESCALATE]. Billing is not technical support.\nNEVER use [ESCALATE] for an active sales conversation — sales must go through [SALES_HANDOFF].\nIf intent is unclear, ASK: \"Are you looking for sales information, or is there a technical issue we should look at?\" / \"هل استفسارك يخص المبيعات أم لديك مشكلة فنية تحتاج معالجة؟\"\n\nTONE: Confident, professional, human. 2-4 sentences per turn. No markdown.`;\n\nlet arkMsgs=[],arkLang='en',arkBusy=false,arkCtct=null,arkPcData={},arkSelInq='',arkOpen=false,arkRated=false,arkStarVal=0,arkTktStep=1,arkTktData={};\n\nfunction arkToggle(){\n  arkOpen=!arkOpen;\n  document.getElementById('ark-panel').style.display=arkOpen?'flex':'none';\n  document.getElementById('ark-icon-chat').style.display=arkOpen?'none':'block';\n  document.getElementById('ark-icon-close').style.display=arkOpen?'block':'none';\n  document.getElementById('ark-badge').style.display='none';\n  if(arkOpen&&!arkPcData.started) arkCheckLang();\n}\n\nfunction arkCheckLang(){\n  const ua=navigator.language||'';\n  if(ua.startsWith('ar')) arkInitArabic();\n}\n\nfunction arkIsAr(t){return /[\\u0600-\\u06FF]/.test(t)}\nfunction arkGT(){return new Date().toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'})}\n\nfunction arkCheckOH(){\n  const now=new Date();\n  const ksa=new Date(now.toLocaleString('en-US',{timeZone:ARK_CONFIG.OFFICE_HOURS.tzRegion}));\n  const day=ksa.getDay();\n  const hr=ksa.getHours()+ksa.getMinutes()/60;\n  const ok=ARK_CONFIG.OFFICE_HOURS.workDays.includes(day)&&hr>=ARK_CONFIG.OFFICE_HOURS.startHour&&hr<ARK_CONFIG.OFFICE_HOURS.endHour;\n  if(!ok){\n    const ohb=document.getElementById('ark-ohb');\n    ohb.style.display='flex';\n    document.getElementById('ark-ohmsg').textContent=arkLang==='ar'\n      ?'خارج أوقات العمل (الأحد–الخميس ٨ص–٦م بتوقيت الرياض). الحالات الحرجة (P1/P2) تُعالج على مدار الساعة. سنرد على باقي الطلبات فور عودة الفريق.'\n      :'Outside office hours (Sun–Thu 8:00 AM–6:00 PM KSA). Critical incidents (P1/P2) are handled 24×7. Other requests will be answered when the team is back.';\n  }\n}\n\nfunction arkSelIT(t){\n  ['sales','tech','onb','gen'].forEach(x=>document.getElementById('ark-it-'+x).classList.remove('sel'));\n  document.getElementById('ark-it-'+t).classList.add('sel');\n  arkSelInq=t;\n}\n\nfunction arkStartChat(){\n  const n=document.getElementById('ark-pc-name').value.trim();\n  const c=document.getElementById('ark-pc-co').value.trim();\n  const p=document.getElementById('ark-pc-plat').value;\n  if(!n){alert(arkLang==='ar'?'يرجى إدخال اسمك.':'Please enter your name.');return}\n  arkPcData={name:n,company:c,platform:p,inquiry:arkSelInq,started:true};\n  arkCtct={name:n,company:c};\n  document.getElementById('ark-prechat').style.display='none';\n  const cb=document.getElementById('ark-chatbody');\n  cb.style.display='flex';cb.style.flexDirection='column';\n  document.getElementById('ark-ibar').style.display='flex';\n  arkCheckOH();\n  arkBuildQR();\n  const gr=arkGreeting(n,p,arkSelInq);\n  arkMsgs.push({role:'assistant',content:gr});\n  arkAddMsg('bot',gr);\n\n  // Auto-create HubSpot contact from survey data\n  if(n&&c) arkHSCall(`Create or update HubSpot contact: Name: ${n}, Company: ${c}. Source: Website Chat Widget. Confirm.`).then(r=>arkSetCrm('Contact:',r.slice(0,45))).catch(()=>{});\n}\n\nfunction arkGreeting(name,plat,inq){\n  const platMsg=plat&&plat!=='Not sure yet'?' regarding '+plat:'';\n  const inqMsg={sales:' Our team is ready to walk you through Arkan Cloud Connect.',tech:' Our technical support team is standing by.',onb:' Let us guide you through the onboarding process.',gen:''}[inq]||'';\n  if(arkLang==='ar') return `أهلاً ${name}! مرحباً بك في أركان سوليوشنز. ${plat&&plat!=='Not sure yet'?'يسعدنا مساعدتك بشأن '+plat+'.':''} كيف يمكنني مساعدتك اليوم؟`;\n  return `Welcome, ${name}! I am your cloud voice connectivity specialist at Arkan Solutions${platMsg}.${inqMsg} How can I assist you today?`;\n}\n\nfunction arkBuildQR(){\n  const qr=document.getElementById('ark-qr');qr.innerHTML='';\n  const chips=arkPcData.inquiry==='tech'\n    ?['Report a call issue','SLA commitments','Config change request','Track open ticket']\n    :arkLang==='ar'?['الإبلاغ عن مشكلة','تفاصيل SLA','طلب تغيير إعدادات','تحدث مع المبيعات']\n    :['Arkan Cloud Connect overview','MS Teams Direct Routing','Genesys Cloud CX','Request a demo'];\n  chips.forEach(t=>{const b=document.createElement('button');b.className='ark-qb';b.textContent=t;b.onclick=()=>arkSQ(t);qr.appendChild(b)});\n}\n\nfunction arkAddMsg(role,text,extra){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr '+role;\n  if(role==='bot'){const av=document.createElement('div');av.className='ark-bav';av.textContent='AS';row.appendChild(av)}\n  const col=document.createElement('div');\n  col.style.cssText='display:flex;flex-direction:column;max-width:82%';\n  if(role==='usr')col.style.alignItems='flex-end';\n  const bub=document.createElement('div');bub.className='ark-mb';\n  if(arkIsAr(text)){bub.style.direction='rtl';bub.style.textAlign='right'}\n  bub.textContent=text;col.appendChild(bub);\n  const tm=document.createElement('div');tm.className='ark-mt';tm.textContent=arkGT();col.appendChild(tm);\n  if(extra)col.appendChild(extra);\n  row.appendChild(col);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\n\nfunction arkAddSys(t){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr sys';\n  const b=document.createElement('div');b.className='ark-mb';\n  if(arkIsAr(t)){b.style.direction='rtl'}b.textContent=t;\n  row.appendChild(b);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\n\nfunction arkShowTyping(){\n  const area=document.getElementById('ark-ma');\n  const row=document.createElement('div');row.className='ark-mr bot';row.id='ark-trow';\n  const av=document.createElement('div');av.className='ark-bav';av.textContent='AS';\n  const b=document.createElement('div');b.className='ark-typing';\n  b.innerHTML='<span></span><span></span><span></span>';\n  row.appendChild(av);row.appendChild(b);area.appendChild(row);area.scrollTop=area.scrollHeight;\n}\nfunction arkRmTyping(){const el=document.getElementById('ark-trow');if(el)el.remove()}\n\nfunction arkSetCrm(l,v){\n  const bar=document.getElementById('ark-cbar');bar.classList.add('show');\n  document.getElementById('ark-clbl').textContent=l;\n  document.getElementById('ark-cval').textContent=v;\n}\n\nfunction arkSetLang(l){\n  arkLang=l;\n  document.getElementById('ark-lb').textContent=l==='ar'?'ع':'EN';\n  const inp=document.getElementById('ark-ui');\n  if(l==='ar'){inp.classList.add('rtl');inp.placeholder='اكتب رسالتك...';\n    document.getElementById('ark-aname').textContent='أركان سوليوشنز';\n    document.getElementById('ark-ast').textContent='خبير الاتصالات السحابية · متاح'}\n  else{inp.classList.remove('rtl');inp.placeholder='Type your message...';\n    document.getElementById('ark-aname').textContent='Arkan Solutions';\n    document.getElementById('ark-ast').textContent='Cloud Voice Expert · Online'}\n}\n\nfunction arkInitArabic(){\n  arkSetLang('ar');\n  document.getElementById('ark-pc-title').textContent='أهلاً بك في أركان سوليوشنز';\n  document.getElementById('ark-pc-sub').textContent='ساعدنا لنخدمك بشكل أفضل — 20 ثانية فقط.';\n  document.getElementById('ark-pc-btn').textContent='ابدأ المحادثة';\n  document.getElementById('ark-lbl-name').textContent='الاسم الكامل';\n  document.getElementById('ark-lbl-co').textContent='الشركة';\n  document.getElementById('ark-lbl-plat').textContent='المنصة الحالية أو المستهدفة';\n  document.getElementById('ark-lbl-type').textContent='كيف يمكننا مساعدتك؟';\n  document.getElementById('ark-itl-sales').textContent='استفسار مبيعات';\n  document.getElementById('ark-itl-tech').textContent='دعم تقني';\n  document.getElementById('ark-itl-onb').textContent='مساعدة تفعيل';\n  document.getElementById('ark-itl-gen').textContent='سؤال عام';\n  document.getElementById('ark-pc-name').placeholder='مثال: أحمد الراشدي';\n  document.getElementById('ark-pc-co').placeholder='مثال: شركة الاتصالات السعودية';\n  document.getElementById('ark-sc').style.direction='rtl';\n}\n\nasync function arkHSCall(prompt){\n  const r=await fetch(ARK_CONFIG.HS_PROXY_URL,{method:'POST',\n    headers:{'Content-Type':'application/json'},\n    body:JSON.stringify({prompt})});\n  const d=await r.json();\n  return d.result||'Done';\n}\n\n// Generate reference number client-side (matches worker format)\nfunction arkGenRef(name){\n  const initials=(name||'XX').split(' ').map(w=>w[0]||'').join('').toUpperCase().slice(0,2)||'XX';\n  const date=new Date().toISOString().slice(0,10).replace(/-/g,'');\n  const rand=Math.floor(Math.random()*100).toString().padStart(2,'0');\n  return `ARK-${date}-${initials}${rand}`;\n}\n\n// Sales handoff: contact + deal + tasks + reference number\n\nasync function arkProcessSalesHandoff(payload) {\n  const ref = arkGenRef(arkCtct?.name || arkPcData.name || 'XX');\n  arkSetCrm(arkLang === 'ar' ? 'جاري المعالجة...' : 'Processing handoff...', 'HubSpot');\n  const isAr = arkLang === 'ar';\n\n  // Parse the SALES_HANDOFF::key=value|key=value format the bot emitted\n  const fields = {};\n  payload.split('|').forEach(pair => {\n    const i = pair.indexOf('=');\n    if (i > 0) fields[pair.slice(0, i).trim()] = pair.slice(i + 1).trim();\n  });\n  fields.reference = ref;\n\n  try {\n    const r = await arkCrmCall('sales_handoff', fields);\n    arkSetCrm(arkLang === 'ar' ? 'تم الحفظ:' : 'CRM saved:', ref);\n    arkAddSys(isAr\n      ? `✅ تم حفظ بياناتك في HubSpot\n📋 الرقم المرجعي: ${ref}\n👤 جهة اتصال أُنشئت\n💼 فرصة بيع مفتوحة\n📅 مهام مُعيّنة لفرق المبيعات والتقني`\n      : `✅ Saved to HubSpot\n📋 Reference: ${ref}\n👤 Contact created\n💼 Deal opened in pipeline\n📅 Tasks assigned to Pre-Sales & Operations`);\n    setTimeout(() => {\n      arkAddMsg('bot', isAr\n        ? `الرقم المرجعي لطلبك هو ${ref} — احتفظ به للرجوع إليه. سيتواصل معك متخصص أركان خلال 1-2 يوم عمل لتنسيق المكالمة.`\n        : `Your reference number is ${ref} — please keep it for follow-up. An Arkan specialist will contact you within 1–2 business days to schedule the discovery call.`);\n      if (!arkRated) setTimeout(() => arkShowRating(), 2000);\n    }, 600);\n  } catch (e) {\n    arkSetCrm('Handoff:', 'Queued');\n    arkAddSys(isAr\n      ? '⚠️ تم استلام طلبك وسيتم معالجته عند استعادة الاتصال.'\n      : '⚠️ Handoff queued — will sync when connection is restored.');\n  }\n}\n\nasync function arkSendMsg(txt){\n  if(arkBusy)return;arkBusy=true;\n  document.getElementById('ark-sb').disabled=true;\n  document.getElementById('ark-qr').style.display='none';\n  if(arkIsAr(txt)&&arkLang!=='ar')arkSetLang('ar');\n  arkMsgs.push({role:'user',content:txt});\n  arkAddMsg('usr',txt);arkShowTyping();\n  try{\n    const res=await fetch(ARK_CONFIG.PROXY_URL,{method:'POST',\n      headers:{'Content-Type':'application/json'},\n      body:JSON.stringify({system:ARK_SP,messages:arkMsgs})});\n    const d=await res.json();\n    let bot=d.content||'';\n    let extra=null;\n    if(bot.includes('[COLLECT_LEAD]')){bot=bot.replace('[COLLECT_LEAD]','').trim();extra=arkBuildLeadForm()}\n    if(bot.includes('[OPEN_TICKET]')){bot=bot.replace('[OPEN_TICKET]','').trim();setTimeout(()=>arkOpenTicket(),400)}\n    if(bot.includes('[ESCALATE]')){bot=bot.replace('[ESCALATE]','').trim();setTimeout(()=>arkDoEscalate(true),300)}\n    if(bot.includes('[RATE_CHAT]')&&!arkRated){bot=bot.replace('[RATE_CHAT]','').trim();setTimeout(()=>arkShowRating(),800)}\n    const cm=bot.match(/\\[HS_CREATE:([^\\]]+)\\]/);\n    const lm=bot.match(/\\[HS_LOOKUP:([^\\]]+)\\]/);\n    const sh=bot.match(/\\[SALES_HANDOFF::([^\\]]+)\\]/);\n    if(cm){bot=bot.replace(cm[0],'').trim();const[n,e,c]=cm[1].split('|');\n      arkHSCall(`Create or update HubSpot contact: Name: ${n}, Email: ${e}, Company: ${c||'Unknown'}.`).then(r=>arkSetCrm('CRM:',r.slice(0,45))).catch(()=>{})}\n    if(lm){bot=bot.replace(lm[0],'').trim();\n      arkHSCall(`Look up HubSpot contact: ${lm[1]}. Return name, company, lifecycle.`).then(r=>arkSetCrm('CRM:',r.slice(0,45))).catch(()=>{})}\n    if(sh){bot=bot.replace(sh[0],'').trim();arkProcessSalesHandoff(sh[1])}\n    arkRmTyping();arkMsgs.push({role:'assistant',content:bot});arkAddMsg('bot',bot,extra);\n  }catch(e){arkRmTyping();arkAddMsg('bot',arkLang==='ar'?'عذراً، خطأ في الاتصال. يرجى المحاولة مرة أخرى.':'Apologies — connectivity issue. Please try again.')}\n  arkBusy=false;document.getElementById('ark-sb').disabled=false;\n}\n\nfunction arkBuildLeadForm(){\n  const w=document.createElement('div');w.className='ark-card'+(arkLang==='ar'?' rtl-c':'');w.id='ark-lform';\n  const isAr=arkLang==='ar';\n  w.innerHTML=`<h4>${isAr?'بياناتك للتواصل':'Your contact details'}</h4>\n    <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-ln\" value=\"${arkCtct?.name||''}\" />\n    <label>${isAr?'الشركة':'Company'}</label><input type=\"text\" id=\"ark-lc\" value=\"${arkCtct?.company||''}\" />\n    <label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-le\" />\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitLead()\">${isAr?'إرسال':'Submit'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-lform').remove()\">${isAr?'لاحقاً':'Later'}</button>`;\n  return w;\n}\nasync function arkSubmitLead(){\n  const n=document.getElementById('ark-ln').value.trim();\n  const c=document.getElementById('ark-lc').value.trim();\n  const e=document.getElementById('ark-le').value.trim();\n  if(!n||!e){alert(arkLang==='ar'?'يرجى إدخال الاسم والبريد.':'Enter name and email.');return}\n  arkCtct={...arkCtct,name:n,company:c,email:e};\n  document.getElementById('ark-lform').remove();\n  arkSetCrm(arkLang==='ar'?'جاري الحفظ...':'Saving...',n);\n  try{const r=await arkHSCall(`Create or update HubSpot contact: Name: ${n}, Email: ${e}, Company: ${c||'Unknown'}. Source: Website Chat.`);arkSetCrm(arkLang==='ar'?'تم:':'Saved:',`${n} · ${c||e}`);arkAddSys(arkLang==='ar'?'✓ تم حفظ بياناتك':'✓ Contact saved to HubSpot')}catch(err){}\n  await arkSendMsg(arkLang==='ar'?`اسمي ${n} من ${c}، بريدي ${e}`:`My name is ${n} from ${c}, email ${e}`);\n}\n\nfunction arkOpenTicket(){\n  const old=document.getElementById('ark-tkt');if(old)old.remove();\n  arkTktStep=1;arkTktData={};arkRenderTkt();\n}\nfunction arkRenderTkt(){\n  const old=document.getElementById('ark-tkt');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-tkt';\n  const isAr=arkLang==='ar';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');card.style.width='100%';\n  const dots=`<div class=\"ark-dots\">${[1,2,3].map(i=>`<div class=\"ark-dot2${arkTktStep>=i?' on':''}\"></div>`).join('')}</div>`;\n  if(arkTktStep===1){\n    const plat=arkPcData.platform||'';\n    const issues=(ARK_ISSUES[Object.keys(ARK_ISSUES).find(k=>k.includes(plat.split(' ')[0]))||'default']||ARK_ISSUES.default);\n    card.innerHTML=`${dots}<h4>${isAr?'تذكرة دعم — الخطوة 1/3':'Support Ticket — Step 1 of 3'}</h4>\n      <label>${isAr?'المنتج المتأثر':'Affected product'}</label>\n      <select id=\"ark-t-prod\">${['MS Teams Cloud Connect','Zoom Cloud Connect Phone','Zoom Cloud Connect Contact Center','Genesys Cloud Connect','AI Voice Connect','API / Programmable Voice Cloud Connect'].map(p=>`<option${plat&&p.toLowerCase().includes(plat.toLowerCase().split(' ')[0])?' selected':''}>${p}</option>`).join('')}</select>\n      <label>${isAr?'نوع المشكلة':'Issue type'}</label>\n      <select id=\"ark-t-issue\"><option value=\"\">-- ${isAr?'اختر':'Select'} --</option>${issues.map(i=>`<option>${i}</option>`).join('')}</select>\n      <label style=\"margin-top:10px\">${isAr?'مستوى الخطورة':'Severity & SLA commitment'}</label>\n      <div class=\"ark-sla-box\">\n        <div class=\"ark-sla-row hd\"><div>${isAr?'الأولوية':'Priority'}</div><div>${isAr?'المعيار':'Criteria'}</div><div>${isAr?'رد':'Response'}</div><div>${isAr?'حل':'Resolve'}</div></div>\n        ${ARK_SLA.map(s=>`<div class=\"ark-sla-row\"><div><span class=\"ark-sla-chip ${s.cls}\">${s.p}</span>${s.lbl}</div><div style=\"font-size:10px;color:#888\">${s.crit}</div><div style=\"text-align:center\">${s.resp}</div><div style=\"text-align:center\">${s.res}</div></div>`).join('')}\n        <div class=\"ark-sla-foot\">${isAr?'تغطية P1–P2: على مدار الساعة (٢٤×٧). تغطية P3–P4: ساعات العمل (الأحد–الخميس ٨ص–٦م بتوقيت الرياض)؛ يتوقف عدّاد SLA خارجها.':'P1–P2 coverage: 24×7, measured in elapsed time. P3–P4: business hours (Sun–Thu 8 AM–6 PM KSA); the SLA clock pauses outside this window.'}</div>\n        <div style=\"padding:6px 8px\"><select id=\"ark-t-sev\"><option value=\"\">-- ${isAr?'اختر الأولوية':'Select priority'} --</option>${ARK_SLA.map(s=>`<option>${s.p} — ${s.lbl}</option>`).join('')}</select></div>\n      </div>\n      <button class=\"ark-btn-p\" onclick=\"arkAdvTkt(2)\">${isAr?'التالي →':'Next →'}</button>\n      <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-tkt').remove()\">${isAr?'إلغاء':'Cancel'}</button>`;\n  }\n  else if(arkTktStep===2){\n    const notTech=['Configuration change request','Config change','Billing','General inquiry'].includes(arkTktData.issue);\n    card.innerHTML=`${dots}<h4>${isAr?'تفاصيل تقنية — 2/3':'Technical details — Step 2 of 3'}</h4>\n      <label>${isAr?'وصف المشكلة':'Issue description'}</label>\n      <textarea id=\"ark-t-desc\" placeholder=\"${isAr?'صف المشكلة — متى بدأت؟ ما الخطوات التي اتخذتها؟':'Describe the issue — when did it start? What steps have you taken?'}\"></textarea>\n      ${notTech?'': `<div class=\"r2\">\n        <div><label>${isAr?'كود SIP':'SIP response code'}</label>\n        <select id=\"ark-t-sip\"><option value=\"\">None/Unknown</option><option>403 Forbidden</option><option>404 Not Found</option><option>408 Timeout</option><option>480 Unavailable</option><option>486 Busy</option><option>488 Codec mismatch</option><option>503 Unavailable</option><option>504 Gateway Timeout</option><option>Other</option></select></div>\n        <div><label>${isAr?'المستخدمون المتأثرون':'Users affected'}</label>\n        <input type=\"number\" id=\"ark-t-users\" placeholder=\"e.g. 50\" /></div></div>\n        <label>${isAr?'الأرقام المتأثرة (E.164 +966XXXXXXXXX)':'Affected DIDs (E.164 +966XXXXXXXXX)'}</label>\n        <input type=\"text\" id=\"ark-t-dids\" placeholder=\"+966XXXXXXXXX, +966XXXXXXXXX\" />\n        <div class=\"r2\">\n          <div><label>${isAr?'وقت بدء المشكلة':'Issue start time'}</label><input type=\"text\" id=\"ark-t-since\" placeholder=\"e.g. 2026-04-29 09:30 KSA\" /></div>\n          <div><label>${isAr?'تغييرات أجريت مؤخراً':'Recent changes'}</label><input type=\"text\" id=\"ark-t-changes\" placeholder=\"e.g. SBC firmware update\" /></div>\n        </div>\n        <label>${isAr?'SBC hostname / IP (اختياري)':'SBC hostname / IP (optional)'}</label>\n        <input type=\"text\" id=\"ark-t-sbc\" placeholder=\"sbc.arkan.solutions or 10.x.x.x\" />`}\n      <button class=\"ark-btn-p\" onclick=\"arkAdvTkt(3)\">${isAr?'التالي →':'Next →'}</button>\n      <button class=\"ark-btn-s\" onclick=\"arkAdvTkt(1)\">${isAr?'← رجوع':'← Back'}</button>`;\n  }\n  else{\n    const p=ARK_SLA.find(s=>arkTktData.priority&&arkTktData.priority.startsWith(s.p))||ARK_SLA[2];\n    card.innerHTML=`${dots}<h4>${isAr?'بيانات التواصل — 3/3':'Contact details — Step 3 of 3'}</h4>\n      <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-t-name\" value=\"${arkCtct?.name||arkPcData.name||''}\" />\n      <div class=\"r2\">\n        <div><label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-t-email\" value=\"${arkCtct?.email||''}\" /></div>\n        <div><label>${isAr?'الهاتف':'Phone'}</label><input type=\"tel\" id=\"ark-t-phone\" placeholder=\"+966XXXXXXXXX\" /></div>\n      </div>\n      <div style=\"background:#EAF2F8;border-radius:8px;padding:8px;margin-top:9px;font-size:11px\">\n        <div style=\"font-weight:600;color:#2E5F8A;margin-bottom:4px\">${isAr?'ملخص التذكرة':'Ticket summary'}</div>\n        <div style=\"color:#666\">${isAr?'المنتج':'Product'}: <strong style=\"color:#1A1A2E\">${arkTktData.product||'—'}</strong><br>\n        ${isAr?'المشكلة':'Issue'}: <strong style=\"color:#1A1A2E\">${arkTktData.issue||'—'}</strong><br>\n        ${isAr?'الأولوية':'Priority'}: <span class=\"ark-sla-chip ${p.cls}\">${p.p}</span>\n        ${isAr?'رد خلال':'Response'}: <strong>${p.resp}</strong> · ${isAr?'حل خلال':'Resolve'}: <strong>${p.res}</strong> · ${isAr?'التغطية':'Coverage'}: <strong>${isAr?p.covAr:p.cov}</strong></div>\n      </div>\n      <button class=\"ark-btn-p\" onclick=\"arkSubmitTkt()\">${isAr?'رفع التذكرة':'Submit Ticket'}</button>\n      <button class=\"ark-btn-s\" onclick=\"arkAdvTkt(2)\">${isAr?'← رجوع':'← Back'}</button>`;\n  }\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n}\nfunction arkAdvTkt(s){\n  if(arkTktStep===1){\n    arkTktData.product=document.getElementById('ark-t-prod')?.value;\n    arkTktData.issue=document.getElementById('ark-t-issue')?.value;\n    arkTktData.priority=document.getElementById('ark-t-sev')?.value;\n    if(!arkTktData.product||!arkTktData.issue||!arkTktData.priority){alert(arkLang==='ar'?'يرجى اختيار جميع الحقول.':'Please complete all fields.');return}\n  }\n  if(arkTktStep===2){\n    arkTktData.description=document.getElementById('ark-t-desc')?.value.trim();\n    if(!arkTktData.description){alert(arkLang==='ar'?'يرجى وصف المشكلة.':'Please describe the issue.');return}\n    arkTktData.sipCode=document.getElementById('ark-t-sip')?.value||'';\n    arkTktData.users=document.getElementById('ark-t-users')?.value||'';\n    arkTktData.dids=document.getElementById('ark-t-dids')?.value||'';\n    arkTktData.since=document.getElementById('ark-t-since')?.value||'';\n    arkTktData.changes=document.getElementById('ark-t-changes')?.value||'';\n    arkTktData.sbc=document.getElementById('ark-t-sbc')?.value||'';\n  }\n  arkTktStep=s;arkRenderTkt();\n}\n  async function arkCrmCall(intent, fields) {\n  const r = await fetch(ARK_CONFIG.HS_PROXY_URL, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ intent, fields }),\n  });\n  const d = await r.json();\n  return d.result || 'Done';\n}\n\nasync function arkSubmitTkt() {\n  const name = document.getElementById('ark-t-name')?.value.trim() || arkCtct?.name || arkPcData.name || 'Unknown';\n  const email = document.getElementById('ark-t-email')?.value.trim() || arkCtct?.email || '';\n  const phone = document.getElementById('ark-t-phone')?.value.trim() || '';\n  const sla = ARK_SLA.find(s => arkTktData.priority && arkTktData.priority.startsWith(s.p)) || ARK_SLA[2];\n\n  document.getElementById('ark-tkt').remove();\n  arkSetCrm(arkLang === 'ar' ? 'رفع تذكرة...' : 'Creating ticket...', 'HubSpot');\n  arkAddSys(arkLang === 'ar' ? 'جاري رفع تذكرة الدعم...' : 'Submitting support ticket...');\n\n  const fields = {\n    name,\n    email,\n    phone,\n    company: arkCtct?.company || arkPcData.company || '',\n    platform: arkPcData.platform || '',\n    product: arkTktData.product || '',\n    issue: arkTktData.issue || '',\n    priority: sla.hs,\n    description: arkTktData.description || '',\n    sipCode: arkTktData.sipCode || '',\n    users: arkTktData.users || '',\n    dids: arkTktData.dids || '',\n    since: arkTktData.since || '',\n    changes: arkTktData.changes || '',\n    sbc: arkTktData.sbc || '',\n    subject: `[${sla.p}] ${arkTktData.product} — ${arkTktData.issue}`,\n  };\n\n  try {\n    const r = await arkCrmCall('tech_ticket', fields);\n    arkSetCrm(arkLang === 'ar' ? 'تذكرة:' : 'Ticket:', r.slice(0, 60));\n    arkAddSys(arkLang === 'ar'\n      ? `✓ تم رفع التذكرة: ${fields.subject}`\n      : `✓ Ticket submitted: ${fields.subject}`);\n    arkAddMsg('bot', arkLang === 'ar'\n      ? `تم إنشاء تذكرة الدعم. بناءً على أولوية ${sla.p}، سيتواصل معك فريق أركان خلال ${sla.resp} (${sla.covAr})، والحل المستهدف خلال ${sla.res}.`\n      : `Ticket created. Based on ${sla.p} — ${sla.lbl} priority, the Arkan Solutions team will respond within ${sla.resp} (${sla.cov} coverage) and resolve within ${sla.res}.`);\n    if (!arkRated) setTimeout(() => arkShowRating(), 1200);\n  } catch (e) {\n    arkAddSys(arkLang === 'ar'\n      ? 'تذكرة معلقة — ستُرفع فور استعادة الاتصال.'\n      : 'Ticket queued — will submit when connection is restored.');\n  }\n}\nfunction arkOpenEsc(){arkDoEscalate(false)}\nfunction arkDoEscalate(auto){\n  const old=document.getElementById('ark-escf');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const isAr=arkLang==='ar';\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-escf';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');card.style.width='100%';\n  card.innerHTML=`<h4 style=\"color:#2E5F8A\">${isAr?'التحويل إلى متخصص بشري':'Escalate to Human Specialist'}</h4>\n    <p style=\"font-size:12px;color:#666;margin-bottom:8px\">${isAr?'سيتواصل معك متخصص أركان. يرجى تأكيد بياناتك:':'An Arkan specialist will contact you. Please confirm your details:'}</p>\n    <label>${isAr?'الاسم':'Name'}</label><input type=\"text\" id=\"ark-en\" value=\"${arkCtct?.name||arkPcData.name||''}\" />\n    <label>${isAr?'البريد':'Email'}</label><input type=\"email\" id=\"ark-ee\" value=\"${arkCtct?.email||''}\" />\n    <label>${isAr?'الهاتف (اختياري)':'Phone (optional)'}</label><input type=\"tel\" id=\"ark-ep\" placeholder=\"+966XXXXXXXXX\" />\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitEsc()\">${isAr?'طلب التحويل':'Request Handoff'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-escf').remove()\">${isAr?'إلغاء':'Cancel'}</button>`;\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n  if(!auto)arkAddMsg('bot',isAr?'بالتأكيد. يرجى تعبئة بياناتك وسيتواصل معك أحد متخصصينا.':'Of course. Please fill in the form and a specialist will reach out shortly.');\n}\nasync function arkSubmitEsc() {\n  const n = document.getElementById('ark-en').value.trim();\n  const e = document.getElementById('ark-ee').value.trim();\n  const p = document.getElementById('ark-ep').value.trim();\n  if (!n || !e) {\n    alert(arkLang === 'ar' ? 'يرجى إدخال الاسم والبريد.' : 'Enter name and email.');\n    return;\n  }\n  document.getElementById('ark-escf').remove();\n  arkSetCrm(arkLang === 'ar' ? 'تحويل:' : 'Handoff:', arkLang === 'ar' ? 'جاري...' : 'Processing...');\n\n  // CRITICAL FIX: Decide which intent based on inquiry type from the pre-chat survey.\n  // Sales/commercial → sales_handoff (Deal + Tasks, NO ticket)\n  // Tech/support     → support_handoff (Tasks + Note, NO ticket either — only\n  //                    tech_ticket creates tickets, and that's only via the\n  //                    explicit \"+Ticket\" button)\n  // General/unknown  → support_handoff (routes to sales triage as fallback)\n\n  const inq = (arkPcData.inquiry || '').toLowerCase();\n  const ctx = arkMsgs.slice(-6).map(m => m.role + ': ' + m.content).join('\\n');\n\n  // Build summary from chat context for the CRM record\n  const summary = `Inquiry type: ${arkPcData.inquiry || 'unknown'}\\nVisitor requested handoff to a human agent.\\n\\nRecent chat:\\n${ctx}`;\n\n  // Determine intent\n  const isSales = inq === 'sales' || inq.includes('commercial') || inq.includes('pricing');\n\n  const intent = isSales ? 'sales_handoff' : 'support_handoff';\n  const fields = {\n    name: n,\n    email: e,\n    phone: p,\n    company: arkCtct?.company || arkPcData.company || '',\n    platform: arkPcData.platform || '',\n    inquiry: arkPcData.inquiry || 'general',\n    preferredTime: arkPcData.preferredTime || '',\n    summary,\n  };\n\n  try {\n    const r = await arkCrmCall(intent, fields);\n    arkSetCrm(arkLang === 'ar' ? 'تحويل:' : 'Handoff:', r.slice(0, 50));\n    arkAddSys(\n      arkLang === 'ar'\n        ? `✓ تم توجيه طلبك — سيتواصل معك متخصص أركان على ${e}`\n        : `✓ Handoff submitted — Arkan specialist will contact you at ${e}`\n    );\n    arkAddMsg('bot',\n      arkLang === 'ar'\n        ? `شكراً ${n}. تم إرسال طلبك إلى فريق أركان سوليوشنز وسيتواصلون معك على ${e} خلال 1-2 يوم عمل.`\n        : `Thank you, ${n}. Your request has been routed to Arkan Solutions and a specialist will contact you at ${e} within 1–2 business days (Sun–Thu, KSA).`\n    );\n    if (!arkRated) setTimeout(() => arkShowRating(), 1200);\n  } catch (err) {\n    arkSetCrm('Handoff:', 'Queued');\n  }\n}\nfunction arkShowRating(){\n  if(arkRated)return;\n  const old=document.getElementById('ark-rating');if(old)old.remove();\n  const area=document.getElementById('ark-ma');\n  const isAr=arkLang==='ar';\n  const wrap=document.createElement('div');wrap.className='ark-mr sys';wrap.id='ark-rating';\n  const card=document.createElement('div');card.className='ark-card'+(isAr?' rtl-c':'');\n  card.style.cssText='width:100%;text-align:center';\n  card.innerHTML=`<h4>${isAr?'كيف كانت تجربتك؟':'How was your experience?'}</h4>\n    <p style=\"font-size:12px;color:#666;margin:5px 0 9px\">${isAr?'يرجى تقييم جودة خدمة اليوم:':'Please rate today\\'s service quality:'}</p>\n    <div class=\"ark-stars\" id=\"ark-stars\">\n      ${[1,2,3,4,5].map(i=>`<span class=\"ark-star\" onclick=\"arkSetStar(${i})\" onmouseover=\"arkHoverStar(${i})\" onmouseout=\"arkResetStars()\" data-v=\"${i}\">&#9733;</span>`).join('')}\n    </div>\n    <div id=\"ark-star-lbl\" style=\"font-size:12px;color:#999;height:16px;margin-bottom:6px\"></div>\n    <textarea id=\"ark-r-comment\" style=\"width:100%;border:1px solid #ddd;border-radius:6px;padding:6px 9px;font-size:12px;font-family:Arial,sans-serif;resize:none;height:42px;outline:none;color:#1A1A2E\" placeholder=\"${isAr?'تعليق اختياري...':'Optional comment...'}\"></textarea>\n    <button class=\"ark-btn-p\" onclick=\"arkSubmitRating()\">${isAr?'إرسال التقييم':'Submit rating'}</button>\n    <button class=\"ark-btn-s\" onclick=\"document.getElementById('ark-rating').remove()\">${isAr?'تخطي':'Skip'}</button>`;\n  wrap.appendChild(card);area.appendChild(wrap);area.scrollTop=area.scrollHeight;\n}\nconst ARK_LABELS=['','Poor','Fair','Good','Very good','Excellent'];\nconst ARK_LABELS_AR=['','ضعيف','مقبول','جيد','جيد جداً','ممتاز'];\nfunction arkHoverStar(n){document.querySelectorAll('.ark-star').forEach((s,i)=>s.classList.toggle('on',i<n));const el=document.getElementById('ark-star-lbl');if(el)el.textContent=arkLang==='ar'?ARK_LABELS_AR[n]:ARK_LABELS[n]}\nfunction arkResetStars(){document.querySelectorAll('.ark-star').forEach((s,i)=>s.classList.toggle('on',i<arkStarVal));const el=document.getElementById('ark-star-lbl');if(el)el.textContent=arkStarVal?(arkLang==='ar'?ARK_LABELS_AR[arkStarVal]:ARK_LABELS[arkStarVal]):''}\nfunction arkSetStar(n){arkStarVal=n;arkResetStars()}\nasync function arkSubmitRating(){\n  if(!arkStarVal){alert(arkLang==='ar'?'يرجى اختيار تقييم.':'Please select a rating.');return}\n  const comment=document.getElementById('ark-r-comment')?.value.trim()||'';\n  document.getElementById('ark-rating').remove();\n  arkRated=true;\n  const lbl=arkLang==='ar'?ARK_LABELS_AR[arkStarVal]:ARK_LABELS[arkStarVal];\n  arkAddSys(arkLang==='ar'?`✓ شكراً على تقييمك: ${lbl} (${arkStarVal}/5)`:`✓ Thank you for your rating: ${lbl} (${arkStarVal}/5)`);\n  arkAddMsg('bot',arkLang==='ar'?'شكراً جزيلاً على تقييمك! ملاحظاتكم تساعدنا على الارتقاء بمستوى خدماتنا. يسعدنا دائماً خدمتك.':'Thank you for your feedback! Your rating helps us continuously improve. It has been a pleasure assisting you at Arkan Solutions.');\n  if(arkCtct?.email&&(arkStarVal||comment)){\n    arkHSCall(`Add note to HubSpot contact ${arkCtct.email}: \"Chat rating: ${arkStarVal}/5 — ${lbl}. Comment: ${comment||'None'}. Platform: ${arkPcData.platform||'N/A'}. Date: ${new Date().toISOString().split('T')[0]}\"`).catch(()=>{});\n  }\n}\n\nfunction arkSQ(t){document.getElementById('ark-ui').value='';arkSendMsg(t)}\nfunction arkHS(){const i=document.getElementById('ark-ui');const t=i.value.trim();if(!t||arkBusy)return;i.value='';i.style.height='auto';arkSendMsg(t)}\nfunction arkHK(e){if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();arkHS()}}\nfunction arkAR(el){el.style.height='auto';el.style.height=Math.min(el.scrollHeight,80)+'px'}\n\n// Show unread badge after 8s if panel not yet opened\nsetTimeout(()=>{if(!arkOpen){document.getElementById('ark-badge').style.display='flex'}},8000);"}]}]}