/* NutriDMS, i18n + Theme helpers */
const { createContext: createCtx_i, useContext: useCtx_i, useState: useState_i, useEffect: useEffect_i } = React;

/* ─── Translations ─── */
const TRANSLATIONS = {
  en: {
    "nav.platform": "Platform", "nav.workflows": "Workflows", "nav.ai": "Loraa.ai",
    "nav.compliance": "Compliance", "nav.modules": "Modules", "nav.pricing": "Pricing",
    "nav.signIn": "Sign in", "nav.bookDemo": "Book Demo",
    "common.startTrial": "Start Free Trial", "common.bookDemo": "Book Enterprise Demo",
    "common.talkToSales": "Talk to Sales", "common.learnMore": "Learn more",
    "common.continue": "Continue", "common.back": "Back",
    "tag.line": "SMART NUTRITION MANAGEMENT",

    "hero.eyebrow": "One platform for food operations",
    "hero.title": "Everything your food business needs.",
    "hero.subtitle": "Recipes, nutrition analysis, food labeling, product specifications, compliance, and enterprise workflows in one platform.",
    "hero.trust.label": "Trusted by enterprise food & nutrition teams",
    "hero.trust.g2": "4.9 / 5 G2", "hero.trust.leader": "Leader · Mid-Market",
    "hero.dash.title": "Nutrition Operations", "hero.dash.sub": "All workspaces · live",
    "hero.dash.live": "Operational",
    "hero.dash.active": "Active Recipes", "hero.dash.pending": "Pending QA",
    "hero.dash.audit": "Audit Events",
    "hero.ai.title": "Loraa", "hero.ai.role": "Validation · Recipe #4129",
    "hero.ai.msg": "Hi Sarah, I detected inconsistent sodium values between ingredients and the nutrition panel. Want me to recalculate?",
    "hero.ai.sg1": "Apply nutrition recalculation", "hero.ai.sg2": "Add \"Low Sodium\" health tag",
    "hero.score.label": "Compliance Score", "hero.score.delta": "+2.1 this week",
    "hero.audit.title": "Audit Log",
    "hero.audit.1": "Recipe approved", "hero.audit.1m": "#4129 by E. Hayes",
    "hero.audit.2": "Validation flagged", "hero.audit.2m": "allergen mismatch",
    "hero.audit.3": "Role updated", "hero.audit.3m": "QA Reviewer added",

    "trust.eyebrow": "Built for the Enterprise",
    "trust.title": "Built for Modern Food & Nutrition Operations.",
    "trust.subtitle": "NutriDMS helps organizations standardize nutrition workflows, automate validation, improve compliance visibility, and manage food data at scale.",
    "trust.ind.manufacturers": "Food Manufacturers", "trust.ind.restaurants": "Restaurants",
    "trust.ind.healthcare": "Healthcare", "trust.ind.mealprep": "Meal Prep Companies",
    "trust.ind.nutrition": "Nutrition Teams", "trust.ind.kitchens": "Enterprise Kitchens",
    "trust.ind.compliance": "Compliance Teams", "trust.ind.wellness": "Wellness Platforms",

    "platform.eyebrow": "Platform Overview",
    "platform.title": "Everything Your Nutrition Team Needs.",
    "platform.subtitle": "A complete operating system for nutrition, compliance, and recipe lifecycle, engineered for the demands of regulated, multi-team organizations.",
    "platform.f1.t": "Recipe Management", "platform.f1.d": "Create, edit, review, approve, and publish recipes with structured workflows.",
    "platform.f2.t": "Ingredient Intelligence", "platform.f2.d": "Centralized ingredient mapping with nutrition logic and validation support.",
    "platform.f3.t": "Allergen Management", "platform.f3.d": "Track allergens across recipes, ingredients, and workflow reviews.",
    "platform.f4.t": "Loraa.ai QA Review", "platform.f4.d": "Loraa detects missing fields, invalid nutrition logic, conflicting health tags, and recipe risks.",
    "platform.f5.t": "Workflow Automation", "platform.f5.d": "Automate compliance gaps, approval routing, validation reviews, and recipe publishing.",
    "platform.f6.t": "Audit Logs", "platform.f6.d": "Track changes, approvals, user activity, validation history, and compliance actions.",
    "platform.f7.t": "User & Role Management", "platform.f7.d": "Granular enterprise permissions for managers, compliance, QA, dietitians, and admins.",
    "platform.f8.t": "Media Management", "platform.f8.d": "Manage recipe images, nutrition visuals, and media contributor workflows.",

    "wf.eyebrow": "Workflow Engine",
    "wf.title": "Structured Enterprise Workflow Engine.",
    "wf.subtitle": "A composable workflow engine designed for nutrition lifecycles, from draft to publish, with auditability and approval enforcement built-in.",
    "wf.step": "Step",
    "wf.s1.t": "Draft Creation", "wf.s1.d": "Recipes created by contributors with guided forms and templates.", "wf.s1.m": "Avg. 4 min to draft",
    "wf.s2.t": "Validation Review", "wf.s2.d": "Loraa.ai + rules engine checks nutrition data, allergens, and health tags.", "wf.s2.m": "Auto-validated",
    "wf.s3.t": "QA Approval", "wf.s3.d": "Compliance and nutrition reviewers approve, request changes, or escalate.", "wf.s3.m": "SLA: 24h",
    "wf.s4.t": "Audit Logging", "wf.s4.d": "Every change tracked automatically with tamper-evident history.", "wf.s4.m": "Immutable trail",
    "wf.s5.t": "Publishing", "wf.s5.d": "Approved recipes go live across channels with rollback support.", "wf.s5.m": "1-click deploy",

    "ai.title": "Meet Loraa.ai, your calm co-pilot for nutrition.",
    "ai.subtitle": "Your always-on nutrition reviewer. Loraa flags issues, suggests fixes, and speeds up approvals, right inside every workflow.",
    "ai.eyebrow": "Powered by Loraa.ai",
    "ai.see": "See Loraa in action", "ai.docs": "Read the Loraa.ai docs",
    "ai.f1.t": "AI Validation", "ai.f1.d": "Catches nutrition and compliance issues automatically.",
    "ai.f2.t": "AI Recommendations", "ai.f2.d": "Plain-language fixes for conflicts and missing data.",
    "ai.f3.t": "Smart Review Assistance", "ai.f3.d": "Summaries, risk scores, and one-tap review actions.",
    "ai.f4.t": "AI Operational Insights", "ai.f4.d": "Highlights workflow bottlenecks, validation risks, and team performance signals.",
    "ai.mock.title": "Review Mode", "ai.mock.live": "Live",
    "ai.find1.t": "Allergen mismatch", "ai.find1.d": "Recipe contains tahini but the allergen panel does not declare sesame. Add allergen to publish.",
    "ai.find2.t": "Sodium value drift", "ai.find2.d": "Calculated sodium (842mg) differs from declared (640mg) by 31.6%. Recalculate or override with reviewer note.",
    "ai.find3.t": "Health tags validated", "ai.find3.d": "\"High Protein\" and \"Heart Friendly\" pass all rule conditions for this recipe.",
    "ai.apply": "Apply fixes", "ai.open": "Open recipe", "ai.dismiss": "Dismiss",

    "comp.eyebrow": "Compliance & Validation",
    "comp.title": "Built for Accuracy & Accountability.",
    "comp.subtitle": "Stop racing through spreadsheets and PDFs at audit time. Codify your nutrition policies into validators that run continuously across every recipe.",
    "comp.f1.t": "Validation Rules Engine", "comp.f1.d": "Create structured nutrition and compliance rules with conditional logic.",
    "comp.f2.t": "Health Rule Validation", "comp.f2.d": "Low Sodium, Diabetic Safe, Heart Friendly, CKD Friendly, Gluten Free, High Protein, Weight Loss.",
    "comp.f3.t": "Allergen Validation", "comp.f3.d": "Prevent allergen conflicts before publishing, flagged inline with reviewer context.",
    "comp.f4.t": "Approval Enforcement", "comp.f4.d": "Recipes cannot publish without required approvals from designated roles.",
    "comp.f5.t": "Audit Trails", "comp.f5.d": "Complete enterprise activity history, tamper evident and exportable.",
    "comp.f6.t": "Policy Versioning", "comp.f6.d": "Maintain historical policies and prove which rules applied to which recipe.",
    "comp.mock.title": "Health Rule Validation", "comp.mock.sub": "Recipe #4129 · 7 of 7 rules", "comp.mock.passed": "Passed",

    "roles.eyebrow": "Role & Team Management",
    "roles.title": "Designed for Enterprise Teams.",
    "roles.subtitle": "Granular access control by department and role. Internal collaboration with full review visibility. System wide enterprise configuration.",
    "roles.r1.t": "Enterprise Admin", "roles.r1.d": "System wide configuration, integrations, and organizational governance.",
    "roles.r2.t": "Compliance & QA", "roles.r2.d": "Validate recipes, enforce policies, and clear publishing approvals.",
    "roles.r3.t": "Dietitians", "roles.r3.d": "Nutrition logic, health tag rules, and dietary metadata across the catalog.",
    "roles.r4.t": "Recipe Contributors", "roles.r4.d": "Draft, edit, and submit recipes through guided structured workflows.",
    "roles.r5.t": "Media Contributors", "roles.r5.d": "Upload, manage, and route recipe imagery through brand safe approval flows.",
    "roles.r6.t": "Managers", "roles.r6.d": "Team level dashboards, workload routing, and SLA visibility across queues.",
    "roles.r7.t": "Auditors", "roles.r7.d": "Read only access to audit trails, change history, and compliance reports.",
    "roles.r8.t": "Partner / External", "roles.r8.d": "Scoped collaborator access for agencies and external nutrition consultants.",

    "mods.eyebrow": "Platform Modules",
    "mods.title": "Modular Enterprise Architecture.",
    "mods.subtitle": "Twelve composable modules. Deploy the platform end to end, or adopt module by module on your timeline.",

    "price.eyebrow": "Pricing",
    "price.title": "Plans That Scale With Your Operation.",
    "price.subtitle": "Start with what you need today. Expand modules, users, and governance as your operation grows.",
    "price.monthly": "Monthly", "price.yearly": "Yearly", "price.save": "Save 20%",
    "price.recommended": "Recommended",
    "price.t1.tier": "Starter", "price.t1.for": "For small operational teams.",
    "price.t2.tier": "Professional", "price.t2.for": "For growing organizations.",
    "price.t3.tier": "Enterprise", "price.t3.for": "For enterprise operations.", "price.t3.price": "Custom",
    "price.foot": "Every plan ships with enterprise ready architecture, encrypted data, and 99.9% uptime.",
    "price.foot.link": "Need something custom?",
    "price.per": "/mo", "price.peryear": "/mo · billed yearly", "price.billed": "Billed as",

    "final.eyebrow": "Get Started",
    "final.title": "Modernize Your Nutrition Operations.",
    "final.subtitle": "Centralize nutrition workflows, improve operational visibility, automate validation, and scale enterprise food operations with NutriDMS.",

    "foot.product": "Product", "foot.enterprise": "Enterprise", "foot.support": "Support",
    "foot.resources": "Resources", "foot.company": "Company",
    "foot.blurb": "The modern operating system for nutrition operations, food compliance, recipe governance, and AI-assisted nutrition management. Built by SoftLab Digital.",
    "foot.powered": "Powered by", "foot.powered.tail": "nutrition intelligence",
    "foot.copyright": "© 2026 SoftLab Digital · NutriDMS. All rights reserved.",
  },

  fr: {
    "nav.platform": "Plateforme", "nav.workflows": "Flux de travail", "nav.ai": "Loraa.ai",
    "nav.compliance": "Conformité", "nav.modules": "Modules", "nav.pricing": "Tarifs",
    "nav.signIn": "Connexion", "nav.bookDemo": "Réserver une démo",
    "common.startTrial": "Essai gratuit", "common.bookDemo": "Réserver une démo entreprise",
    "common.talkToSales": "Contacter les ventes", "common.learnMore": "En savoir plus",
    "common.continue": "Continuer", "common.back": "Retour",
    "tag.line": "GESTION INTELLIGENTE DE LA NUTRITION",

    "hero.eyebrow": "Une plateforme pour vos opérations alimentaires",
    "hero.title": "Tout ce dont votre entreprise alimentaire a besoin.",
    "hero.subtitle": "Recettes, analyse nutritionnelle, étiquetage, spécifications produits, conformité et flux de travail d'entreprise sur une seule plateforme.",
    "hero.subtitle": "Gérez recettes, allergènes, flux de travail nutritionnels, validations de conformité, journaux d'audit, revues IA et opérations alimentaires depuis une plateforme centralisée.",
    "hero.trust.label": "La confiance des équipes nutrition d'entreprise",
    "hero.trust.g2": "4,9 / 5 G2", "hero.trust.leader": "Leader · Mid-Market",
    "hero.dash.title": "Opérations Nutrition", "hero.dash.sub": "Tous les espaces · en direct",
    "hero.dash.live": "Opérationnel",
    "hero.dash.active": "Recettes actives", "hero.dash.pending": "Q&A en attente",
    "hero.dash.audit": "Événements d'audit",
    "hero.ai.title": "Loraa", "hero.ai.role": "Validation · Recette #4129",
    "hero.ai.msg": "Bonjour Sarah, j'ai détecté des valeurs de sodium incohérentes entre les ingrédients et le panneau nutritionnel. Voulez-vous que je recalcule ?",
    "hero.ai.sg1": "Appliquer le recalcul nutritionnel", "hero.ai.sg2": "Ajouter l'étiquette « Faible en sodium »",
    "hero.score.label": "Score de conformité", "hero.score.delta": "+2,1 cette semaine",
    "hero.audit.title": "Journal d'audit",
    "hero.audit.1": "Recette approuvée", "hero.audit.1m": "#4129 par E. Hayes",
    "hero.audit.2": "Validation signalée", "hero.audit.2m": "incohérence d'allergène",
    "hero.audit.3": "Rôle mis à jour", "hero.audit.3m": "Réviseur QA ajouté",

    "trust.eyebrow": "Conçu pour l'entreprise",
    "trust.title": "Conçu pour les opérations alimentaires et nutritionnelles modernes.",
    "trust.subtitle": "NutriDMS aide les organisations à standardiser les flux nutritionnels, automatiser la validation, améliorer la visibilité de la conformité et gérer les données alimentaires à grande échelle.",
    "trust.ind.manufacturers": "Industriels alimentaires", "trust.ind.restaurants": "Restaurants",
    "trust.ind.healthcare": "Santé", "trust.ind.mealprep": "Préparation de repas",
    "trust.ind.nutrition": "Équipes nutrition", "trust.ind.kitchens": "Cuisines d'entreprise",
    "trust.ind.compliance": "Équipes conformité", "trust.ind.wellness": "Plateformes bien-être",

    "platform.eyebrow": "Aperçu de la plateforme",
    "platform.title": "Tout ce dont votre équipe nutrition a besoin.",
    "platform.subtitle": "Un système d'exploitation complet pour la nutrition, la conformité et le cycle de vie des recettes, conçu pour les organisations multi-équipes régulées.",
    "platform.f1.t": "Gestion des recettes", "platform.f1.d": "Créez, modifiez, révisez, approuvez et publiez des recettes avec des flux structurés.",
    "platform.f2.t": "Intelligence des ingrédients", "platform.f2.d": "Cartographie centralisée avec logique nutritionnelle et support de validation.",
    "platform.f3.t": "Gestion des allergènes", "platform.f3.d": "Suivez les allergènes à travers recettes, ingrédients et revues.",
    "platform.f4.t": "Revue QA Loraa.ai", "platform.f4.d": "Loraa détecte champs manquants, logique nutritionnelle invalide, conflits d'étiquettes et risques.",
    "platform.f5.t": "Automatisation des flux", "platform.f5.d": "Automatisez routage d'approbation, revues de validation et publication des recettes.",
    "platform.f6.t": "Journaux d'audit", "platform.f6.d": "Suivez modifications, approbations, activité utilisateurs et historique de conformité.",
    "platform.f7.t": "Gestion des utilisateurs et rôles", "platform.f7.d": "Permissions granulaires pour managers, conformité, QA, diététiciens et administrateurs.",
    "platform.f8.t": "Gestion des médias", "platform.f8.d": "Gérez images de recettes, visuels nutritionnels et flux des contributeurs médias.",

    "wf.eyebrow": "Moteur de flux", "wf.step": "Étape",
    "wf.title": "Moteur de flux d'entreprise structuré.",
    "wf.subtitle": "Un moteur de flux composable pour les cycles de vie nutritionnels, du brouillon à la publication, avec auditabilité et approbation intégrées.",
    "wf.s1.t": "Création du brouillon", "wf.s1.d": "Recettes créées par les contributeurs avec formulaires et modèles guidés.", "wf.s1.m": "Moy. 4 min",
    "wf.s2.t": "Revue de validation", "wf.s2.d": "Loraa.ai + moteur de règles vérifient données nutritionnelles, allergènes et étiquettes.", "wf.s2.m": "Auto-validé",
    "wf.s3.t": "Approbation QA", "wf.s3.d": "Conformité et nutritionnistes approuvent, demandent des modifications ou escaladent.", "wf.s3.m": "SLA : 24h",
    "wf.s4.t": "Journalisation d'audit", "wf.s4.d": "Chaque modification suivie automatiquement avec historique infalsifiable.", "wf.s4.m": "Trace immuable",
    "wf.s5.t": "Publication", "wf.s5.d": "Recettes approuvées publiées sur tous les canaux avec retour arrière possible.", "wf.s5.m": "Déploiement en 1 clic",

    "ai.title": "Découvrez Loraa.ai, l'IA intégrée à vos opérations nutritionnelles.",
    "ai.subtitle": "Loraa n'est pas un chatbot annexe. C'est un validateur, recommandeur et réviseur de premier ordre qui vit dans chaque flux, signalant les problèmes, suggérant des corrections et accélérant les approbations.",
    "ai.eyebrow": "Propulsé par Loraa.ai",
    "ai.see": "Voir Loraa en action", "ai.docs": "Lire la documentation Loraa.ai",
    "ai.f1.t": "Validation IA", "ai.f1.d": "Loraa détecte automatiquement les problèmes nutritionnels et de conformité.",
    "ai.f2.t": "Recommandations IA", "ai.f2.d": "Suggère corrections, informations manquantes, conflits de règles et corrections de validation, en langage clair.",
    "ai.f3.t": "Assistance à la revue intelligente", "ai.f3.d": "Accélère la revue QA avec résumés, score de risque et actions en un clic.",
    "ai.f4.t": "Insights opérationnels IA", "ai.f4.d": "Met en évidence goulots d'étranglement, risques de validation et performance des équipes.",
    "ai.mock.title": "Mode revue", "ai.mock.live": "En direct",
    "ai.find1.t": "Incohérence d'allergène", "ai.find1.d": "La recette contient du tahini mais le panneau d'allergènes ne déclare pas le sésame. Ajoutez l'allergène pour publier.",
    "ai.find2.t": "Dérive de la valeur en sodium", "ai.find2.d": "Le sodium calculé (842mg) diffère de la valeur déclarée (640mg) de 31,6%. Recalculez ou substituez avec une note.",
    "ai.find3.t": "Étiquettes santé validées", "ai.find3.d": "« Riche en protéines » et « Bon pour le cœur » respectent toutes les règles.",
    "ai.apply": "Appliquer les corrections", "ai.open": "Ouvrir la recette", "ai.dismiss": "Ignorer",

    "comp.eyebrow": "Conformité & Validation",
    "comp.title": "Conçu pour la précision et la responsabilité.",
    "comp.subtitle": "Fini les tableurs et PDF à l'heure de l'audit. Codifiez vos politiques nutritionnelles en validateurs qui s'exécutent en continu sur chaque recette.",
    "comp.f1.t": "Moteur de règles de validation", "comp.f1.d": "Créez des règles nutritionnelles et de conformité structurées avec logique conditionnelle.",
    "comp.f2.t": "Validation des règles santé", "comp.f2.d": "Faible en sodium, Diabète, Cœur, Insuffisance rénale, Sans gluten, Riche en protéines, Perte de poids.",
    "comp.f3.t": "Validation des allergènes", "comp.f3.d": "Prévenez les conflits d'allergènes avant publication, signalés inline avec contexte.",
    "comp.f4.t": "Application d'approbation", "comp.f4.d": "Les recettes ne peuvent être publiées sans les approbations requises.",
    "comp.f5.t": "Pistes d'audit", "comp.f5.d": "Historique complet, infalsifiable et exportable.",
    "comp.f6.t": "Versionnage de politiques", "comp.f6.d": "Maintenez l'historique et prouvez quelles règles s'appliquaient à quelle recette.",
    "comp.mock.title": "Validation des règles santé", "comp.mock.sub": "Recette #4129 · 7 sur 7 règles", "comp.mock.passed": "Validé",

    "roles.eyebrow": "Gestion des rôles & équipes",
    "roles.title": "Conçu pour les équipes d'entreprise.",
    "roles.subtitle": "Contrôle d'accès granulaire par département et rôle. Collaboration interne avec visibilité complète. Configuration à l'échelle de l'entreprise.",
    "roles.r1.t": "Administrateur d'entreprise", "roles.r1.d": "Configuration système, intégrations et gouvernance organisationnelle.",
    "roles.r2.t": "Conformité & QA", "roles.r2.d": "Valident les recettes, appliquent les politiques et libèrent les publications.",
    "roles.r3.t": "Diététiciens", "roles.r3.d": "Logique nutritionnelle, règles d'étiquettes santé et métadonnées du catalogue.",
    "roles.r4.t": "Contributeurs recettes", "roles.r4.d": "Brouillonnent, modifient et soumettent les recettes via des flux guidés.",
    "roles.r5.t": "Contributeurs médias", "roles.r5.d": "Téléversent et routent l'imagerie via des flux d'approbation sécurisés.",
    "roles.r6.t": "Managers", "roles.r6.d": "Tableaux de bord d'équipe, routage de charge et visibilité SLA.",
    "roles.r7.t": "Auditeurs", "roles.r7.d": "Accès en lecture seule aux pistes d'audit, historiques et rapports.",
    "roles.r8.t": "Partenaire / Externe", "roles.r8.d": "Accès collaborateur cadré pour agences et consultants externes.",

    "mods.eyebrow": "Modules de la plateforme",
    "mods.title": "Architecture modulaire d'entreprise.",
    "mods.subtitle": "Douze modules composables. Déployez la plateforme de bout en bout, ou module par module à votre rythme.",

    "price.eyebrow": "Tarifs",
    "price.title": "Des plans qui évoluent avec votre opération.",
    "price.subtitle": "Commencez avec ce dont vous avez besoin. Étendez modules, utilisateurs et gouvernance au fur et à mesure.",
    "price.monthly": "Mensuel", "price.yearly": "Annuel", "price.save": "Économisez 20%",
    "price.recommended": "Recommandé",
    "price.t1.tier": "Starter", "price.t1.for": "Pour les petites équipes opérationnelles.",
    "price.t2.tier": "Professional", "price.t2.for": "Pour les organisations en croissance.",
    "price.t3.tier": "Enterprise", "price.t3.for": "Pour les opérations d'entreprise.", "price.t3.price": "Sur mesure",
    "price.foot": "Tous les plans bénéficient d'une architecture pensée pour l'entreprise, du chiffrement des données et de 99,9% de disponibilité.",
    "price.foot.link": "Besoin d'une solution sur mesure ?",
    "price.per": "/mois", "price.peryear": "/mois · facturé annuellement", "price.billed": "Facturé",

    "final.eyebrow": "Commencer",
    "final.title": "Modernisez vos opérations nutritionnelles.",
    "final.subtitle": "Centralisez les flux nutritionnels, améliorez la visibilité, automatisez la validation et faites évoluer vos opérations alimentaires avec NutriDMS.",

    "foot.product": "Produit", "foot.enterprise": "Entreprise", "foot.support": "Support",
    "foot.resources": "Ressources", "foot.company": "Société",
    "foot.blurb": "Le système d'exploitation moderne pour les opérations nutritionnelles, la conformité, la gouvernance des recettes et la gestion nutritionnelle assistée par IA. Conçu par SoftLab Digital.",
    "foot.powered": "Propulsé par", "foot.powered.tail": "intelligence nutritionnelle",
    "foot.copyright": "© 2026 SoftLab Digital · NutriDMS. Tous droits réservés.",
  },

  zh: {
    "nav.platform": "平台", "nav.workflows": "工作流", "nav.ai": "Loraa.ai",
    "nav.compliance": "合规", "nav.modules": "模块", "nav.pricing": "定价",
    "nav.signIn": "登录", "nav.bookDemo": "预约演示",
    "common.startTrial": "免费试用", "common.bookDemo": "预约企业演示",
    "common.talkToSales": "联系销售", "common.learnMore": "了解更多",
    "common.continue": "继续", "common.back": "返回",
    "tag.line": "智能营养管理",

    "hero.eyebrow": "食品运营的统一平台",
    "hero.title": "您的食品业务所需的一切。",
    "hero.subtitle": "在一个平台中管理食谱、营养分析、食品标签、产品规格、合规与企业工作流。",
    "hero.trust.label": "受企业食品与营养团队信赖",
    "hero.trust.g2": "4.9 / 5 G2", "hero.trust.leader": "领导者 · 中端市场",
    "hero.dash.title": "营养运营", "hero.dash.sub": "所有工作区 · 实时",
    "hero.dash.live": "运行中",
    "hero.dash.active": "活跃食谱", "hero.dash.pending": "待审核",
    "hero.dash.audit": "审计事件",
    "hero.ai.title": "Loraa", "hero.ai.role": "验证 · 食谱 #4129",
    "hero.ai.msg": "嗨 Sarah，我检测到食材与营养面板之间的钠值不一致。要我重新计算吗？",
    "hero.ai.sg1": "应用营养重算", "hero.ai.sg2": "添加「低钠」健康标签",
    "hero.score.label": "合规评分", "hero.score.delta": "本周 +2.1",
    "hero.audit.title": "审计日志",
    "hero.audit.1": "食谱已批准", "hero.audit.1m": "#4129 由 E. Hayes",
    "hero.audit.2": "验证标记", "hero.audit.2m": "过敏原不一致",
    "hero.audit.3": "角色更新", "hero.audit.3m": "新增 QA 审核员",

    "trust.eyebrow": "为企业而构建",
    "trust.title": "为现代食品与营养运营而构建。",
    "trust.subtitle": "NutriDMS 帮助组织标准化营养工作流、自动化验证、提升合规可见性,并大规模管理食品数据。",
    "trust.ind.manufacturers": "食品制造商", "trust.ind.restaurants": "餐厅",
    "trust.ind.healthcare": "医疗保健", "trust.ind.mealprep": "餐食配送公司",
    "trust.ind.nutrition": "营养团队", "trust.ind.kitchens": "企业厨房",
    "trust.ind.compliance": "合规团队", "trust.ind.wellness": "健康平台",

    "platform.eyebrow": "平台概览",
    "platform.title": "您的营养团队所需的一切。",
    "platform.subtitle": "一个完整的营养、合规和食谱生命周期操作系统, 为受监管的多团队组织而设计。",
    "platform.f1.t": "食谱管理", "platform.f1.d": "通过结构化工作流创建、编辑、审核、批准和发布食谱。",
    "platform.f2.t": "食材智能", "platform.f2.d": "集中式食材映射,具备营养逻辑和验证支持。",
    "platform.f3.t": "过敏原管理", "platform.f3.d": "在食谱、食材和工作流审核中追踪过敏原。",
    "platform.f4.t": "Loraa.ai QA 审核", "platform.f4.d": "Loraa 检测缺失字段、无效营养逻辑、冲突的健康标签和食谱风险。",
    "platform.f5.t": "工作流自动化", "platform.f5.d": "自动化合规缺口、审批路由、验证审核和食谱发布。",
    "platform.f6.t": "审计日志", "platform.f6.d": "追踪变更、批准、用户活动、验证历史和合规操作。",
    "platform.f7.t": "用户与角色管理", "platform.f7.d": "为经理、合规、QA、营养师和管理员提供细粒度的企业权限。",
    "platform.f8.t": "媒体管理", "platform.f8.d": "管理食谱图像、营养视觉和媒体贡献者工作流。",

    "wf.eyebrow": "工作流引擎", "wf.step": "步骤",
    "wf.title": "结构化的企业工作流引擎。",
    "wf.subtitle": "为营养生命周期设计的可组合工作流引擎, 从草稿到发布,内置可审计性和审批执行。",
    "wf.s1.t": "草稿创建", "wf.s1.d": "贡献者通过引导式表单和模板创建食谱。", "wf.s1.m": "平均 4 分钟",
    "wf.s2.t": "验证审核", "wf.s2.d": "Loraa.ai + 规则引擎检查营养数据、过敏原和健康标签。", "wf.s2.m": "自动验证",
    "wf.s3.t": "QA 批准", "wf.s3.d": "合规和营养审核员批准、请求修改或升级。", "wf.s3.m": "SLA:24 小时",
    "wf.s4.t": "审计日志", "wf.s4.d": "每个变更都自动追踪,具有防篡改历史。", "wf.s4.m": "不可变记录",
    "wf.s5.t": "发布", "wf.s5.d": "已批准的食谱跨渠道上线,支持回滚。", "wf.s5.m": "一键部署",

    "ai.title": "认识 Loraa.ai, 融入您营养运营的 AI。",
    "ai.subtitle": "Loraa 不是聊天插件。她是一流的验证器、推荐器和审核员,存在于每个工作流中, 标记问题、建议修复并加速整个食谱生命周期的审批。",
    "ai.eyebrow": "由 Loraa.ai 驱动",
    "ai.see": "查看 Loraa 实际运行", "ai.docs": "阅读 Loraa.ai 文档",
    "ai.f1.t": "AI 验证", "ai.f1.d": "Loraa 自动检测食谱和工作流中的营养与合规问题。",
    "ai.f2.t": "AI 推荐", "ai.f2.d": "以通俗语言建议修正、缺失信息、健康规则冲突和验证修复。",
    "ai.f3.t": "智能审核助手", "ai.f3.d": "通过摘要、风险评分和一键操作加速 QA 审核流程。",
    "ai.f4.t": "AI 运营洞察", "ai.f4.d": "突出显示工作流瓶颈、验证风险和团队绩效信号。",
    "ai.mock.title": "审核模式", "ai.mock.live": "实时",
    "ai.find1.t": "过敏原不一致", "ai.find1.d": "食谱含有芝麻酱,但过敏原面板未声明芝麻。添加过敏原以发布。",
    "ai.find2.t": "钠值偏差", "ai.find2.d": "计算的钠 (842mg) 与声明值 (640mg) 相差 31.6%。重算或通过审核员注释覆盖。",
    "ai.find3.t": "健康标签已验证", "ai.find3.d": "「高蛋白」和「护心」满足此食谱的所有规则条件。",
    "ai.apply": "应用修复", "ai.open": "打开食谱", "ai.dismiss": "忽略",

    "comp.eyebrow": "合规与验证",
    "comp.title": "为准确性与问责制而构建。",
    "comp.subtitle": "审计时不必再在电子表格和 PDF 中翻找。将您的营养政策编码为验证器,在每个食谱上持续运行。",
    "comp.f1.t": "验证规则引擎", "comp.f1.d": "创建带有条件逻辑的结构化营养与合规规则。",
    "comp.f2.t": "健康规则验证", "comp.f2.d": "低钠、糖尿病、护心、肾友好、无麸质、高蛋白、减重。",
    "comp.f3.t": "过敏原验证", "comp.f3.d": "在发布前防止过敏原冲突, 内联标记并附审核员上下文。",
    "comp.f4.t": "审批执行", "comp.f4.d": "未获指定角色必要批准的食谱无法发布。",
    "comp.f5.t": "审计轨迹", "comp.f5.d": "完整的企业活动历史, 防篡改且可导出。",
    "comp.f6.t": "政策版本", "comp.f6.d": "保留历史政策,证明哪些规则适用于哪个食谱。",
    "comp.mock.title": "健康规则验证", "comp.mock.sub": "食谱 #4129 · 7/7 条规则", "comp.mock.passed": "已通过",

    "roles.eyebrow": "角色与团队管理",
    "roles.title": "为企业团队而设计。",
    "roles.subtitle": "按部门和角色精细控制访问权限。内部协作具备完整审核可见性。系统级企业配置。",
    "roles.r1.t": "企业管理员", "roles.r1.d": "系统级配置、集成和组织治理。",
    "roles.r2.t": "合规与 QA", "roles.r2.d": "验证食谱、执行政策并清理发布审批。",
    "roles.r3.t": "营养师", "roles.r3.d": "营养逻辑、健康标签规则和目录中的膳食元数据。",
    "roles.r4.t": "食谱贡献者", "roles.r4.d": "通过结构化引导工作流起草、编辑和提交食谱。",
    "roles.r5.t": "媒体贡献者", "roles.r5.d": "通过品牌安全审批流上传、管理和路由食谱图像。",
    "roles.r6.t": "经理", "roles.r6.d": "团队级仪表板、工作负载路由和跨队列 SLA 可见性。",
    "roles.r7.t": "审计员", "roles.r7.d": "对审计轨迹、变更历史和合规报告的只读访问。",
    "roles.r8.t": "合作伙伴 / 外部", "roles.r8.d": "为代理商和外部营养顾问提供范围化的协作访问。",

    "mods.eyebrow": "平台模块",
    "mods.title": "模块化的企业架构。",
    "mods.subtitle": "十二个可组合模块。端到端部署平台,或按您的节奏逐模块采用。",

    "price.eyebrow": "定价",
    "price.title": "随您的运营规模而扩展的计划。",
    "price.subtitle": "从今天所需开始。随着运营增长扩展模块、用户和治理。",
    "price.monthly": "月付", "price.yearly": "年付", "price.save": "节省 20%",
    "price.recommended": "推荐",
    "price.t1.tier": "Starter", "price.t1.for": "适合小型运营团队。",
    "price.t2.tier": "Professional", "price.t2.for": "适合成长中的组织。",
    "price.t3.tier": "Enterprise", "price.t3.for": "适合企业级运营。", "price.t3.price": "定制",
    "price.foot": "所有计划均采用企业级架构、加密数据和 99.9% 正常运行时间。",
    "price.foot.link": "需要定制方案?",
    "price.per": "/月", "price.peryear": "/月 · 按年付费", "price.billed": "总计",

    "final.eyebrow": "开始使用",
    "final.title": "现代化您的营养运营。",
    "final.subtitle": "通过 NutriDMS 集中化营养工作流、提升运营可见性、自动化验证并扩展企业食品运营。",

    "foot.product": "产品", "foot.enterprise": "企业", "foot.support": "支持",
    "foot.resources": "资源", "foot.company": "公司",
    "foot.blurb": "用于营养运营、食品合规、食谱治理和 AI 辅助营养管理的现代操作系统。由 SoftLab Digital 打造。",
    "foot.powered": "由", "foot.powered.tail": "营养智能驱动",
    "foot.copyright": "© 2026 SoftLab Digital · NutriDMS 保留所有权利。",
  },
};

