// ================= Constants/config =================
    const ROLES = {
      PATIENT: "patient",
      ADMIN: "admin"
    };

    const ROUTES = {
      HOME: "home",
      WINS: "wins",
      MOMENTUM: "momentum",
      SUBMIT: "submit",
      CHECKIN: "checkin",
      PROGRESS: "progress",
      MEALS: "meals",
      MEAL_SNAPSHOT: "mealSnapshot",
      SUPPORT: "support",
      LOGIN: "login",
      ADMIN: "admin"
    };

    const PATIENT_ROUTES = [ROUTES.HOME, ROUTES.WINS, ROUTES.MOMENTUM, ROUTES.SUBMIT, ROUTES.CHECKIN, ROUTES.PROGRESS, ROUTES.MEALS, ROUTES.MEAL_SNAPSHOT, ROUTES.SUPPORT];
    const ADMIN_ROUTES = [ROUTES.ADMIN];

    const POINT_RULES = {
      weekly_check_in: { points: 25, onceWeekly: true, label: "Complete weekly check-in", limitLabel: "Once per week" },
      progress_update: { points: 10, onceWeekly: true, label: "Log a progress update", limitLabel: "Once per week" },
      private_win: { points: 15, onceWeekly: true, label: "Log a private win", limitLabel: "Once per week" },
      shared_win: { points: 20, onceWeekly: true, label: "Share a win", limitLabel: "Once per week" },
      celebrate_win: { points: 3, weeklyCap: 15, label: "Celebrate another win", limitLabel: "Up to +15 per week" },
      save_tip: { points: 5, weeklyCap: 10, label: "Save a helpful tip", limitLabel: "Up to +10 per week" },
      streak_bonus_4_week: { points: 50, label: "4-week consistency bonus" },
      streak_bonus_8_week: { points: 100, label: "8-week consistency bonus" }
    };

    const REWARD_TIERS = {
      SMALL_PERK: "small_perk",
      LEANER_CREDIT: "leaner_credit",
      BIGGER_PERK: "bigger_perk",
      MAJOR_MOMENTUM_REWARD: "major_momentum_reward",
      FEATURED_PERK: "featured_perk"
    };

    const REWARD_STATUSES = {
      AVAILABLE: "available",
      REQUESTED: "requested",
      REDEEMED: "redeemed",
      LOCKED: "locked"
    };

    const REWARD_STATUS_LABELS = {
      [REWARD_STATUSES.AVAILABLE]: "Available",
      [REWARD_STATUSES.REQUESTED]: "Requested",
      [REWARD_STATUSES.REDEEMED]: "Redeemed",
      [REWARD_STATUSES.LOCKED]: "Locked"
    };

    const CSV_HEADERS = ["id", "type", "title", "shortDescription", "fullContent", "icon", "tags", "status"];

    const SUPPORT_TYPES = {
      MEAL_IDEA: "meal_idea",
      COACH_TIP: "coach_tip",
      CLINIC_SUPPORT: "clinic_support"
    };

    const SUPPORT_TYPE_LIST = [SUPPORT_TYPES.MEAL_IDEA, SUPPORT_TYPES.COACH_TIP, SUPPORT_TYPES.CLINIC_SUPPORT];

    const CONTENT_STATUSES = {
      DRAFT: "draft",
      APPROVED: "approved",
      USED: "used",
      ARCHIVED: "archived"
    };

    const SUPPORT_IMPORT_STATUSES = [CONTENT_STATUSES.DRAFT, CONTENT_STATUSES.APPROVED, CONTENT_STATUSES.ARCHIVED];

    const DATA_MODES = {
      LOCAL: "local",
      FIREBASE: "firebase"
    };

    const AUTH_SESSION_KEY = "leanerAuthSession";

    const APP_CONFIG = {
      // Phase 1B Firebase fake-user test mode is active.
      // Roll back to the static demo with DATA_MODES.LOCAL and authRequired: false.
      dataMode: DATA_MODES.FIREBASE,
      authRequired: true,
      features: {
        mealSnapshotBeta: {
          enabled: false,
          environment: "dev",
          endpoint: "",
          allowConfirmedSave: false,
          allowedRoles: [ROLES.PATIENT]
        }
      },
      firebase: {
        apiKey: "AIzaSyAkHlTdtRwWfxyaIVclye1spK6Xeia-m4Y",
        projectId: "leaner-v7",
        authDomain: "leaner-v7.firebaseapp.com",
        storageBucket: "leaner-v7.firebasestorage.app",
        messagingSenderId: "722197176361",
        appId: "1:722197176361:web:6d1b7abb7c13cab35e3c38",
        measurementId: "G-FTNCRJYJD7"
      }
    };