/* ─── Contexts ─── */
const LangCtx = createCtx_i({ lang: "en", setLang: () => {} });
const ThemeCtx = createCtx_i({ theme: "light", setTheme: () => {} });

function useT() {
  const { lang } = useCtx_i(LangCtx);
  return (key) => (TRANSLATIONS[lang] && TRANSLATIONS[lang][key]) || TRANSLATIONS.en[key] || key;
}
function useLang() { return useCtx_i(LangCtx); }
function useTheme() { return useCtx_i(ThemeCtx); }

/* ─── Provider ─── */
function I18nProvider({ children }) {
  const [lang, setLangState] = useState_i(() => localStorage.getItem("nutridms.lang") || "en");
  const [theme, setThemeState] = useState_i("light");
  const setLang = (l) => { setLangState(l); localStorage.setItem("nutridms.lang", l); document.documentElement.lang = l; };
  const setTheme = () => { setThemeState("light"); localStorage.setItem("nutridms.theme", "light"); document.documentElement.setAttribute("data-theme", "light"); document.body.setAttribute("data-theme", "light"); };
  useEffect_i(() => { document.documentElement.lang = lang; localStorage.setItem("nutridms.theme", "light"); document.documentElement.setAttribute("data-theme", "light"); document.body.setAttribute("data-theme", "light"); }, [lang, theme]);
  return (
    <LangCtx.Provider value={{ lang, setLang }}>
      <ThemeCtx.Provider value={{ theme, setTheme }}>
        {children}
      </ThemeCtx.Provider>
    </LangCtx.Provider>
  );
}

/* ─── Switcher components ─── */
function LangSwitch() {
  const { lang, setLang } = useLang();
  const [open, setOpen] = useState_i(false);
  const langs = [
    { c: "en", n: "English", f: "🇬🇧" },
    { c: "fr", n: "Français", f: "🇫🇷" },
    { c: "zh", n: "中文", f: "🇨🇳" },
  ];
  const current = langs.find(l => l.c === lang) || langs[0];
  useEffect_i(() => {
    const onClick = (e) => { if (!e.target.closest(".lang-switch")) setOpen(false); };
    document.addEventListener("click", onClick);
    return () => document.removeEventListener("click", onClick);
  }, []);
  return (
    <div className="lang-switch">
      <button className="lang-trig" onClick={() => setOpen(!open)} aria-label="Change language">
        <span className="flag" aria-hidden="true">{current.f}</span>
        <span className="lang-code">{current.c.toUpperCase()}</span>
        <Icon name="chevron-down" size={12} stroke={2.2}/>
      </button>
      {open && (
        <div className="lang-menu">
          {langs.map(l => (
            <button key={l.c} onClick={() => { setLang(l.c); setOpen(false); }} className={lang === l.c ? "on" : ""}>
              <span className="flag">{l.f}</span> {l.n}
              {lang === l.c && <Icon name="check" size={14} stroke={2.6} style={{marginLeft:"auto",color:"var(--brand-700)"}}/>}
            </button>
          ))}
        </div>
      )}
    </div>
  );
}

function ThemeToggle() {
  return null;
}

/* ─── Horizontal NutriDMS logo (theme-aware) ─── */
function NutriHoriz({ height = 36, forceTheme }) {
  const { theme } = useTheme();
  const dark = (forceTheme || theme) === "dark";
  const src = dark ? "/brand/nutridms-logo-light.svg" : "/brand/nutridms-logo-dark.svg";
  return <img src={src} alt="NutriDMS, Smart Nutrition Management" style={{ height: height + "px", width: "auto", display: "block", objectFit: "contain" }}/>;
}

Object.assign(window, { TRANSLATIONS, LangCtx, ThemeCtx, useT, useLang, useTheme, I18nProvider, LangSwitch, ThemeToggle, NutriHoriz });
