tannuiscoding commited on
Commit
5a264f5
·
1 Parent(s): 3e3037b

added app.py

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +19 -0
  2. .env.example +40 -0
  3. .gitignore +23 -0
  4. .tool-versions +1 -0
  5. DEPLOYMENT.md +169 -0
  6. Dockerfile +19 -0
  7. FUTURE_ENHANCEMENTS.md +555 -0
  8. README.md +399 -7
  9. SETUP.md +642 -0
  10. app.py +14 -0
  11. backend/__init__.py +90 -0
  12. backend/ml/__init__.py +3 -0
  13. backend/ml/ml_engine.py +381 -0
  14. backend/routes/__init__.py +4 -0
  15. backend/routes/assessments.py +131 -0
  16. backend/routes/auth.py +69 -0
  17. backend/routes/gratitude.py +75 -0
  18. backend/routes/profile.py +125 -0
  19. frontend/.tool-versions +1 -0
  20. frontend/index.html +15 -0
  21. frontend/package-lock.json +2097 -0
  22. frontend/package.json +21 -0
  23. frontend/public/favicon.svg +27 -0
  24. frontend/public/logo.svg +45 -0
  25. frontend/src/App.jsx +60 -0
  26. frontend/src/api/client.js +19 -0
  27. frontend/src/components/DeepBreathWidget.jsx +114 -0
  28. frontend/src/components/Layout.jsx +113 -0
  29. frontend/src/components/VideoBackground.jsx +15 -0
  30. frontend/src/context/AuthContext.jsx +41 -0
  31. frontend/src/context/ThemeContext.jsx +26 -0
  32. frontend/src/index.css +1717 -0
  33. frontend/src/main.jsx +13 -0
  34. frontend/src/pages/AssessPage.jsx +248 -0
  35. frontend/src/pages/AuthPage.jsx +110 -0
  36. frontend/src/pages/BoxBreathingPage.jsx +47 -0
  37. frontend/src/pages/BreathePage.jsx +211 -0
  38. frontend/src/pages/DashboardPage.jsx +317 -0
  39. frontend/src/pages/GratitudePage.jsx +249 -0
  40. frontend/src/pages/HistoryPage.jsx +121 -0
  41. frontend/src/pages/LandingPage.jsx +216 -0
  42. frontend/src/pages/ProfilePage.jsx +251 -0
  43. frontend/src/pages/TodoPage.jsx +180 -0
  44. frontend/src/utils.js +43 -0
  45. frontend/static/css/main.css +565 -0
  46. frontend/static/js/app.js +494 -0
  47. frontend/templates/index.html +349 -0
  48. frontend/vite.config.js +20 -0
  49. notebooks/fusion/fusion-nb (1).ipynb +0 -0
  50. notebooks/psychometric/psychometric notebook.ipynb +0 -0
.dockerignore ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.pyo
4
+ *.pyd
5
+ .Python
6
+ venv/
7
+ .venv/
8
+ env/
9
+ *.egg-info/
10
+ dist/
11
+ build/
12
+ *.db
13
+ *.sqlite3
14
+ *.log
15
+ instance/
16
+ node_modules/
17
+ frontend/node_modules/
18
+ .DS_Store
19
+ .env
.env.example ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ════════════════════════════════════════════════
2
+ # BREATHE — Sample Environment File
3
+ # Copy this file to .env and fill in your values.
4
+ # NEVER commit the real .env to version control.
5
+ # ════════════════════════════════════════════════
6
+
7
+ # ── Flask ────────────────────────────────────────
8
+ FLASK_APP=app.py
9
+ FLASK_DEBUG=true # set to false in production
10
+
11
+ # A long random string — generate with: python -c "import secrets; print(secrets.token_hex(32))"
12
+ SECRET_KEY=change-me-to-a-very-long-random-secret-key
13
+
14
+ # ── Database ─────────────────────────────────────
15
+ # SQLite (default, zero-config)
16
+ DATABASE_URL=sqlite:///breathe.db
17
+
18
+ # PostgreSQL (recommended for production)
19
+ # DATABASE_URL=postgresql://user:password@localhost:5432/breathe
20
+
21
+ # ── ML Model Paths ───────────────────────────────
22
+ # Directory containing the saved psychometric model artefacts:
23
+ # base_scaler.pkl, final_scaler.pkl, le_dict.pkl, le_target.pkl,
24
+ # selected_cols.pkl, poly.pkl, top_num.pkl,
25
+ # lightgbm_best_model.pkl (or another *_best_model.pkl)
26
+ PSYCHO_MODEL_DIR=models/psychometric
27
+
28
+ # Path to the RoBERTa .pt checkpoint file
29
+ ROBERTA_CKPT=models/text/roberta-model.pt
30
+
31
+ # ── Server ───────────────────────────────────────
32
+ HOST=0.0.0.0
33
+ PORT=5000
34
+
35
+ # ── CORS (comma-separated origins) ──────────────
36
+ # Leave as * for development, restrict in production
37
+ CORS_ORIGINS=*
38
+
39
+ # ── W&B (only needed if you re-train models) ─────
40
+ # WANDB_API_KEY=your_wandb_api_key_here
.gitignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Local environment secrets
2
+ .env
3
+ __pycache__/
4
+ *.pyc
5
+ *.pyo
6
+ *.pyd
7
+ .Python
8
+ venv/
9
+ .venv/
10
+ env/
11
+ *.egg-info/
12
+ dist/
13
+ build/
14
+ *.db
15
+ *.sqlite3
16
+ # Exclude large model weights from git (store separately or use Git LFS)
17
+ models/
18
+ *.pt
19
+ *.pkl
20
+ *.log
21
+ instance/
22
+ .DS_Store
23
+ node_modules/
.tool-versions ADDED
@@ -0,0 +1 @@
 
 
1
+ python 3.11.3
DEPLOYMENT.md ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deploying BREATHE — Completely Free
2
+
3
+ This guide deploys the app using:
4
+ | Layer | Service | Cost |
5
+ |---|---|---|
6
+ | Frontend (React/Vite) | **Vercel** | Free forever |
7
+ | Backend (Flask API) | **Render** | Free tier |
8
+ | Database | **Supabase** | Free tier (500MB) |
9
+
10
+ > **Note on ML models:** PyTorch and the transformer models require ~1–2 GB RAM. Render's free tier provides only 512 MB. The app will run without the ML features on the free tier — assessments and auth still work. To enable ML inference for free, see [Option B: Hugging Face Spaces](#option-b-ml-on-hugging-face-spaces-free) below.
11
+
12
+ ---
13
+
14
+ ## Prerequisites
15
+
16
+ - A [GitHub](https://github.com) account (push your project there first)
17
+ - Accounts on [Vercel](https://vercel.com), [Render](https://render.com), [Supabase](https://supabase.com) — all free to sign up
18
+
19
+ ---
20
+
21
+ ## Step 1 — Push to GitHub
22
+
23
+ ```bash
24
+ cd breathe-app
25
+ git init
26
+ git add .
27
+ git commit -m "Initial commit"
28
+ # Create a repo on github.com, then:
29
+ git remote add origin https://github.com/YOUR_USERNAME/breathe-app.git
30
+ git push -u origin main
31
+ ```
32
+
33
+ Make sure `.env` is in `.gitignore` (never commit secrets).
34
+
35
+ ---
36
+
37
+ ## Step 2 — Set up the Database on Supabase (free)
38
+
39
+ 1. Go to [supabase.com](https://supabase.com) → **New Project**
40
+ 2. Give it a name (e.g. `breathe`) and set a database password
41
+ 3. Once created, go to **Project Settings → Database**
42
+ 4. Copy the **Connection string (URI)** — it looks like:
43
+ ```
44
+ postgresql://postgres:[PASSWORD]@db.xxxx.supabase.co:5432/postgres
45
+ ```
46
+ 5. Save this — you'll need it in Steps 3 and 4.
47
+
48
+ ---
49
+
50
+ ## Step 3 — Deploy the Backend on Render (free)
51
+
52
+ 1. Go to [render.com](https://render.com) → **New → Web Service**
53
+ 2. Connect your GitHub repo
54
+ 3. Configure the service:
55
+ | Setting | Value |
56
+ |---|---|
57
+ | **Root Directory** | `breathe-app` |
58
+ | **Runtime** | Python 3 |
59
+ | **Build Command** | `pip install -r requirements.txt` |
60
+ | **Start Command** | `gunicorn app:app` |
61
+ | **Instance Type** | Free |
62
+
63
+ 4. Under **Environment Variables**, add:
64
+ ```
65
+ FLASK_APP=app.py
66
+ FLASK_DEBUG=false
67
+ SECRET_KEY=<run: python -c "import secrets; print(secrets.token_hex(32))">
68
+ DATABASE_URL=<your Supabase connection string from Step 2>
69
+ ```
70
+
71
+ 5. Click **Create Web Service** — Render will build and deploy.
72
+ 6. Your backend URL will be: `https://your-service-name.onrender.com`
73
+
74
+ > ⚠️ Free tier services spin down after 15 minutes of inactivity and take ~30s to wake up on the next request. This is normal.
75
+
76
+ ---
77
+
78
+ ## Step 4 — Deploy the Frontend on Vercel (free)
79
+
80
+ 1. Go to [vercel.com](https://vercel.com) → **Add New Project**
81
+ 2. Import your GitHub repo
82
+ 3. Configure the project:
83
+ | Setting | Value |
84
+ |---|---|
85
+ | **Root Directory** | `breathe-app/frontend` |
86
+ | **Framework Preset** | Vite |
87
+ | **Build Command** | `npm run build` |
88
+ | **Output Directory** | `dist` |
89
+
90
+ 4. Under **Environment Variables**, add:
91
+ ```
92
+ VITE_API_URL=https://your-service-name.onrender.com
93
+ ```
94
+
95
+ 5. Click **Deploy** — Vercel builds and publishes instantly.
96
+ 6. Your app will be live at: `https://your-project.vercel.app`
97
+
98
+ ---
99
+
100
+ ## Option C — Deploy on Hugging Face Spaces with Docker
101
+
102
+ This repository now includes a root-level `Dockerfile` so you can deploy the full app as one Docker Space.
103
+
104
+ 1. Go to [huggingface.co/spaces](https://huggingface.co/spaces) → **Create new Space**
105
+ 2. Choose **Docker** as the SDK
106
+ 3. Push or upload this repository to the Space
107
+ 4. In Space settings, add environment variables:
108
+ ```
109
+ SECRET_KEY=<a strong random value>
110
+ DATABASE_URL=<optional postgres connection string>
111
+ PSYCHO_MODEL_DIR=models/psychometric
112
+ ROBERTA_CKPT=models/text/roberta-model.pt
113
+ ```
114
+
115
+ 5. Build the Space. The app will start on port `7860` and serve both the React frontend and Flask API from the same domain.
116
+
117
+ > Note: If model files are missing, the app falls back to demo mode for assessments.
118
+
119
+ ---
120
+
121
+ ## Step 5 — Update the API Client
122
+
123
+ In `frontend/src/api/client.js`, make sure the base URL reads from the env variable:
124
+
125
+ ```js
126
+ const BASE_URL = import.meta.env.VITE_API_URL || ''
127
+ ```
128
+
129
+ Redeploy the frontend after making this change.
130
+
131
+ ---
132
+
133
+ ## Option B: ML on Hugging Face Spaces (free)
134
+
135
+ If you want the full ML-powered assessments for free:
136
+
137
+ 1. Go to [huggingface.co/spaces](https://huggingface.co/spaces) → **Create new Space**
138
+ 2. Choose **Docker** as the SDK
139
+ 3. Upload:
140
+ - `app.py`, `backend/`, `models/`, `requirements.txt`
141
+ - A `Dockerfile` (see below)
142
+ 4. Add the same environment variables in the Space settings
143
+
144
+ **Dockerfile for Hugging Face:**
145
+ ```dockerfile
146
+ FROM python:3.11-slim
147
+ WORKDIR /app
148
+ COPY requirements.txt .
149
+ RUN pip install --no-cache-dir -r requirements.txt
150
+ COPY . .
151
+ EXPOSE 7860
152
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
153
+ ```
154
+
155
+ HF Spaces provides 2 CPU cores and 16 GB RAM on the free tier — enough for the ML models.
156
+
157
+ ---
158
+
159
+ ## Summary
160
+
161
+ | Step | Action | Time |
162
+ |---|---|---|
163
+ | 1 | Push code to GitHub | 5 min |
164
+ | 2 | Create Supabase database, copy connection string | 5 min |
165
+ | 3 | Deploy Flask backend on Render | 10 min |
166
+ | 4 | Deploy React frontend on Vercel | 5 min |
167
+ | 5 | Set `VITE_API_URL` and redeploy frontend | 2 min |
168
+
169
+ Total: ~30 minutes, $0.
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-bullseye AS frontend-build
2
+
3
+ WORKDIR /app/frontend
4
+ COPY frontend/package*.json ./
5
+ RUN npm install
6
+ COPY frontend/ .
7
+ RUN npm run build
8
+
9
+ FROM python:3.11-slim
10
+
11
+ WORKDIR /app
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ COPY . .
16
+ COPY --from=frontend-build /app/frontend/dist ./frontend/dist
17
+
18
+ EXPOSE 7860
19
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
FUTURE_ENHANCEMENTS.md ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚀 BREATHE — Future Enhancements
2
+
3
+ A living document of planned and possible improvements to the BREATHE platform.
4
+
5
+ ---
6
+
7
+ ## 1. PostgreSQL — Persistent Production Database
8
+
9
+ SQLite is fine for development but it resets or corrupts when the server restarts on many cloud platforms. PostgreSQL is a proper production-grade database where your data persists independently of the server.
10
+
11
+ ### Why switch?
12
+ - Data survives server restarts, crashes, and re-deployments
13
+ - Multiple workers can read/write simultaneously (SQLite locks)
14
+ - You can inspect, back up, and query data directly from any Postgres client
15
+ - Required by most cloud platforms (Railway, Render, Supabase, AWS RDS, etc.)
16
+
17
+ ### Step-by-step setup (local)
18
+
19
+ **1. Install PostgreSQL**
20
+ ```bash
21
+ # macOS (Homebrew)
22
+ brew install postgresql@16
23
+ brew services start postgresql@16
24
+
25
+ # Ubuntu / Debian
26
+ sudo apt install postgresql postgresql-contrib
27
+ sudo systemctl start postgresql
28
+ ```
29
+
30
+ **2. Create the database and user**
31
+ ```bash
32
+ psql postgres
33
+ ```
34
+ ```sql
35
+ CREATE USER breathe_user WITH PASSWORD 'your_strong_password';
36
+ CREATE DATABASE breathe_db OWNER breathe_user;
37
+ GRANT ALL PRIVILEGES ON DATABASE breathe_db TO breathe_user;
38
+ \q
39
+ ```
40
+
41
+ **3. Install the Python driver**
42
+ ```bash
43
+ source venv/bin/activate
44
+ pip install psycopg2-binary
45
+ ```
46
+
47
+ **4. Update `.env`**
48
+ ```
49
+ DATABASE_URL=postgresql://breathe_user:your_strong_password@localhost:5432/breathe_db
50
+ ```
51
+
52
+ **5. Run the app — tables are created automatically**
53
+ ```bash
54
+ python app.py
55
+ ```
56
+ Flask's `db.create_all()` will create all tables in Postgres on first run.
57
+
58
+ **6. Verify**
59
+ ```bash
60
+ psql -U breathe_user -d breathe_db -c "\dt"
61
+ # Should list: users, assessments, gratitude_entries
62
+ ```
63
+
64
+ ### Step-by-step setup (cloud — Supabase, free tier)
65
+
66
+ 1. Go to [supabase.com](https://supabase.com) → New project
67
+ 2. In **Settings → Database** copy the **Connection string** (URI format)
68
+ 3. Paste it into `.env` as `DATABASE_URL`
69
+ 4. The app connects and creates tables on next start — no other changes needed
70
+
71
+ ### Step-by-step setup (cloud — Railway)
72
+
73
+ 1. Go to [railway.app](https://railway.app) → New project → Add PostgreSQL
74
+ 2. Click the Postgres service → **Connect** tab → copy the `DATABASE_URL`
75
+ 3. Add it as an environment variable in your BREATHE service on Railway
76
+ 4. Re-deploy — done
77
+
78
+ ### Keeping data safe with backups
79
+ ```bash
80
+ # Dump the entire database
81
+ pg_dump -U breathe_user breathe_db > backup_$(date +%Y%m%d).sql
82
+
83
+ # Restore from a dump
84
+ psql -U breathe_user breathe_db < backup_20260502.sql
85
+ ```
86
+
87
+ ---
88
+
89
+ ## 2. Sign Up / Log In with Google (OAuth 2.0)
90
+
91
+ Let users authenticate with their Google account — no password to remember.
92
+
93
+ ### How it works
94
+ 1. User clicks "Continue with Google"
95
+ 2. Browser redirects to Google's OAuth consent screen
96
+ 3. Google returns an authorization code to your callback URL
97
+ 4. Flask exchanges the code for an access token and reads the user's profile (name, email, avatar)
98
+ 5. Your app creates or logs in the user automatically
99
+
100
+ ### Backend — Flask-Dance (simplest approach)
101
+
102
+ **Install**
103
+ ```bash
104
+ pip install flask-dance[sqla]
105
+ ```
106
+
107
+ **Register a Google OAuth app**
108
+ 1. Go to [console.cloud.google.com](https://console.cloud.google.com)
109
+ 2. Create a new project → **APIs & Services → Credentials**
110
+ 3. Click **Create Credentials → OAuth client ID**
111
+ 4. Application type: **Web application**
112
+ 5. Authorised redirect URI: `http://localhost:5000/login/google/authorized`
113
+ 6. Copy the **Client ID** and **Client Secret** into `.env`:
114
+
115
+ ```
116
+ GOOGLE_CLIENT_ID=your_client_id
117
+ GOOGLE_CLIENT_SECRET=your_client_secret
118
+ ```
119
+
120
+ **Add to `backend/__init__.py`**
121
+ ```python
122
+ from flask_dance.contrib.google import make_google_blueprint, google
123
+
124
+ google_bp = make_google_blueprint(
125
+ client_id=os.environ.get("GOOGLE_CLIENT_ID"),
126
+ client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"),
127
+ scope=["openid", "email", "profile"],
128
+ redirect_url="/api/auth/google/callback",
129
+ )
130
+ app.register_blueprint(google_bp, url_prefix="/login")
131
+ ```
132
+
133
+ **Add a callback route in `auth.py`**
134
+ ```python
135
+ from flask_dance.contrib.google import google
136
+
137
+ @auth_bp.route("/google/callback")
138
+ def google_callback():
139
+ if not google.authorized:
140
+ return jsonify({"error": "Not authorized"}), 401
141
+ resp = google.get("/oauth2/v2/userinfo")
142
+ info = resp.json()
143
+ user = User.query.filter_by(email=info["email"]).first()
144
+ if not user:
145
+ user = User(username=info["name"], email=info["email"])
146
+ user.avatar = info.get("picture")
147
+ db.session.add(user)
148
+ db.session.commit()
149
+ session["user_id"] = user.id
150
+ return redirect("http://localhost:5173/app/breathe")
151
+ ```
152
+
153
+ **Frontend — add a Google button to `AuthPage.jsx`**
154
+ ```jsx
155
+ <a href="http://localhost:5000/login/google" className="btn-google">
156
+ <img src="/google-icon.svg" alt="" /> Continue with Google
157
+ </a>
158
+ ```
159
+
160
+ ---
161
+
162
+ ## 3. Improved UI & UX
163
+
164
+ ### Ideas to implement
165
+
166
+ | Area | Enhancement |
167
+ |------|-------------|
168
+ | Onboarding | First-time walkthrough tooltip tour (using `driver.js` or `intro.js`) |
169
+ | Themes | Light mode toggle + system preference detection |
170
+ | Animations | Framer Motion page transitions and micro-interactions |
171
+ | Mobile | Full PWA support — installable on phone home screen |
172
+ | Accessibility | ARIA labels, keyboard navigation, high-contrast mode |
173
+ | Charts | Hover annotations, zoom on timeline, weekly/monthly toggle |
174
+ | Notifications | Browser push notifications for daily assessment reminders |
175
+ | Streaks | Gamification — show journaling streak counter on dashboard |
176
+ | Data export | Download your assessment + journal history as CSV or PDF |
177
+
178
+ ### Quick win — dark/light theme toggle
179
+ ```js
180
+ // in index.css: add a [data-theme="light"] block overriding --bg, --surface, etc.
181
+ // in a ThemeToggle component:
182
+ document.documentElement.setAttribute('data-theme', isDark ? 'dark' : 'light')
183
+ localStorage.setItem('theme', isDark ? 'dark' : 'light')
184
+ ```
185
+
186
+ ---
187
+
188
+ ## 4. Calm Background Music
189
+
190
+ Play ambient/calming audio tracks inside the app to accompany breathing and journaling sessions.
191
+
192
+ ### Option A — Self-hosted audio files (simplest)
193
+
194
+ 1. Download royalty-free tracks from [freemusicarchive.org](https://freemusicarchive.org) or [pixabay.com/music](https://pixabay.com/music/)
195
+ 2. Place `.mp3` files in `frontend/public/audio/`
196
+ 3. Build a `MusicPlayer` component:
197
+
198
+ ```jsx
199
+ // frontend/src/components/MusicPlayer.jsx
200
+ import { useState, useRef } from 'react'
201
+
202
+ const TRACKS = [
203
+ { title: 'Forest Rain', src: '/audio/forest-rain.mp3' },
204
+ { title: 'Ocean Waves', src: '/audio/ocean-waves.mp3' },
205
+ { title: 'Tibetan Bowls', src: '/audio/tibetan-bowls.mp3' },
206
+ ]
207
+
208
+ export default function MusicPlayer() {
209
+ const [playing, setPlaying] = useState(false)
210
+ const [track, setTrack] = useState(0)
211
+ const audioRef = useRef(null)
212
+
213
+ function togglePlay() {
214
+ if (playing) { audioRef.current.pause() }
215
+ else { audioRef.current.play() }
216
+ setPlaying(!playing)
217
+ }
218
+
219
+ function changeTrack(i) {
220
+ setTrack(i)
221
+ setPlaying(false)
222
+ setTimeout(() => { audioRef.current.load(); audioRef.current.play(); setPlaying(true) }, 50)
223
+ }
224
+
225
+ return (
226
+ <div className="music-player">
227
+ <audio ref={audioRef} loop src={TRACKS[track].src} />
228
+ <button onClick={togglePlay}>{playing ? '⏸' : '▶'}</button>
229
+ <span>{TRACKS[track].title}</span>
230
+ {TRACKS.map((t, i) => (
231
+ <button key={i} onClick={() => changeTrack(i)}>{t.title}</button>
232
+ ))}
233
+ </div>
234
+ )
235
+ }
236
+ ```
237
+
238
+ 4. Add `<MusicPlayer />` to `BreathePage.jsx` or the guided exercise modal
239
+
240
+ ### Option B — Streaming via YouTube IFrame API (no file hosting needed)
241
+
242
+ ```jsx
243
+ // Embed a YouTube ambient playlist
244
+ <iframe
245
+ src="https://www.youtube.com/embed/videoseries?list=PLQ6T_LmSTMi17X70BIqNfSFRMC1u83M7m&autoplay=1&loop=1"
246
+ allow="autoplay"
247
+ style={{ display: 'none' }} // audio only
248
+ />
249
+ ```
250
+
251
+ ---
252
+
253
+ ## 5. Text-to-Speech for Activity Instructions
254
+
255
+ Convert the step-by-step instructions in guided exercises into spoken audio so users can close their eyes and follow along hands-free.
256
+
257
+ ### Option A — Web Speech API (free, no API key, built into browser)
258
+
259
+ ```jsx
260
+ // frontend/src/utils/tts.js
261
+ export function speak(text, { rate = 0.85, pitch = 1, volume = 1 } = {}) {
262
+ if (!window.speechSynthesis) return
263
+ window.speechSynthesis.cancel()
264
+ const utt = new SpeechSynthesisUtterance(text)
265
+ utt.rate = rate
266
+ utt.pitch = pitch
267
+ utt.volume = volume
268
+ // Pick a calm voice if available
269
+ const voices = window.speechSynthesis.getVoices()
270
+ const calm = voices.find(v => v.name.includes('Samantha') || v.name.includes('Karen'))
271
+ if (calm) utt.voice = calm
272
+ window.speechSynthesis.speak(utt)
273
+ }
274
+
275
+ export function stopSpeaking() {
276
+ window.speechSynthesis.cancel()
277
+ }
278
+ ```
279
+
280
+ **Use it in `BreathePage.jsx` guided modal:**
281
+ ```jsx
282
+ import { speak, stopSpeaking } from '../utils/tts'
283
+
284
+ // When step changes, read it aloud:
285
+ useEffect(() => {
286
+ speak(`${s.label}. ${s.desc}`)
287
+ return () => stopSpeaking()
288
+ }, [step])
289
+
290
+ // Add a toggle button:
291
+ const [ttsOn, setTtsOn] = useState(false)
292
+ ```
293
+
294
+ **Add a count-down timer with spoken cues for Box Breathing:**
295
+ ```jsx
296
+ useEffect(() => {
297
+ if (!s.duration || !ttsOn) return
298
+ speak(`${s.label}. ${s.duration} seconds.`)
299
+ const timer = setTimeout(() => speak('Next.'), s.duration * 1000)
300
+ return () => clearTimeout(timer)
301
+ }, [step])
302
+ ```
303
+
304
+ ### Option B — ElevenLabs API (natural-sounding AI voices)
305
+
306
+ 1. Sign up at [elevenlabs.io](https://elevenlabs.io) (free tier: 10,000 chars/month)
307
+ 2. Generate MP3 files for each step offline and include them as static assets (same as Option A of music)
308
+ 3. Or call the API at runtime:
309
+
310
+ ```python
311
+ # backend/routes/tts.py
312
+ import requests, os
313
+ from flask import Blueprint, jsonify, request
314
+
315
+ tts_bp = Blueprint("tts", __name__, url_prefix="/api/tts")
316
+
317
+ @tts_bp.route("/speak", methods=["POST"])
318
+ def speak():
319
+ text = (request.get_json() or {}).get("text", "")[:500]
320
+ resp = requests.post(
321
+ "https://api.elevenlabs.io/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL",
322
+ headers={"xi-api-key": os.environ["ELEVEN_API_KEY"]},
323
+ json={"text": text, "voice_settings": {"stability": 0.5, "similarity_boost": 0.75}},
324
+ )
325
+ return resp.content, 200, {"Content-Type": "audio/mpeg"}
326
+ ```
327
+
328
+ ```js
329
+ // Frontend: fetch and play
330
+ const res = await fetch('/api/tts/speak', { method:'POST', body: JSON.stringify({text}), headers:{'Content-Type':'application/json'} })
331
+ const blob = await res.blob()
332
+ new Audio(URL.createObjectURL(blob)).play()
333
+ ```
334
+
335
+ ### Option C — Google Cloud Text-to-Speech (highest quality, WaveNet voices)
336
+
337
+ ```bash
338
+ pip install google-cloud-texttospeech
339
+ ```
340
+
341
+ ```python
342
+ from google.cloud import texttospeech
343
+
344
+ client = texttospeech.TextToSpeechClient()
345
+ synthesis_input = texttospeech.SynthesisInput(text=text)
346
+ voice = texttospeech.VoiceSelectionParams(
347
+ language_code="en-US",
348
+ name="en-US-Wavenet-F",
349
+ )
350
+ audio_config = texttospeech.AudioConfig(audio_encoding=texttospeech.AudioEncoding.MP3)
351
+ response = client.synthesize_speech(input=synthesis_input, voice=voice, audio_config=audio_config)
352
+ # response.audio_content is bytes → stream to frontend
353
+ ```
354
+
355
+ ---
356
+
357
+ ## 6. Spotify Integration — Play Your Playlists Inside BREATHE
358
+
359
+ Let users connect their Spotify account and play their own playlists (or curated calm playlists) without leaving the app.
360
+
361
+ ### How it works (Spotify Web Playback SDK + OAuth PKCE)
362
+
363
+ **Step 1 — Create a Spotify app**
364
+ 1. Go to [developer.spotify.com/dashboard](https://developer.spotify.com/dashboard)
365
+ 2. Click **Create App**
366
+ 3. Set **Redirect URI** to `http://localhost:5173/app/spotify/callback`
367
+ 4. Copy your **Client ID** (no secret needed for PKCE flow)
368
+ 5. Add to `.env`: `VITE_SPOTIFY_CLIENT_ID=your_client_id`
369
+
370
+ **Step 2 — Authorization (PKCE, no backend needed)**
371
+ ```js
372
+ // frontend/src/utils/spotify.js
373
+ const CLIENT_ID = import.meta.env.VITE_SPOTIFY_CLIENT_ID
374
+ const REDIRECT_URI = 'http://localhost:5173/app/spotify/callback'
375
+ const SCOPES = 'streaming user-read-email user-read-private user-library-read playlist-read-private'
376
+
377
+ export async function loginWithSpotify() {
378
+ const verifier = generateCodeVerifier(128)
379
+ const challenge = await generateCodeChallenge(verifier)
380
+ localStorage.setItem('spotify_verifier', verifier)
381
+
382
+ const params = new URLSearchParams({
383
+ response_type: 'code',
384
+ client_id: CLIENT_ID,
385
+ scope: SCOPES,
386
+ redirect_uri: REDIRECT_URI,
387
+ code_challenge_method: 'S256',
388
+ code_challenge: challenge,
389
+ })
390
+ window.location = 'https://accounts.spotify.com/authorize?' + params
391
+ }
392
+
393
+ export async function exchangeToken(code) {
394
+ const verifier = localStorage.getItem('spotify_verifier')
395
+ const res = await fetch('https://accounts.spotify.com/api/token', {
396
+ method: 'POST',
397
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
398
+ body: new URLSearchParams({
399
+ grant_type: 'authorization_code',
400
+ code,
401
+ redirect_uri: REDIRECT_URI,
402
+ client_id: CLIENT_ID,
403
+ code_verifier: verifier,
404
+ }),
405
+ })
406
+ const data = await res.json()
407
+ localStorage.setItem('spotify_token', data.access_token)
408
+ localStorage.setItem('spotify_refresh', data.refresh_token)
409
+ return data.access_token
410
+ }
411
+
412
+ // Helper: generate PKCE verifier/challenge
413
+ function generateCodeVerifier(length) {
414
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~'
415
+ return Array.from(crypto.getRandomValues(new Uint8Array(length)))
416
+ .map(b => chars[b % chars.length]).join('')
417
+ }
418
+ async function generateCodeChallenge(verifier) {
419
+ const data = new TextEncoder().encode(verifier)
420
+ const digest = await crypto.subtle.digest('SHA-256', data)
421
+ return btoa(String.fromCharCode(...new Uint8Array(digest)))
422
+ .replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
423
+ }
424
+ ```
425
+
426
+ **Step 3 — Load the Spotify Web Playback SDK**
427
+ ```html
428
+ <!-- frontend/index.html -->
429
+ <script src="https://sdk.scdn.co/spotify-player.js"></script>
430
+ ```
431
+
432
+ **Step 4 — Create a `SpotifyPlayer` component**
433
+ ```jsx
434
+ // frontend/src/components/SpotifyPlayer.jsx
435
+ import { useEffect, useState } from 'react'
436
+
437
+ export default function SpotifyPlayer({ token }) {
438
+ const [player, setPlayer] = useState(null)
439
+ const [deviceId, setDeviceId] = useState(null)
440
+ const [playing, setPlaying] = useState(false)
441
+ const [track, setTrack] = useState(null)
442
+ const [playlists, setPlaylists] = useState([])
443
+
444
+ useEffect(() => {
445
+ window.onSpotifyWebPlaybackSDKReady = () => {
446
+ const p = new window.Spotify.Player({
447
+ name: 'BREATHE Player',
448
+ getOAuthToken: cb => cb(token),
449
+ volume: 0.5,
450
+ })
451
+ p.addListener('ready', ({ device_id }) => setDeviceId(device_id))
452
+ p.addListener('player_state_changed', state => {
453
+ if (!state) return
454
+ setTrack(state.track_window.current_track)
455
+ setPlaying(!state.paused)
456
+ })
457
+ p.connect()
458
+ setPlayer(p)
459
+ }
460
+ }, [token])
461
+
462
+ // Fetch user's playlists
463
+ useEffect(() => {
464
+ fetch('https://api.spotify.com/v1/me/playlists', {
465
+ headers: { Authorization: `Bearer ${token}` }
466
+ }).then(r => r.json()).then(d => setPlaylists(d.items || []))
467
+ }, [token])
468
+
469
+ async function playPlaylist(uri) {
470
+ await fetch(`https://api.spotify.com/v1/me/player/play?device_id=${deviceId}`, {
471
+ method: 'PUT',
472
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
473
+ body: JSON.stringify({ context_uri: uri }),
474
+ })
475
+ }
476
+
477
+ return (
478
+ <div className="spotify-player">
479
+ {track && (
480
+ <div className="sp-now-playing">
481
+ <img src={track.album.images[0]?.url} alt="" className="sp-album-art" />
482
+ <div>
483
+ <div className="sp-track-name">{track.name}</div>
484
+ <div className="sp-artist">{track.artists.map(a => a.name).join(', ')}</div>
485
+ </div>
486
+ <button onClick={() => player.togglePlay()}>{playing ? '⏸' : '▶'}</button>
487
+ <button onClick={() => player.previousTrack()}>⏮</button>
488
+ <button onClick={() => player.nextTrack()}>⏭</button>
489
+ </div>
490
+ )}
491
+ <div className="sp-playlists">
492
+ {playlists.map(pl => (
493
+ <button key={pl.id} onClick={() => playPlaylist(pl.uri)}>
494
+ {pl.images[0] && <img src={pl.images[0].url} alt="" />}
495
+ {pl.name}
496
+ </button>
497
+ ))}
498
+ </div>
499
+ </div>
500
+ )
501
+ }
502
+ ```
503
+
504
+ **Step 5 — Add a callback route in React**
505
+ ```jsx
506
+ // App.jsx — add inside <Routes>
507
+ <Route path="/app/spotify/callback" element={<SpotifyCallback />} />
508
+ ```
509
+
510
+ ```jsx
511
+ // pages/SpotifyCallback.jsx
512
+ import { useEffect } from 'react'
513
+ import { useNavigate } from 'react-router-dom'
514
+ import { exchangeToken } from '../utils/spotify'
515
+
516
+ export default function SpotifyCallback() {
517
+ const navigate = useNavigate()
518
+ useEffect(() => {
519
+ const code = new URLSearchParams(window.location.search).get('code')
520
+ if (code) exchangeToken(code).then(() => navigate('/app/breathe'))
521
+ }, [])
522
+ return <div>Connecting to Spotify…</div>
523
+ }
524
+ ```
525
+
526
+ **Step 6 — Add "Connect Spotify" button to the Breathe hub or Dashboard**
527
+ ```jsx
528
+ import { loginWithSpotify } from '../utils/spotify'
529
+
530
+ const token = localStorage.getItem('spotify_token')
531
+ if (!token) {
532
+ return <button onClick={loginWithSpotify}>🎵 Connect Spotify</button>
533
+ }
534
+ return <SpotifyPlayer token={token} />
535
+ ```
536
+
537
+ > **Note:** The Spotify Web Playback SDK requires a **Spotify Premium** account to play audio.
538
+ > Free accounts can still fetch playlist metadata but cannot stream tracks directly.
539
+
540
+ ---
541
+
542
+ ## 7. Other Future Enhancements
543
+
544
+ | Enhancement | Notes |
545
+ |-------------|-------|
546
+ | **Wearable data sync** | Import heart rate & sleep data from Apple Health / Google Fit via their REST APIs and use it as auto-filled psychometric inputs |
547
+ | **AI chat support** | Add a "Talk to BREATHE" widget using OpenAI's chat API — gives personalised coping suggestions based on the user's stress history |
548
+ | **Mood tracker** | Daily one-tap mood log (separate from assessments) charted over time |
549
+ | **Weekly report email** | Cron job + Flask-Mail sends a weekly PDF summary of stress trends |
550
+ | **Multi-language support** | i18n with `react-i18next` — translate UI strings and TTS language |
551
+ | **Community / anonymous sharing** | Opt-in feed where users share their coping strategies anonymously |
552
+ | **Therapist portal** | Separate role for mental-health professionals to view consented patient dashboards |
553
+ | **Mobile app** | Wrap the React frontend with Capacitor or React Native for iOS/Android |
554
+ | **Offline mode** | Service Worker caches the app shell; assessments queue and sync when back online |
555
+ | **Biometric login** | WebAuthn passkey support — log in with Face ID or fingerprint |
README.md CHANGED
@@ -1,10 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: BREATHE
3
- emoji: 🌍
4
- colorFrom: green
5
- colorTo: blue
6
- sdk: docker
7
- pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🫁 BREATHE
2
+
3
+ > **Stress Intelligence Platform** — understand your stress before it controls you.
4
+
5
+ BREATHE is a full-stack web app that fuses psychometric lifestyle data and free-text journaling through an ML pipeline to give you a personalised stress score, trend charts, and actionable advice — all in a clean, dark-themed React dashboard.
6
+
7
+ ---
8
+
9
+ ## ✨ Features
10
+
11
+ ### Core
12
+ - **Secure auth** — sign up / log in with hashed passwords and server-side sessions
13
+ - **Psychometric assessment** — 12 lifestyle sliders (sleep, work hours, screen time, caffeine …) + 4 categorical cues
14
+ - **Text journaling** — write freely; RoBERTa NLP analyses the sentiment
15
+ - **ML fusion** — tabular ensemble (LightGBM / CatBoost / XGBoost / Stacking) + RoBERTa → weighted probability fusion → 5-class stress output
16
+ - **Demo mode** — app runs fully with rule-based heuristics when ML model files are absent
17
+
18
+ ### Dashboard
19
+ - Area timeline chart of stress scores
20
+ - Pie distribution of stress levels
21
+ - Stat cards (total assessments, latest level, average score, trend)
22
+ - Recent assessments with per-assessment detail modal
23
+ - Stress relief activity panel (accordion)
24
+
25
+ ### Profile
26
+ - Upload a profile photo (JPG/PNG/GIF/WebP, max 2 MB)
27
+ - Set gender, working status, and date of birth
28
+ - Write a short bio
29
+ - **Anonymous mode** — toggle to hide your name in shared/exported views
30
+
31
+ ### Gratitude Journal
32
+ - Write 3 prompted daily gratitude items + optional mood tag + free-text reflection
33
+ - All entries saved to your account with timestamps
34
+ - Paginated history view with expand/collapse and per-entry delete
35
+
36
+ ### Daily To-Do
37
+ - Add tasks with High / Medium / Low priority
38
+ - Filter by All / Active / Done; bulk-clear completed tasks
39
+ - **Stored in browser localStorage only** — never sent to the server
40
+
41
+ ### Breathe Hub
42
+ - Full-screen activity centre (no sidebar) — opens on login
43
+ - 6 activity cards: Gratitude Journal, Box Breathing, Daily To-Do, Body Scan, Sound Bath, Progressive Relaxation
44
+ - Guided exercise modal with step-through progress dots for breathing and relaxation exercises
45
+ - Quick nav buttons to Dashboard and Profile
46
+
47
+ ---
48
+
49
+ ## 🖥️ Tech Stack
50
+
51
+ | Layer | Technology |
52
+ |-------|------------|
53
+ | Frontend | React 18, Vite 5, React Router v6, Recharts 2 |
54
+ | Backend | Python 3.10+, Flask 3, Flask-SQLAlchemy |
55
+ | Database | SQLite (dev) / PostgreSQL (prod) |
56
+ | Auth | Server-side sessions, Werkzeug password hashing |
57
+ | ML — Tabular | LightGBM / CatBoost / XGBoost / Stacking ensemble |
58
+ | ML — Text | RoBERTa-base fine-tuned on mental-health dataset |
59
+ | ML — Fusion | Weighted probability fusion → Minimal / Mild / Moderate / Severe / Critical |
60
+
61
+ ---
62
+
63
+ ## 🚀 Quick Start
64
+
65
+ > Full instructions are in [SETUP.md](SETUP.md). This is the short version.
66
+
67
+ ### Prerequisites
68
+ - Python ≥ 3.10
69
+ - Node.js ≥ 18 + npm ≥ 9
70
+
71
+ ### 1 — Install Python deps
72
+ ```bash
73
+ cd breathe-app
74
+ python -m venv venv
75
+ source venv/bin/activate # Windows: venv\Scripts\Activate.ps1
76
+ pip install -r requirements.txt
77
+ ```
78
+
79
+ ### 2 — Configure environment
80
+ ```bash
81
+ cp .env.example .env
82
+ # edit .env — set SECRET_KEY at minimum
83
+ ```
84
+
85
+ ### 3 — Install frontend deps
86
+ ```bash
87
+ cd frontend && npm install && cd ..
88
+ ```
89
+
90
+ ### 3.1 — Docker deployment support
91
+ This repo includes a root-level `Dockerfile` so you can build the app as a single container for Hugging Face Spaces or any Docker host.
92
+
93
+ ### 4 — Run (two terminals)
94
+
95
+ **Terminal 1 — Flask API (port 5000)**
96
+ ```bash
97
+ source venv/bin/activate
98
+ python app.py
99
+ ```
100
+
101
+ **Terminal 2 — React dev server (port 5173)**
102
+ ```bash
103
+ cd frontend
104
+ npm run dev
105
+ ```
106
+
107
+ Open **http://localhost:5173** — after login you land on the Breathe hub 🎉
108
+
109
+ ---
110
+
111
+ ## 📁 Project Structure
112
+
113
+ ```
114
+ breathe-app/
115
+ ├── app.py # WSGI entry-point
116
+ ├── requirements.txt
117
+ ├── .env.example
118
+ ├── backend/
119
+ │ ├── __init__.py # Flask app factory
120
+ │ ├── models/
121
+ │ │ ├── user.py # User ORM (incl. profile fields)
122
+ │ │ ├── assessment.py # Assessment ORM
123
+ │ │ └── gratitude.py # GratitudeEntry ORM
124
+ │ ├── routes/
125
+ │ │ ├── auth.py # /api/auth/*
126
+ │ │ ├── assessments.py # /api/assessments/*
127
+ │ │ ├── profile.py # /api/profile/*
128
+ │ │ └── gratitude.py # /api/gratitude/*
129
+ │ └── ml/ml_engine.py # Inference wrapper + demo fallback
130
+ ├── frontend/
131
+ │ ├── vite.config.js # Proxies /api → Flask :5000
132
+ │ └── src/
133
+ │ ├── pages/
134
+ │ │ ├── LandingPage.jsx
135
+ │ │ ├── AuthPage.jsx
136
+ │ │ ├── BreathePage.jsx # Activity hub (post-login home)
137
+ │ │ ├── DashboardPage.jsx
138
+ │ │ ├── AssessPage.jsx
139
+ │ │ ├── HistoryPage.jsx
140
+ │ │ ├── ProfilePage.jsx
141
+ │ │ ├── GratitudePage.jsx
142
+ │ │ └── TodoPage.jsx
143
+ │ ├── components/Layout.jsx # Sidebar shell
144
+ │ ├── context/AuthContext.jsx
145
+ │ └── api/client.js # Fetch wrapper (get/post/put/del)
146
+ ├── models/
147
+ │ ├── psychometric/ # .pkl files from notebook
148
+ │ └── text/ # roberta-model.pt
149
+ └── instance/
150
+ └── breathe.db # SQLite DB (auto-created)
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 🧠 ML Pipeline
156
+
157
+ ```
158
+ Lifestyle cues (12 numeric + 4 categorical)
159
+
160
+
161
+ Feature engineering (PolynomialFeatures, scaling, label encoding)
162
+
163
+
164
+ Stacking ensemble ──────────────────────────────┐
165
+ (LightGBM + CatBoost + XGBoost + RF + MLP) │
166
+ │ │
167
+ ▼ ▼
168
+ psycho_score (0–1) text_score (0–1) ← RoBERTa fine-tuned
169
+ │ │
170
+ └──────────── fusion (50/50) ───────────────┘
171
+
172
+
173
+ fused_score → stress label
174
+ [Minimal | Mild | Moderate | Severe | Critical]
175
+ ```
176
+
177
+ The engine falls back to **Demo mode** (rule-based heuristics) if model files are missing.
178
+
179
+ ---
180
+
181
+ ## 🔌 API Reference
182
+
183
+ ### Auth
184
+ | Method | Endpoint | Description |
185
+ |--------|----------|-------------|
186
+ | POST | `/api/auth/signup` | Register (`username`, `email`, `password`) |
187
+ | POST | `/api/auth/login` | Login (`email` or `username`, `password`) |
188
+ | POST | `/api/auth/logout` | Logout |
189
+ | GET | `/api/auth/me` | Current user |
190
+
191
+ ### Assessments
192
+ | Method | Endpoint | Description |
193
+ |--------|----------|-------------|
194
+ | POST | `/api/assessments` | Submit assessment |
195
+ | GET | `/api/assessments` | List (paginated `?page=1&per_page=20`) |
196
+ | GET | `/api/assessments/<id>` | Single assessment |
197
+ | GET | `/api/assessments/summary` | Dashboard data + timeline |
198
+
199
+ ### Profile
200
+ | Method | Endpoint | Description |
201
+ |--------|----------|-------------|
202
+ | GET | `/api/profile` | Get current profile |
203
+ | PUT | `/api/profile` | Update bio, gender, working status, DOB, anonymous flag |
204
+ | POST | `/api/profile/avatar` | Upload / remove avatar (base64 data-url) |
205
+
206
+ ### Gratitude Journal
207
+ | Method | Endpoint | Description |
208
+ |--------|----------|-------------|
209
+ | POST | `/api/gratitude` | Save entry (`items[]`, `content`, `mood`) |
210
+ | GET | `/api/gratitude` | List entries (paginated `?page=1`) |
211
+ | DELETE | `/api/gratitude/<id>` | Delete entry |
212
+
213
+ ---
214
+
215
+ ## 🗺️ Page Routes
216
+
217
+ | URL | Page | Auth |
218
+ |-----|------|------|
219
+ | `/` | Landing page | Public |
220
+ | `/auth` | Login / Signup | Public |
221
+ | `/app/breathe` | Breathe hub (post-login home) | Protected |
222
+ | `/app/dashboard` | Stress dashboard | Protected |
223
+ | `/app/assess` | New assessment | Protected |
224
+ | `/app/history` | Assessment history | Protected |
225
+ | `/app/profile` | User profile | Protected |
226
+ | `/app/gratitude` | Gratitude journal | Protected |
227
+ | `/app/todo` | Daily to-do list | Protected |
228
+
229
  ---
230
+
231
+ ## 📦 Production Build
232
+
233
+ ```bash
234
+ # Build React bundle (output → frontend/dist/)
235
+ cd frontend && npm run build && cd ..
236
+
237
+ # Flask auto-serves frontend/dist/ — no Node process needed
238
+ gunicorn "app:app" --workers 2 --bind 0.0.0.0:5000 --timeout 120
239
+ ```
240
+
241
+ ---
242
+
243
+ ## 📄 License
244
+
245
+ MIT — see `LICENSE` for details.
246
+
247
+
248
+ ---
249
+
250
+ ## 🖥️ Tech Stack
251
+
252
+ | Layer | Technology |
253
+ |-------|-----------|
254
+ | Frontend | React 18, Vite 5, React Router v6, Recharts 2 |
255
+ | Backend | Python 3.10+, Flask 3, Flask-SQLAlchemy |
256
+ | Database | SQLite (dev) / PostgreSQL (prod) |
257
+ | Auth | Server-side sessions, Werkzeug password hashing |
258
+ | ML — Tabular | LightGBM / CatBoost / XGBoost / Stacking ensemble |
259
+ | ML — Text | RoBERTa-base fine-tuned on mental-health dataset |
260
+ | ML — Fusion | Weighted probability fusion → Minimal / Mild / Moderate / Severe / Critical |
261
+
262
  ---
263
 
264
+ ## 🚀 Quick Start
265
+
266
+ > Full instructions are in [SETUP.md](SETUP.md). This is the short version.
267
+
268
+ ### Prerequisites
269
+ - Python ≥ 3.10
270
+ - Node.js ≥ 18 + npm ≥ 9
271
+
272
+ ### 1 — Install Python deps
273
+ ```bash
274
+ python -m venv venv
275
+ source venv/bin/activate # Windows: venv\Scripts\Activate.ps1
276
+ pip install -r requirements.txt
277
+ ```
278
+
279
+ ### 2 — Configure environment
280
+ ```bash
281
+ cp .env.example .env
282
+ # edit .env — set SECRET_KEY at minimum
283
+ ```
284
+
285
+ ### 3 — Install frontend deps
286
+ ```bash
287
+ cd frontend && npm install && cd ..
288
+ ```
289
+
290
+ ### 3.1 — Docker deployment support
291
+ This repo includes a root-level `Dockerfile` so you can build the app as a single container for Hugging Face Spaces or any Docker host.
292
+
293
+ ### 4 — Run (two terminals)
294
+
295
+ **Terminal 1 — Flask API**
296
+ ```bash
297
+ source venv/bin/activate
298
+ python app.py
299
+ ```
300
+
301
+ **Terminal 2 — React dev server**
302
+ ```bash
303
+ cd frontend
304
+ npm run dev
305
+ ```
306
+
307
+ Open **http://localhost:5173** 🎉
308
+
309
+ ---
310
+
311
+ ## 📁 Project Structure
312
+
313
+ ```
314
+ breathe-app/
315
+ ├── app.py # WSGI entry-point
316
+ ├── requirements.txt
317
+ ├── .env.example
318
+ ├── backend/
319
+ │ ├── __init__.py # Flask app factory
320
+ │ ├── models/ # SQLAlchemy ORM models
321
+ │ ├── routes/ # Auth + Assessment API blueprints
322
+ │ └── ml/ml_engine.py # Inference wrapper + demo fallback
323
+ ├── frontend/
324
+ │ ├── vite.config.js # Proxies /api → Flask :5000
325
+ │ └── src/
326
+ │ ├── pages/ # AuthPage, DashboardPage, AssessPage, HistoryPage
327
+ │ ├── components/ # Layout (sidebar shell)
328
+ │ ├── context/ # AuthContext
329
+ │ └── api/client.js # Fetch wrapper
330
+ ├── models/
331
+ │ ├── psychometric/ # .pkl files from notebook
332
+ │ └── text/ # roberta-model.pt
333
+ └── notebooks/ # Original Jupyter notebooks
334
+ ```
335
+
336
+ ---
337
+
338
+ ## 🧠 ML Pipeline
339
+
340
+ ```
341
+ Lifestyle cues (12 numeric + 4 categorical)
342
+
343
+
344
+ Feature engineering (PolynomialFeatures, scaling, label encoding)
345
+
346
+
347
+ Stacking ensemble ──────────────────────────────┐
348
+ (LightGBM + CatBoost + XGBoost + RF + MLP) │
349
+ │ │
350
+ ▼ ▼
351
+ psycho_score (0–1) text_score (0–1) ← RoBERTa fine-tuned
352
+ │ │
353
+ └──────────── fusion (50/50) ───────────────┘
354
+
355
+
356
+ fused_score → stress label
357
+ [Minimal | Mild | Moderate | Severe | Critical]
358
+ ```
359
+
360
+ The engine falls back to **Demo mode** (rule-based heuristics) if model files are missing — the full UI still works.
361
+
362
+ ---
363
+
364
+ ## 🔌 API Reference
365
+
366
+ | Method | Endpoint | Description |
367
+ |--------|----------|-------------|
368
+ | POST | `/api/auth/signup` | Register (`username`, `email`, `password`) |
369
+ | POST | `/api/auth/login` | Login (`email` or `username`, `password`) |
370
+ | POST | `/api/auth/logout` | Logout |
371
+ | GET | `/api/auth/me` | Current user |
372
+ | POST | `/api/assessments` | Submit assessment |
373
+ | GET | `/api/assessments` | List (paginated) |
374
+ | GET | `/api/assessments/<id>` | Single assessment |
375
+ | GET | `/api/assessments/summary` | Dashboard data |
376
+
377
+ ---
378
+
379
+ ## 📦 Production Build
380
+
381
+ ```bash
382
+ # Build React bundle (output → frontend/dist/)
383
+ cd frontend && npm run build && cd ..
384
+
385
+ # Flask auto-serves frontend/dist/ — no Node process needed
386
+ gunicorn "app:app" --workers 2 --bind 0.0.0.0:5000 --timeout 120
387
+ ```
388
+
389
+ ---
390
+
391
+ ## 🤝 Contributing
392
+
393
+ 1. Fork the repo
394
+ 2. Create a feature branch: `git checkout -b feat/my-feature`
395
+ 3. Commit your changes: `git commit -m "feat: add my feature"`
396
+ 4. Push and open a Pull Request
397
+
398
+ ---
399
+
400
+ ## 📄 License
401
+
402
+ MIT — see `LICENSE` for details.
SETUP.md ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BREATHE — Project Setup Guide
2
+
3
+ ## Overview
4
+
5
+ **BREATHE** is a full-stack stress intelligence web application. After logging in, users land on the **Breathe hub** — a full-screen activity centre with cards for:
6
+ - Stress assessments (psychometric + free-text, ML-powered)
7
+ - Gratitude journaling (saved to account)
8
+ - Daily to-do list (saved in browser only)
9
+ - Guided breathing and relaxation exercises
10
+
11
+ All stress data is stored in a database and shown on a live dashboard with charts and history.
12
+
13
+ ---
14
+
15
+ ## Project Structure
16
+
17
+ ```
18
+ breathe-app/
19
+ ├── app.py # WSGI entry-point
20
+ ├── requirements.txt
21
+ ├── .env.example # copy → .env and fill in values
22
+ ├── .gitignore
23
+ ├── backend/
24
+ │ ├── __init__.py # Flask app factory + DB init
25
+ │ ├── models/
26
+ │ │ ├── user.py # User ORM (profile fields: avatar, gender, dob, bio, is_anonymous)
27
+ │ │ ├── assessment.py # Assessment ORM
28
+ │ │ └── gratitude.py # GratitudeEntry ORM
29
+ │ ├── routes/
30
+ │ │ ├── auth.py # /api/auth/*
31
+ │ │ ├── assessments.py # /api/assessments/*
32
+ │ │ ├── profile.py # /api/profile/*
33
+ │ │ └── gratitude.py # /api/gratitude/*
34
+ │ └── ml/
35
+ │ └── ml_engine.py # Psychometric + RoBERTa inference (demo fallback)
36
+ ├── frontend/ # React 18 + Vite 5 SPA
37
+ │ ├── index.html
38
+ │ ├── vite.config.js # Vite config (proxy /api → Flask :5000)
39
+ │ ├── package.json
40
+ │ └── src/
41
+ │ ├── main.jsx
42
+ │ ├── App.jsx # Router + auth guards
43
+ │ ├── index.css # Global design system
44
+ │ ├── utils.js # Shared helpers + colour maps
45
+ │ ├── api/client.js # Fetch wrapper (get/post/put/del)
46
+ │ ├── context/
47
+ │ │ └── AuthContext.jsx
48
+ │ ├── components/
49
+ │ │ └── Layout.jsx # Sidebar shell
50
+ │ └── pages/
51
+ │ ├── LandingPage.jsx
52
+ │ ├── AuthPage.jsx
53
+ │ ├── BreathePage.jsx # Activity hub (post-login home)
54
+ │ ├── DashboardPage.jsx
55
+ │ ├── AssessPage.jsx
56
+ │ ├── HistoryPage.jsx
57
+ │ ├── ProfilePage.jsx
58
+ │ ├── GratitudePage.jsx
59
+ │ └── TodoPage.jsx
60
+ ├── models/
61
+ │ ├── psychometric/ # .pkl files from notebook
62
+ │ └── text/ # roberta-model.pt
63
+ └── instance/
64
+ └── breathe.db # SQLite DB (auto-created)
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Prerequisites
70
+
71
+ | Requirement | Version |
72
+ |-------------|---------|
73
+ | Python | ≥ 3.10 |
74
+ | Node.js | ≥ 18 |
75
+ | npm | ≥ 9 |
76
+ | pip | ≥ 23 |
77
+ | (Optional) NVIDIA GPU + CUDA 12.x | for full RoBERTa inference |
78
+
79
+ ---
80
+
81
+ ## Step-by-Step Setup
82
+
83
+ ### 1 — Open the project folder
84
+
85
+ ```bash
86
+ cd breathe-app
87
+ ```
88
+
89
+ ### 2 — Create a Python virtual environment
90
+
91
+ ```bash
92
+ python -m venv venv
93
+
94
+ # macOS / Linux
95
+ source venv/bin/activate
96
+
97
+ # Windows PowerShell
98
+ venv\Scripts\Activate.ps1
99
+ ```
100
+
101
+ ### 3 — Install Python dependencies
102
+
103
+ ```bash
104
+ pip install --upgrade pip
105
+ pip install -r requirements.txt
106
+ ```
107
+
108
+ > **GPU note:** For GPU-accelerated RoBERTa inference, replace the `torch` line in
109
+ > `requirements.txt` with:
110
+ > ```
111
+ > torch==2.2.2+cu121 --index-url https://download.pytorch.org/whl/cu121
112
+ > ```
113
+
114
+ ### 4 — Configure environment variables
115
+
116
+ ```bash
117
+ cp .env.example .env
118
+ ```
119
+
120
+ Open `.env` and fill in:
121
+
122
+ | Variable | What to set |
123
+ |----------|-------------|
124
+ | `SECRET_KEY` | Long random string |
125
+ | `DATABASE_URL` | `sqlite:///breathe.db` (default) or a PostgreSQL URI |
126
+ | `PSYCHO_MODEL_DIR` | Path to folder with trained psychometric `.pkl` files |
127
+ | `ROBERTA_CKPT` | Path to `roberta-model.pt` |
128
+
129
+ > **Demo mode:** If model paths are missing or `torch` is not installed, the app runs with
130
+ > rule-based heuristic predictions. All features of the UI still work.
131
+
132
+ #### Psychometric model artefacts
133
+
134
+ Run `psychometric notebook.ipynb` to produce these files, then set `PSYCHO_MODEL_DIR`:
135
+
136
+ ```
137
+ base_scaler.pkl final_scaler.pkl le_dict.pkl le_target.pkl
138
+ selected_cols.pkl poly.pkl top_num.pkl *_best_model.pkl
139
+ ```
140
+
141
+ #### RoBERTa checkpoint
142
+
143
+ ```
144
+ ROBERTA_CKPT=/path/to/breathe/text-sentiment/roberta-model.pt
145
+ ```
146
+
147
+ ### 5 — Install frontend dependencies
148
+
149
+ ```bash
150
+ cd frontend
151
+ npm install
152
+ cd ..
153
+ ```
154
+
155
+ > **asdf users:** run `asdf set nodejs 20.18.1` inside the `frontend/` directory first.
156
+
157
+ ### 6 — Run the development servers
158
+
159
+ Open **two terminal tabs**.
160
+
161
+ **Terminal 1 — Flask API (port 5000)**
162
+ ```bash
163
+ # from breathe-app/
164
+ source venv/bin/activate
165
+ python app.py
166
+ ```
167
+
168
+ **Terminal 2 — React dev server (port 5173)**
169
+ ```bash
170
+ # from breathe-app/frontend/
171
+ npm run dev
172
+ ```
173
+
174
+ Open **http://localhost:5173** in your browser.
175
+
176
+ - After login you land on the **Breathe hub** (`/app/breathe`)
177
+ - The React dev server proxies all `/api/*` requests to Flask on port 5000 automatically
178
+ - The SQLite database (`instance/breathe.db`) is created automatically on first run
179
+
180
+ ### 7 — (Optional) PostgreSQL
181
+
182
+ ```bash
183
+ pip install psycopg2-binary
184
+ createdb breathe
185
+ # Set in .env:
186
+ # DATABASE_URL=postgresql://postgres:password@localhost:5432/breathe
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Database Migrations
192
+
193
+ The app uses `db.create_all()` on startup to create new tables. If you add columns to an
194
+ existing table (e.g. upgrading from an older version), run the migration script manually:
195
+
196
+ ```bash
197
+ source venv/bin/activate
198
+ python3 - <<'EOF'
199
+ import sqlite3, os
200
+ conn = sqlite3.connect('instance/breathe.db')
201
+ cur = conn.cursor()
202
+ # Example: add profile columns if missing
203
+ cur.execute("PRAGMA table_info(users)")
204
+ existing = {row[1] for row in cur.fetchall()}
205
+ new_cols = {
206
+ "avatar": "TEXT", "gender": "VARCHAR(32)",
207
+ "working_status": "VARCHAR(64)", "dob": "VARCHAR(10)",
208
+ "bio": "VARCHAR(500)", "is_anonymous": "BOOLEAN DEFAULT 0",
209
+ }
210
+ for col, t in new_cols.items():
211
+ if col not in existing:
212
+ cur.execute(f"ALTER TABLE users ADD COLUMN {col} {t}")
213
+ conn.commit(); conn.close(); print('done')
214
+ EOF
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Running in Production
220
+
221
+ ### 1 — Build the React frontend
222
+
223
+ ```bash
224
+ cd frontend
225
+ npm run build
226
+ cd ..
227
+ ```
228
+
229
+ Outputs a static bundle to `frontend/dist/`. Flask auto-detects and serves it.
230
+
231
+ ### 2 — Start the Flask server
232
+
233
+ ```bash
234
+ source venv/bin/activate
235
+ gunicorn "app:app" \
236
+ --workers 2 \
237
+ --bind 0.0.0.0:5000 \
238
+ --timeout 120
239
+ ```
240
+
241
+ Set `FLASK_DEBUG=false` and a strong `SECRET_KEY` in `.env` before deploying.
242
+
243
+ ---
244
+
245
+ ## API Reference
246
+
247
+ ### Auth
248
+ | Method | Path | Description |
249
+ |--------|------|-------------|
250
+ | POST | `/api/auth/signup` | Create account (`username`, `email`, `password`) |
251
+ | POST | `/api/auth/login` | Log in (`email` or `username`, `password`) |
252
+ | POST | `/api/auth/logout` | Log out |
253
+ | GET | `/api/auth/me` | Current user |
254
+
255
+ ### Assessments
256
+ | Method | Path | Description |
257
+ |--------|------|-------------|
258
+ | POST | `/api/assessments` | Submit assessment |
259
+ | GET | `/api/assessments` | List (paginated `?page=1&per_page=20`) |
260
+ | GET | `/api/assessments/<id>` | Single assessment |
261
+ | GET | `/api/assessments/summary` | Dashboard summary + timeline |
262
+
263
+ ### Profile
264
+ | Method | Path | Description |
265
+ |--------|------|-------------|
266
+ | GET | `/api/profile` | Get current profile |
267
+ | PUT | `/api/profile` | Update bio, gender, working_status, dob, is_anonymous |
268
+ | POST | `/api/profile/avatar` | Upload/remove avatar (base64 data-url, max 2 MB) |
269
+
270
+ ### Gratitude Journal
271
+ | Method | Path | Description |
272
+ |--------|------|-------------|
273
+ | POST | `/api/gratitude` | Save entry (`items[]`, `content`, `mood`) |
274
+ | GET | `/api/gratitude` | List entries (`?page=1`) |
275
+ | DELETE | `/api/gratitude/<id>` | Delete entry |
276
+
277
+ ---
278
+
279
+ ## Page Routes
280
+
281
+ | URL | Page | Auth |
282
+ |-----|------|------|
283
+ | `/` | Landing page | Public |
284
+ | `/auth` | Login / Signup | Public |
285
+ | `/app/breathe` | Breathe hub (post-login home) | Protected |
286
+ | `/app/dashboard` | Stress dashboard | Protected |
287
+ | `/app/assess` | New assessment | Protected |
288
+ | `/app/history` | Assessment history | Protected |
289
+ | `/app/profile` | User profile | Protected |
290
+ | `/app/gratitude` | Gratitude journal | Protected |
291
+ | `/app/todo` | Daily to-do list | Protected |
292
+
293
+ ---
294
+
295
+ ## Stress Level Mapping
296
+
297
+ | Level | Score Range | Colour |
298
+ |-------|-------------|--------|
299
+ | Minimal | 0.00 – 0.20 | 🟢 Green |
300
+ | Mild | 0.20 – 0.40 | 🟡 Light green |
301
+ | Moderate | 0.40 – 0.60 | 🟠 Yellow |
302
+ | Severe | 0.60 – 0.80 | 🔴 Orange |
303
+ | Critical | 0.80 – 1.00 | 🚨 Red |
304
+
305
+ ---
306
+
307
+ ## Troubleshooting
308
+
309
+ | Problem | Fix |
310
+ |---------|-----|
311
+ | `No version is set for nodejs` | Run `asdf set nodejs 20.18.1` in `frontend/` |
312
+ | Blank page in browser | Make sure Flask is running on port 5000 |
313
+ | CORS errors | Add `http://localhost:5173` to `CORS_ORIGINS` in `.env` |
314
+ | `ModuleNotFoundError: torch` | `pip install torch` or use demo mode |
315
+ | `FileNotFoundError: base_scaler.pkl` | Set `PSYCHO_MODEL_DIR` in `.env` |
316
+ | HTTP 500 on login after upgrade | Run the DB migration script above to add new columns |
317
+ | Port 5000 in use | Set `PORT=5001` in `.env` and update `vite.config.js` proxy target |
318
+ | Database locked (SQLite) | Use PostgreSQL for multi-worker deployments |
319
+
320
+
321
+ ---
322
+
323
+ ## Project Structure
324
+
325
+ ```
326
+ breathe-app/
327
+ ├── app.py # WSGI entry-point
328
+ ├── requirements.txt
329
+ ├── .env.example # copy → .env and fill in values
330
+ ├── .gitignore
331
+ ├── backend/
332
+ │ ├── __init__.py # Flask app factory + DB init
333
+ │ ├── models/
334
+ │ │ ├── user.py # User ORM model
335
+ │ │ └── assessment.py # Assessment ORM model
336
+ │ ├── routes/
337
+ │ │ ├── auth.py # /api/auth/* endpoints
338
+ │ │ └── assessments.py # /api/assessments/* endpoints
339
+ │ └── ml/
340
+ │ └── ml_engine.py # Psychometric + RoBERTa inference
341
+ ├── frontend/ # React + Vite SPA
342
+ │ ├── index.html # Vite HTML shell
343
+ │ ├── vite.config.js # Vite config (proxy /api → Flask)
344
+ │ ├── package.json
345
+ │ └── src/
346
+ │ ├── main.jsx
347
+ │ ├── App.jsx # Router + auth guards
348
+ │ ├── index.css # Global design system
349
+ │ ├── utils.js # Shared helpers + colour maps
350
+ │ ├── api/client.js # Fetch wrapper
351
+ │ ├── context/
352
+ │ │ └── AuthContext.jsx
353
+ │ ├── components/
354
+ │ │ └── Layout.jsx # Sidebar shell
355
+ │ └── pages/
356
+ │ ├── AuthPage.jsx # Login / Signup
357
+ │ ├── DashboardPage.jsx # Charts + stats
358
+ │ ├── AssessPage.jsx # Sliders + gauge
359
+ │ └── HistoryPage.jsx # Paginated history
360
+ ├── models/
361
+ │ ├── psychometric/ # .pkl files from notebook
362
+ │ └── text/ # roberta-model.pt
363
+ └── instance/
364
+ └── breathe.db # SQLite DB (auto-created)
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Prerequisites
370
+
371
+ | Requirement | Version |
372
+ |-------------|---------|
373
+ | Python | ≥ 3.10 || Node.js | ≥ 18 |
374
+ | npm | ≥ 9 || pip | ≥ 23 |
375
+ | Git | any |
376
+ | (Optional) NVIDIA GPU + CUDA 12.x | for full RoBERTa inference |
377
+
378
+ ---
379
+
380
+ ## Step-by-Step Setup
381
+
382
+ ### 1 — Clone / open the project
383
+
384
+ ```bash
385
+ cd breathe-app
386
+ ```
387
+
388
+ ### 2 — Create a virtual environment
389
+
390
+ ```bash
391
+ python -m venv venv
392
+
393
+ # macOS / Linux
394
+ source venv/bin/activate
395
+
396
+ # Windows PowerShell
397
+ venv\Scripts\Activate.ps1
398
+ ```
399
+
400
+ ### 3 — Install Python dependencies
401
+
402
+ ```bash
403
+ pip install --upgrade pip
404
+ pip install -r requirements.txt
405
+ ```
406
+
407
+ > **GPU note:** For GPU-accelerated RoBERTa inference, replace the `torch` line in
408
+ > `requirements.txt` with:
409
+ > ```
410
+ > torch==2.2.2+cu121 --index-url https://download.pytorch.org/whl/cu121
411
+ > ```
412
+
413
+ ### 4 — Configure environment variables
414
+
415
+ ```bash
416
+ cp .env.example .env
417
+ ```
418
+
419
+ Open `.env` in any editor and fill in:
420
+
421
+ | Variable | What to set |
422
+ |----------|------------|
423
+ | `SECRET_KEY` | Long random string (see comment in file) |
424
+ | `DATABASE_URL` | SQLite default works out of the box. For Postgres: `postgresql://user:pass@host/db` |
425
+ | `PSYCHO_MODEL_DIR` | Absolute path to the directory containing your trained psychometric model `.pkl` files (output of `psychometric notebook.ipynb`) |
426
+ | `ROBERTA_CKPT` | Absolute path to `roberta-model.pt` (found in `text-sentiment/`) |
427
+
428
+ #### Generating the psychometric model artefacts
429
+
430
+ The psychometric notebook saves these files into `SAVE_DIR` (`/kaggle/working/saved_models` by default):
431
+
432
+ ```
433
+ base_scaler.pkl
434
+ final_scaler.pkl
435
+ le_dict.pkl
436
+ le_target.pkl
437
+ selected_cols.pkl
438
+ poly.pkl
439
+ top_num.pkl
440
+ <model>_best_model.pkl (e.g. lightgbm_best_model.pkl)
441
+ ```
442
+
443
+ Download them from Kaggle → paste into any local folder → set `PSYCHO_MODEL_DIR` to that folder.
444
+
445
+ #### Using the RoBERTa checkpoint
446
+
447
+ The file `text-sentiment/roberta-model.pt` is already in the workspace.
448
+ Set `ROBERTA_CKPT` to its full path:
449
+
450
+ ```
451
+ ROBERTA_CKPT=/Users/you/Downloads/breathe/text-sentiment/roberta-model.pt
452
+ ```
453
+
454
+ > **Demo mode:** If you omit or leave either path blank, the app runs in
455
+ > **Demo mode** — a rule-based heuristic engine. All features of the UI work;
456
+ > only the ML predictions are approximate.
457
+
458
+ ### 5 — Install frontend dependencies
459
+
460
+ ```bash
461
+ cd frontend
462
+ npm install
463
+ cd ..
464
+ ```
465
+
466
+ > If you use **asdf** to manage Node versions, first run:
467
+ > ```bash
468
+ > asdf set nodejs 20.18.1 # or whichever version is installed
469
+ > ```
470
+
471
+ ### 6 — Run the development servers
472
+
473
+ The app requires **two processes** running at the same time — open two terminal tabs.
474
+
475
+ **Terminal 1 — Flask API (port 5000)**
476
+ ```bash
477
+ # from breathe-app/
478
+ source venv/bin/activate # Windows: venv\Scripts\Activate.ps1
479
+ python app.py
480
+ ```
481
+
482
+ **Terminal 2 — React dev server (port 5173)**
483
+ ```bash
484
+ # from breathe-app/frontend/
485
+ npm run dev
486
+ ```
487
+
488
+ Then open **http://localhost:5173** in your browser.
489
+
490
+ > The React dev server proxies all `/api/*` requests to Flask on port 5000 automatically — no extra config needed.
491
+
492
+ The database (`instance/breathe.db`) is created automatically by Flask on first run.
493
+
494
+ ### 7 — (Optional) PostgreSQL setup
495
+
496
+ ```bash
497
+ # Install psycopg2
498
+ pip install psycopg2-binary
499
+
500
+ # Create database
501
+ createdb breathe
502
+
503
+ # Set in .env:
504
+ DATABASE_URL=postgresql://postgres:password@localhost:5432/breathe
505
+ ```
506
+
507
+ ---
508
+
509
+ ## Running in Production
510
+
511
+ ### 1 — Build the React frontend
512
+
513
+ ```bash
514
+ cd frontend
515
+ npm run build
516
+ cd ..
517
+ ```
518
+
519
+ This outputs a fully static bundle to `frontend/dist/`. Flask automatically detects and serves it — no separate Node process needed in production.
520
+
521
+ ### 2 — Start the Flask server
522
+
523
+ ```bash
524
+ source venv/bin/activate
525
+ gunicorn "app:app" \
526
+ --workers 2 \
527
+ --bind 0.0.0.0:5000 \
528
+ --timeout 120
529
+ ```
530
+
531
+ Set `FLASK_DEBUG=false` and a strong `SECRET_KEY` in `.env` before deploying.
532
+
533
+ For HTTPS, put Nginx or Caddy in front as a reverse proxy.
534
+
535
+ ---
536
+
537
+ ## API Reference
538
+
539
+ All endpoints return JSON.
540
+
541
+ ### Auth
542
+
543
+ | Method | Path | Description |
544
+ |--------|------|-------------|
545
+ | POST | `/api/auth/signup` | Create account (`username`, `email`, `password`) |
546
+ | POST | `/api/auth/login` | Log in (`email` or `username`, `password`) |
547
+ | POST | `/api/auth/logout` | Log out |
548
+ | GET | `/api/auth/me` | Get current user |
549
+
550
+ ### Assessments
551
+
552
+ | Method | Path | Description |
553
+ |--------|------|-------------|
554
+ | POST | `/api/assessments` | Submit assessment (psychometric JSON + text note) |
555
+ | GET | `/api/assessments` | List assessments (paginated: `?page=1&per_page=20`) |
556
+ | GET | `/api/assessments/<id>` | Get single assessment |
557
+ | GET | `/api/assessments/summary` | Dashboard summary + timeline |
558
+
559
+ #### Example POST body
560
+
561
+ ```json
562
+ {
563
+ "psychometric": {
564
+ "Sleep_Duration": 6.5,
565
+ "Sleep_Quality": 2,
566
+ "Work_Hours": 11,
567
+ "Physical_Activity": 0.5,
568
+ "Screen_Time": 8,
569
+ "Travel_Time": 1.5,
570
+ "Social_Interactions": 2,
571
+ "Caffeine_Intake": 4,
572
+ "Alcohol_Intake": 0,
573
+ "Blood_Pressure": 125,
574
+ "Cholesterol_Level": 200,
575
+ "Blood_Sugar_Level": 95,
576
+ "Gender": "Female",
577
+ "Occupation": "Working Professional",
578
+ "Smoking_Status": "Non-Smoker",
579
+ "Diet_Quality": "Average"
580
+ },
581
+ "text_note": "I've been feeling overwhelmed with deadlines lately and can't stop overthinking at night."
582
+ }
583
+ ```
584
+
585
+ #### Example response
586
+
587
+ ```json
588
+ {
589
+ "message": "Assessment saved",
590
+ "prediction": {
591
+ "psycho_label": "High",
592
+ "psycho_score": 0.8241,
593
+ "text_label": "Stress",
594
+ "text_score": 0.4512,
595
+ "fused_label": "Severe",
596
+ "fused_score": 0.6376,
597
+ "modality_used": "both"
598
+ },
599
+ "assessment": { "id": 7, "created_at": "2026-05-02T14:32:00", ... }
600
+ }
601
+ ```
602
+
603
+ ---
604
+
605
+ ## Stress Level Mapping
606
+
607
+ | Level | Score Range | Colour |
608
+ |-------|-------------|--------|
609
+ | Minimal | 0.00 – 0.20 | 🟢 Green |
610
+ | Mild | 0.20 – 0.40 | 🟡 Light green |
611
+ | Moderate | 0.40 – 0.60 | 🟠 Yellow |
612
+ | Severe | 0.60 – 0.80 | 🔴 Orange |
613
+ | Critical | 0.80 – 1.00 | 🚨 Red |
614
+
615
+ ---
616
+
617
+ ## Troubleshooting
618
+
619
+ | Problem | Fix |
620
+ |---------|-----|
621
+ | `No version is set for nodejs` | Run `asdf set nodejs 20.18.1` in the `frontend/` directory |
622
+ | React dev server shows blank page | Make sure Flask is running on port 5000 (the Vite proxy needs it) |
623
+ | `CORS` errors in browser console | Ensure `CORS_ORIGINS` in `.env` includes `http://localhost:5173` |
624
+ | `ModuleNotFoundError: torch` | Run `pip install torch` or install the CUDA wheel |
625
+ | `FileNotFoundError: base_scaler.pkl` | Set `PSYCHO_MODEL_DIR` correctly in `.env` |
626
+ | `RoBERTa weights not found` | App falls back to demo mode — set `ROBERTA_CKPT` |
627
+ | `Port 5000 in use` | Change `PORT=5001` in `.env` and update `vite.config.js` proxy target |
628
+ | Database locked (SQLite) | Only one worker at a time with SQLite; use Postgres for multi-worker |
629
+
630
+ ---
631
+
632
+ ## Tech Stack
633
+
634
+ | Layer | Technology |
635
+ |-------|-----------|
636
+ | Backend | Python 3.10+, Flask 3, SQLAlchemy |
637
+ | Database | SQLite (dev) / PostgreSQL (prod) |
638
+ | Auth | Server-side sessions + Werkzeug password hashing |
639
+ | ML — Tabular | LightGBM / CatBoost / XGBoost / Stacking ensemble |
640
+ | ML — Text | RoBERTa-base fine-tuned on mental-health dataset |
641
+ | ML — Fusion | Weighted probability fusion → 5-class output |
642
+ | Frontend | React 18, Vite 5, React Router v6, Recharts 2 |
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ load_dotenv()
3
+
4
+ from backend import create_app
5
+
6
+ app = create_app()
7
+
8
+ if __name__ == "__main__":
9
+ import os
10
+ app.run(
11
+ host=os.environ.get("HOST", "0.0.0.0"),
12
+ port=int(os.environ.get("PORT", 5000)),
13
+ debug=os.environ.get("FLASK_DEBUG", "false").lower() == "true",
14
+ )
backend/__init__.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from flask import Flask
3
+ from flask_sqlalchemy import SQLAlchemy
4
+ from flask_cors import CORS
5
+
6
+ db = SQLAlchemy()
7
+
8
+ # Paths resolved relative to this file's location
9
+ _HERE = os.path.dirname(__file__)
10
+ _FRONT = os.path.join(_HERE, "..", "frontend")
11
+ _DIST = os.path.join(_FRONT, "dist") # React production build
12
+ _TEMPLATES = os.path.join(_FRONT, "templates") # Vanilla HTML fallback
13
+
14
+
15
+ def create_app(config_override: dict | None = None) -> Flask:
16
+ # Prefer React build if it exists
17
+ if os.path.isdir(_DIST):
18
+ template_folder = _DIST
19
+ static_folder = os.path.join(_DIST, "assets")
20
+ static_url_path = "/assets"
21
+ else:
22
+ template_folder = _TEMPLATES
23
+ static_folder = os.path.join(_FRONT, "static")
24
+ static_url_path = "/static"
25
+
26
+ app = Flask(
27
+ __name__,
28
+ template_folder=template_folder,
29
+ static_folder=static_folder,
30
+ static_url_path=static_url_path,
31
+ )
32
+
33
+ # ── Configuration ────────────────────────────────────────────────────────
34
+ app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "change-me-in-production")
35
+ app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get(
36
+ "DATABASE_URL", "sqlite:///breathe.db"
37
+ )
38
+ app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
39
+ app.config["SESSION_COOKIE_HTTPONLY"] = True
40
+ app.config["SESSION_COOKIE_SAMESITE"] = "Lax"
41
+
42
+ if config_override:
43
+ app.config.update(config_override)
44
+
45
+ # ── Extensions ───────────────────────────────────────────────────────────
46
+ db.init_app(app)
47
+ default_origins = "http://localhost:5173,http://127.0.0.1:5173"
48
+ CORS(app, supports_credentials=True,
49
+ origins=os.environ.get("CORS_ORIGINS", default_origins).split(","))
50
+
51
+ # ── Blueprints ───────────────────────────────────────────────────────────
52
+ from .routes.auth import auth_bp
53
+ from .routes.assessments import assess_bp
54
+ from .routes.profile import profile_bp
55
+ from .routes.gratitude import gratitude_bp
56
+ app.register_blueprint(auth_bp)
57
+ app.register_blueprint(assess_bp)
58
+ app.register_blueprint(profile_bp)
59
+ app.register_blueprint(gratitude_bp)
60
+
61
+ # ── Serve SPA ────────────────────────────────────────────────────────────
62
+ from flask import send_from_directory
63
+
64
+ _dist_or_tmpl = _DIST if os.path.isdir(_DIST) else _TEMPLATES
65
+
66
+ @app.route("/")
67
+ def index():
68
+ return send_from_directory(_dist_or_tmpl, "index.html")
69
+
70
+ @app.route("/<path:path>")
71
+ def catch_all(path):
72
+ # Serve any real file that lives inside the dist/template dir
73
+ target = os.path.join(_dist_or_tmpl, path)
74
+ if os.path.isfile(target):
75
+ return send_from_directory(_dist_or_tmpl, path)
76
+ # SPA fallback
77
+ return send_from_directory(_dist_or_tmpl, "index.html")
78
+
79
+ # ── Create tables ────────────────────────────────────────────────────────
80
+ with app.app_context():
81
+ db.create_all()
82
+
83
+ # ── ML model loading ─────────────────────────────────────────────────────
84
+ from .ml.ml_engine import init_models
85
+ init_models(
86
+ psycho_model_dir=os.environ.get("PSYCHO_MODEL_DIR", ""),
87
+ roberta_ckpt =os.environ.get("ROBERTA_CKPT", ""),
88
+ )
89
+
90
+ return app
backend/ml/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from .ml_engine import init_models, predict, FUSED_LABELS, DEMO_MODE
2
+
3
+ __all__ = ["init_models", "predict", "FUSED_LABELS", "DEMO_MODE"]
backend/ml/ml_engine.py ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ml_engine.py
3
+ ────────────
4
+ Wraps the psychometric tabular model and the RoBERTa text model into a
5
+ single predict() function that returns a fused 5-class stress result.
6
+
7
+ On first import the models are loaded once and cached globally.
8
+ If a model file is not found the module operates in DEMO mode, returning
9
+ plausible random predictions so the web app can run without GPU weights.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import os
15
+ import re
16
+ import logging
17
+ import warnings
18
+ import numpy as np
19
+ import pandas as pd
20
+
21
+ warnings.filterwarnings("ignore")
22
+ logger = logging.getLogger(__name__)
23
+
24
+ # ── Label architecture ───────────────────────────────────────────────────────
25
+ PSYCHO_SCORE = {"High": 1.00, "Medium": 0.50, "Low": 0.00}
26
+
27
+ TEXT_SCORE = {
28
+ "Normal": 0.00,
29
+ "Stress": 0.45,
30
+ "Personality disorder": 0.60,
31
+ "Bipolar": 0.65,
32
+ "Anxiety": 0.70,
33
+ "Depression": 0.80,
34
+ "Suicidal": 1.00,
35
+ }
36
+
37
+ FUSED_BINS = [0.0, 0.2, 0.4, 0.6, 0.8, 1.001]
38
+ FUSED_LABELS = ["Minimal", "Mild", "Moderate", "Severe", "Critical"]
39
+ TEXT_CLASSES = sorted(TEXT_SCORE.keys())
40
+ PSYCHO_CLASSES_DEFAULT = ["High", "Low", "Medium"] # sorted order as LabelEncoder would produce
41
+
42
+
43
+ def _score_to_fused(score: float) -> str:
44
+ for lo, hi, lbl in zip(FUSED_BINS[:-1], FUSED_BINS[1:], FUSED_LABELS):
45
+ if lo <= score < hi:
46
+ return lbl
47
+ return FUSED_LABELS[-1]
48
+
49
+
50
+ # ── Model artefacts (lazy-loaded) ────────────────────────────────────────────
51
+ _psycho_model = None
52
+ _base_scaler = None
53
+ _final_scaler = None
54
+ _le_dict = None
55
+ _le_target = None
56
+ _selected_cols = None
57
+ _poly = None
58
+ _top_num = None
59
+ _loaded_model_name = ""
60
+
61
+ _roberta_model = None
62
+ _tokenizer = None
63
+
64
+ DEMO_MODE = False # flips to True if weights are missing
65
+
66
+
67
+ def _load_psycho(model_dir: str) -> bool:
68
+ global _psycho_model, _base_scaler, _final_scaler, _le_dict, _le_target
69
+ global _selected_cols, _poly, _top_num, _loaded_model_name
70
+
71
+ try:
72
+ import joblib
73
+ _base_scaler = joblib.load(os.path.join(model_dir, "base_scaler.pkl"))
74
+ _final_scaler = joblib.load(os.path.join(model_dir, "final_scaler.pkl"))
75
+ _le_dict = joblib.load(os.path.join(model_dir, "le_dict.pkl"))
76
+ _le_target = joblib.load(os.path.join(model_dir, "le_target.pkl"))
77
+ _selected_cols = joblib.load(os.path.join(model_dir, "selected_cols.pkl"))
78
+ _poly = joblib.load(os.path.join(model_dir, "poly.pkl"))
79
+ _top_num = joblib.load(os.path.join(model_dir, "top_num.pkl"))
80
+
81
+ for candidate in [
82
+ "stacking_ensemble_best_model.pkl",
83
+ "lightgbm_best_model.pkl",
84
+ "catboost_best_model.pkl",
85
+ "xgboost_best_model.pkl",
86
+ "random_forest_best_model.pkl",
87
+ "mlp_sklearn_best_model.pkl",
88
+ ]:
89
+ p = os.path.join(model_dir, candidate)
90
+ if os.path.exists(p):
91
+ _psycho_model = joblib.load(p)
92
+ _loaded_model_name = candidate
93
+ logger.info("Loaded psychometric model: %s", candidate)
94
+ return True
95
+ logger.warning("Psychometric model pkl not found in %s", model_dir)
96
+ except Exception as exc:
97
+ logger.warning("Failed to load psychometric model: %s", exc)
98
+ return False
99
+
100
+
101
+ def _load_roberta(ckpt_path: str) -> bool:
102
+ global _roberta_model, _tokenizer
103
+
104
+ try:
105
+ import torch
106
+ import torch.nn as nn
107
+ from transformers import AutoTokenizer, AutoModel
108
+
109
+ MODEL_NAME = "roberta-base"
110
+
111
+ class RobertaClassifier(nn.Module):
112
+ def __init__(self):
113
+ super().__init__()
114
+ self.roberta = AutoModel.from_pretrained(MODEL_NAME)
115
+ self.dropout = nn.Dropout(0.3)
116
+ self.fc = nn.Linear(self.roberta.config.hidden_size, 7)
117
+ for p in self.roberta.parameters():
118
+ p.requires_grad = False
119
+ for layer in self.roberta.encoder.layer[-3:]:
120
+ for p in layer.parameters():
121
+ p.requires_grad = True
122
+
123
+ def forward(self, input_ids, attention_mask):
124
+ out = self.roberta(input_ids=input_ids,
125
+ attention_mask=attention_mask)
126
+ cls_out = out.last_hidden_state[:, 0]
127
+ return self.fc(self.dropout(cls_out))
128
+
129
+ device = "cuda" if __import__("torch").cuda.is_available() else "cpu"
130
+ model = RobertaClassifier().to(device)
131
+ model.load_state_dict(
132
+ __import__("torch").load(ckpt_path, map_location=device)
133
+ )
134
+ model.eval()
135
+ _roberta_model = model
136
+ _tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
137
+ logger.info("Loaded RoBERTa model from %s", ckpt_path)
138
+ return True
139
+ except Exception as exc:
140
+ logger.warning("Failed to load RoBERTa model: %s", exc)
141
+ return False
142
+
143
+
144
+ def init_models(psycho_model_dir: str, roberta_ckpt: str) -> None:
145
+ global DEMO_MODE
146
+ # Resolve relative paths from the project root (where app.py lives)
147
+ _root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
148
+ if psycho_model_dir and not os.path.isabs(psycho_model_dir):
149
+ psycho_model_dir = os.path.join(_root, psycho_model_dir)
150
+ if roberta_ckpt and not os.path.isabs(roberta_ckpt):
151
+ roberta_ckpt = os.path.join(_root, roberta_ckpt)
152
+ ok_p = _load_psycho(psycho_model_dir)
153
+ ok_r = _load_roberta(roberta_ckpt)
154
+ if not ok_p and not ok_r:
155
+ DEMO_MODE = True
156
+ logger.warning("Both models unavailable — running in DEMO mode.")
157
+ elif not ok_p:
158
+ logger.warning("Psychometric model unavailable — text-only mode.")
159
+ elif not ok_r:
160
+ logger.warning("RoBERTa model unavailable — psychometric-only mode.")
161
+
162
+
163
+ # ── Feature engineering (mirrors notebook) ──────────────────────────────────
164
+
165
+ def _add_interactions(X: pd.DataFrame) -> pd.DataFrame:
166
+ X = X.copy()
167
+ if {"Sleep_Duration", "Sleep_Quality"}.issubset(X.columns):
168
+ X["sleep_score"] = X["Sleep_Duration"] * X["Sleep_Quality"]
169
+ if {"Sleep_Quality", "Screen_Time"}.issubset(X.columns):
170
+ X["screen_sleep_ratio"] = X["Screen_Time"] / (X["Sleep_Quality"] + 1e-6)
171
+ if {"Physical_Activity", "Work_Hours"}.issubset(X.columns):
172
+ X["activity_work_ratio"] = X["Physical_Activity"] / (X["Work_Hours"] + 1e-6)
173
+ if {"Social_Interactions", "Travel_Time"}.issubset(X.columns):
174
+ X["social_travel"] = X["Social_Interactions"] * X["Travel_Time"]
175
+ if {"Work_Hours", "Travel_Time", "Screen_Time"}.issubset(X.columns):
176
+ X["daily_burden"] = X["Work_Hours"] + X["Travel_Time"] + X["Screen_Time"]
177
+ if {"Blood_Pressure", "Cholesterol_Level", "Blood_Sugar_Level"}.issubset(X.columns):
178
+ X["cardio_risk"] = (X["Blood_Pressure"] + X["Cholesterol_Level"]
179
+ + X["Blood_Sugar_Level"])
180
+ if {"Caffeine_Intake", "Alcohol_Intake"}.issubset(X.columns):
181
+ X["stimulant_load"] = X["Caffeine_Intake"] + 2 * X["Alcohol_Intake"]
182
+ if {"Physical_Activity", "Sleep_Duration"}.issubset(X.columns):
183
+ X["recovery_index"] = X["Physical_Activity"] + X["Sleep_Duration"]
184
+ return X
185
+
186
+
187
+ def _preprocess_psycho(raw_df: pd.DataFrame) -> np.ndarray:
188
+ """Returns proba array (N, 3) in le_target.classes_ order."""
189
+ df = raw_df.copy()
190
+ if "Stress_Detection" in df.columns:
191
+ df = df.drop(columns=["Stress_Detection"])
192
+
193
+ for col, le in _le_dict.items():
194
+ if col in df.columns:
195
+ df[col] = le.transform(df[col])
196
+
197
+ if hasattr(_base_scaler, "feature_names_in_"):
198
+ for c in _base_scaler.feature_names_in_:
199
+ if c not in df.columns:
200
+ df[c] = 0.0
201
+ df = df[_base_scaler.feature_names_in_]
202
+
203
+ df_inter = _add_interactions(df)
204
+ poly_arr = _poly.transform(df_inter[_top_num])
205
+ poly_cols = [f"poly_{i}" for i in range(poly_arr.shape[1])]
206
+ df_poly = pd.concat(
207
+ [df_inter.reset_index(drop=True),
208
+ pd.DataFrame(poly_arr, columns=poly_cols)], axis=1
209
+ )
210
+ df_sel = df_poly[_selected_cols].copy()
211
+
212
+ needs_scale = {"mlp_sklearn_best_model.pkl", "svm-rbf_best_model.pkl",
213
+ "logreg_best_model.pkl"}
214
+ if _loaded_model_name in needs_scale:
215
+ df_sel = pd.DataFrame(
216
+ _final_scaler.transform(df_sel), columns=_selected_cols
217
+ )
218
+
219
+ return _psycho_model.predict_proba(df_sel)
220
+
221
+
222
+ def _get_text_proba(text: str) -> np.ndarray:
223
+ """Returns proba array (7,) in TEXT_CLASSES order."""
224
+ import torch
225
+ import torch.nn.functional as F
226
+
227
+ device = next(_roberta_model.parameters()).device
228
+ enc = _tokenizer(
229
+ re.sub(r"[^a-zA-Z\s]", "", text.lower()),
230
+ padding="max_length", truncation=True,
231
+ max_length=128, return_tensors="pt",
232
+ )
233
+ ids = enc["input_ids"].to(device)
234
+ mask = enc["attention_mask"].to(device)
235
+ with torch.no_grad():
236
+ logits = _roberta_model(ids, mask)
237
+ return F.softmax(logits, dim=-1).cpu().numpy()[0]
238
+
239
+
240
+ # ── Public inference entry point ─────────────────────────────────────────────
241
+
242
+ def predict(
243
+ psychometric_row: dict | None = None,
244
+ text_note: str | None = None,
245
+ psycho_weight: float = 0.5,
246
+ ) -> dict:
247
+ """
248
+ Run stress prediction.
249
+
250
+ Parameters
251
+ ----------
252
+ psychometric_row : dict mapping feature-name → value (or None)
253
+ text_note : raw text string (or None)
254
+ psycho_weight : weight given to psychometric score [0..1]
255
+
256
+ Returns
257
+ -------
258
+ dict with keys:
259
+ psycho_label, psycho_score, text_label, text_score,
260
+ fused_label, fused_score, modality_used
261
+ """
262
+ if DEMO_MODE:
263
+ return _demo_predict(psychometric_row, text_note)
264
+
265
+ psycho_score = None
266
+ psycho_label = None
267
+ text_score = None
268
+ text_label = None
269
+
270
+ # ── Psychometric branch ─────────────────────────────────────────────────
271
+ if psychometric_row and _psycho_model is not None:
272
+ try:
273
+ df_row = pd.DataFrame([psychometric_row])
274
+ proba = _preprocess_psycho(df_row)[0] # shape (3,)
275
+ classes = list(_le_target.classes_)
276
+ psycho_score = sum(PSYCHO_SCORE[c] * p
277
+ for c, p in zip(classes, proba))
278
+ psycho_label = classes[int(np.argmax(proba))]
279
+ except Exception as exc:
280
+ logger.error("Psychometric inference error: %s", exc)
281
+
282
+ # ── Text branch ─────────────────────────────────────────────────────────
283
+ if text_note and text_note.strip() and _roberta_model is not None:
284
+ try:
285
+ proba = _get_text_proba(text_note) # shape (7,)
286
+ text_score = sum(TEXT_SCORE[c] * p
287
+ for c, p in zip(TEXT_CLASSES, proba))
288
+ text_label = TEXT_CLASSES[int(np.argmax(proba))]
289
+ except Exception as exc:
290
+ logger.error("Text inference error: %s", exc)
291
+
292
+ # ── Fusion ───────────────────────────────────────────────────────────────
293
+ tw = 1.0 - psycho_weight
294
+
295
+ if psycho_score is not None and text_score is not None:
296
+ fused_score = psycho_weight * psycho_score + tw * text_score
297
+ modality_used = "both"
298
+ elif psycho_score is not None:
299
+ fused_score = float(psycho_score)
300
+ modality_used = "psycho"
301
+ elif text_score is not None:
302
+ fused_score = float(text_score)
303
+ modality_used = "text"
304
+ else:
305
+ fused_score = 0.0
306
+ modality_used = "none"
307
+
308
+ fused_label = _score_to_fused(fused_score)
309
+
310
+ return {
311
+ "psycho_label": psycho_label,
312
+ "psycho_score": round(psycho_score, 4) if psycho_score is not None else None,
313
+ "text_label": text_label,
314
+ "text_score": round(text_score, 4) if text_score is not None else None,
315
+ "fused_label": fused_label,
316
+ "fused_score": round(fused_score, 4),
317
+ "modality_used": modality_used,
318
+ }
319
+
320
+
321
+ # ── Demo / fallback (no weights needed) ─────────────────────────────────────
322
+
323
+ def _demo_predict(psychometric_row, text_note) -> dict:
324
+ """Rule-based heuristic demo prediction — no ML weights required."""
325
+ score = 0.3 # baseline: mild
326
+
327
+ if psychometric_row:
328
+ sh = float(psychometric_row.get("Sleep_Duration", 7))
329
+ pa = float(psychometric_row.get("Physical_Activity", 3))
330
+ wh = float(psychometric_row.get("Work_Hours", 8))
331
+ caf = float(psychometric_row.get("Caffeine_Intake", 2))
332
+ alc = float(psychometric_row.get("Alcohol_Intake", 0))
333
+ slq = float(psychometric_row.get("Sleep_Quality", 3))
334
+
335
+ score += max(0, (8 - sh) * 0.04) # less sleep → more stress
336
+ score += max(0, (wh - 8) * 0.03) # overwork
337
+ score -= pa * 0.02 # activity lowers stress
338
+ score += caf * 0.01
339
+ score += alc * 0.02
340
+ score -= slq * 0.015
341
+ score = float(np.clip(score, 0, 1))
342
+
343
+ psycho_label = ("High" if score >= 0.6
344
+ else "Medium" if score >= 0.3 else "Low")
345
+
346
+ text_score = None
347
+ text_label = None
348
+
349
+ KEYWORDS = {
350
+ "suicid": 0.95, "depress": 0.78, "anxiet": 0.68,
351
+ "panic": 0.65, "overwhelm": 0.55, "stress": 0.45,
352
+ "tired": 0.40, "exhaust": 0.50, "happy": 0.05, "fine": 0.1,
353
+ }
354
+ if text_note and text_note.strip():
355
+ t = text_note.lower()
356
+ ts = 0.3
357
+ for kw, s in KEYWORDS.items():
358
+ if kw in t:
359
+ ts = max(ts, s)
360
+ text_score = float(np.clip(ts, 0, 1))
361
+ text_label = TEXT_CLASSES[min(
362
+ int(text_score / (1.0 / 7)),
363
+ len(TEXT_CLASSES) - 1
364
+ )]
365
+
366
+ if text_score is not None:
367
+ fused = 0.5 * score + 0.5 * text_score
368
+ modality = "both"
369
+ else:
370
+ fused = score
371
+ modality = "psycho" if psychometric_row else "none"
372
+
373
+ return {
374
+ "psycho_label": psycho_label,
375
+ "psycho_score": round(score, 4),
376
+ "text_label": text_label,
377
+ "text_score": round(text_score, 4) if text_score is not None else None,
378
+ "fused_label": _score_to_fused(fused),
379
+ "fused_score": round(fused, 4),
380
+ "modality_used": modality,
381
+ }
backend/routes/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from .auth import auth_bp
2
+ from .assessments import assess_bp
3
+
4
+ __all__ = ["auth_bp", "assess_bp"]
backend/routes/assessments.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Blueprint, request, jsonify, session
2
+ from ..models.assessment import Assessment
3
+ from .. import db
4
+ from ..ml.ml_engine import predict
5
+
6
+ assess_bp = Blueprint("assessments", __name__, url_prefix="/api/assessments")
7
+
8
+
9
+ def _require_auth():
10
+ uid = session.get("user_id")
11
+ if not uid:
12
+ return None, (jsonify({"error": "Not authenticated"}), 401)
13
+ return uid, None
14
+
15
+
16
+ @assess_bp.route("", methods=["POST"])
17
+ def create_assessment():
18
+ uid, err = _require_auth()
19
+ if err:
20
+ return err
21
+
22
+ data = request.get_json(silent=True) or {}
23
+ psychometric_row = data.get("psychometric") or None
24
+ text_note = (data.get("text_note") or "").strip() or None
25
+
26
+ if not psychometric_row and not text_note:
27
+ return jsonify({"error": "Provide at least psychometric data or a text note"}), 400
28
+
29
+ result = predict(
30
+ psychometric_row=psychometric_row,
31
+ text_note=text_note,
32
+ )
33
+
34
+ assessment = Assessment(
35
+ user_id = uid,
36
+ psychometric_data = psychometric_row,
37
+ text_note = text_note,
38
+ psycho_label = result["psycho_label"],
39
+ psycho_score = result["psycho_score"],
40
+ text_label = result["text_label"],
41
+ text_score = result["text_score"],
42
+ fused_label = result["fused_label"],
43
+ fused_score = result["fused_score"],
44
+ modality_used = result["modality_used"],
45
+ )
46
+ db.session.add(assessment)
47
+ db.session.commit()
48
+
49
+ return jsonify({
50
+ "message": "Assessment saved",
51
+ "assessment": assessment.to_dict(),
52
+ "prediction": result,
53
+ }), 201
54
+
55
+
56
+ @assess_bp.route("", methods=["GET"])
57
+ def list_assessments():
58
+ uid, err = _require_auth()
59
+ if err:
60
+ return err
61
+
62
+ page = max(1, request.args.get("page", 1, type=int))
63
+ per_page = min(50, request.args.get("per_page", 20, type=int))
64
+
65
+ q = (
66
+ Assessment.query
67
+ .filter_by(user_id=uid)
68
+ .order_by(Assessment.created_at.desc())
69
+ .paginate(page=page, per_page=per_page, error_out=False)
70
+ )
71
+
72
+ return jsonify({
73
+ "assessments": [a.to_dict() for a in q.items],
74
+ "total": q.total,
75
+ "page": q.page,
76
+ "pages": q.pages,
77
+ }), 200
78
+
79
+
80
+ @assess_bp.route("/<int:aid>", methods=["GET"])
81
+ def get_assessment(aid: int):
82
+ uid, err = _require_auth()
83
+ if err:
84
+ return err
85
+
86
+ a = Assessment.query.filter_by(id=aid, user_id=uid).first_or_404()
87
+ return jsonify({"assessment": a.to_dict()}), 200
88
+
89
+
90
+ @assess_bp.route("/summary", methods=["GET"])
91
+ def summary():
92
+ """Aggregated stats for the dashboard."""
93
+ uid, err = _require_auth()
94
+ if err:
95
+ return err
96
+
97
+ rows = (
98
+ Assessment.query
99
+ .filter_by(user_id=uid)
100
+ .order_by(Assessment.created_at.asc())
101
+ .all()
102
+ )
103
+
104
+ if not rows:
105
+ return jsonify({"summary": {}, "timeline": []}), 200
106
+
107
+ scores = [r.fused_score for r in rows if r.fused_score is not None]
108
+ labels = [r.fused_label for r in rows if r.fused_label]
109
+
110
+ from collections import Counter
111
+ label_counts = Counter(labels)
112
+
113
+ timeline = [
114
+ {
115
+ "date": r.created_at.strftime("%Y-%m-%d %H:%M"),
116
+ "fused_score": r.fused_score,
117
+ "fused_label": r.fused_label,
118
+ "id": r.id,
119
+ }
120
+ for r in rows
121
+ ]
122
+
123
+ summary_data = {
124
+ "total_assessments": len(rows),
125
+ "avg_score": round(sum(scores) / len(scores), 4) if scores else 0,
126
+ "latest_label": rows[-1].fused_label if rows else None,
127
+ "latest_score": rows[-1].fused_score if rows else None,
128
+ "label_distribution": dict(label_counts),
129
+ }
130
+
131
+ return jsonify({"summary": summary_data, "timeline": timeline}), 200
backend/routes/auth.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Blueprint, request, jsonify, session
2
+ from ..models.user import User
3
+ from .. import db
4
+
5
+ auth_bp = Blueprint("auth", __name__, url_prefix="/api/auth")
6
+
7
+
8
+ @auth_bp.route("/signup", methods=["POST"])
9
+ def signup():
10
+ data = request.get_json(silent=True) or {}
11
+ username = (data.get("username") or "").strip()
12
+ email = (data.get("email") or "").strip().lower()
13
+ password = data.get("password") or ""
14
+
15
+ if not username or not email or not password:
16
+ return jsonify({"error": "username, email and password are required"}), 400
17
+
18
+ if len(password) < 8:
19
+ return jsonify({"error": "Password must be at least 8 characters"}), 400
20
+
21
+ if User.query.filter(
22
+ (User.username == username) | (User.email == email)
23
+ ).first():
24
+ return jsonify({"error": "Username or email already exists"}), 409
25
+
26
+ user = User(username=username, email=email)
27
+ user.set_password(password)
28
+ db.session.add(user)
29
+ db.session.commit()
30
+
31
+ session["user_id"] = user.id
32
+ return jsonify({"message": "Account created", "user": user.to_dict()}), 201
33
+
34
+
35
+ @auth_bp.route("/login", methods=["POST"])
36
+ def login():
37
+ data = request.get_json(silent=True) or {}
38
+ identity = (data.get("email") or data.get("username") or "").strip()
39
+ password = data.get("password") or ""
40
+
41
+ if not identity or not password:
42
+ return jsonify({"error": "Email/username and password are required"}), 400
43
+
44
+ user = User.query.filter(
45
+ (User.email == identity.lower()) | (User.username == identity)
46
+ ).first()
47
+
48
+ if not user or not user.check_password(password):
49
+ return jsonify({"error": "Invalid credentials"}), 401
50
+
51
+ session["user_id"] = user.id
52
+ return jsonify({"message": "Logged in", "user": user.to_dict()}), 200
53
+
54
+
55
+ @auth_bp.route("/logout", methods=["POST"])
56
+ def logout():
57
+ session.pop("user_id", None)
58
+ return jsonify({"message": "Logged out"}), 200
59
+
60
+
61
+ @auth_bp.route("/me", methods=["GET"])
62
+ def me():
63
+ uid = session.get("user_id")
64
+ if not uid:
65
+ return jsonify({"error": "Not authenticated"}), 401
66
+ user = User.query.get(uid)
67
+ if not user:
68
+ return jsonify({"error": "User not found"}), 404
69
+ return jsonify({"user": user.to_dict()}), 200
backend/routes/gratitude.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Blueprint, request, jsonify, session
2
+ from ..models.gratitude import GratitudeEntry
3
+ from .. import db
4
+
5
+ gratitude_bp = Blueprint("gratitude", __name__, url_prefix="/api/gratitude")
6
+
7
+ _MAX_CONTENT = 2000
8
+ _PER_PAGE = 10
9
+
10
+
11
+ def _uid():
12
+ return session.get("user_id")
13
+
14
+
15
+ @gratitude_bp.route("", methods=["POST"])
16
+ def create_entry():
17
+ uid = _uid()
18
+ if not uid:
19
+ return jsonify({"error": "Not authenticated"}), 401
20
+
21
+ data = request.get_json(silent=True) or {}
22
+ content = (data.get("content") or "").strip()[:_MAX_CONTENT]
23
+ mood = (data.get("mood") or "").strip()[:32] or None
24
+ items = data.get("items")
25
+
26
+ if not content and not items:
27
+ return jsonify({"error": "content or items required"}), 400
28
+
29
+ # Sanitise items list
30
+ if items is not None:
31
+ if not isinstance(items, list):
32
+ return jsonify({"error": "items must be a list"}), 400
33
+ items = [str(i).strip()[:300] for i in items if str(i).strip()][:10]
34
+
35
+ entry = GratitudeEntry(user_id=uid, content=content, mood=mood, items=items)
36
+ db.session.add(entry)
37
+ db.session.commit()
38
+ return jsonify({"message": "Entry saved", "entry": entry.to_dict()}), 201
39
+
40
+
41
+ @gratitude_bp.route("", methods=["GET"])
42
+ def list_entries():
43
+ uid = _uid()
44
+ if not uid:
45
+ return jsonify({"error": "Not authenticated"}), 401
46
+
47
+ page = max(1, int(request.args.get("page", 1)))
48
+ q = (GratitudeEntry.query
49
+ .filter_by(user_id=uid)
50
+ .order_by(GratitudeEntry.created_at.desc())
51
+ .paginate(page=page, per_page=_PER_PAGE, error_out=False))
52
+
53
+ return jsonify({
54
+ "entries": [e.to_dict() for e in q.items],
55
+ "total": q.total,
56
+ "page": page,
57
+ "pages": q.pages,
58
+ "has_next": q.has_next,
59
+ "has_prev": q.has_prev,
60
+ }), 200
61
+
62
+
63
+ @gratitude_bp.route("/<int:entry_id>", methods=["DELETE"])
64
+ def delete_entry(entry_id):
65
+ uid = _uid()
66
+ if not uid:
67
+ return jsonify({"error": "Not authenticated"}), 401
68
+
69
+ entry = GratitudeEntry.query.filter_by(id=entry_id, user_id=uid).first()
70
+ if not entry:
71
+ return jsonify({"error": "Entry not found"}), 404
72
+
73
+ db.session.delete(entry)
74
+ db.session.commit()
75
+ return jsonify({"message": "Deleted"}), 200
backend/routes/profile.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import base64
2
+ import imghdr
3
+ from flask import Blueprint, request, jsonify, session
4
+ from ..models.user import User
5
+ from .. import db
6
+
7
+ profile_bp = Blueprint("profile", __name__, url_prefix="/api/profile")
8
+
9
+ _MAX_AVATAR_BYTES = 2 * 1024 * 1024 # 2 MB limit
10
+
11
+ ALLOWED_GENDERS = {"male", "female", "non-binary", "prefer not to say", "other"}
12
+ ALLOWED_WORKING = {
13
+ "employed full-time",
14
+ "employed part-time",
15
+ "self-employed",
16
+ "student",
17
+ "unemployed",
18
+ "homemaker",
19
+ "retired",
20
+ "prefer not to say",
21
+ }
22
+
23
+
24
+ def _current_user():
25
+ uid = session.get("user_id")
26
+ if not uid:
27
+ return None
28
+ return User.query.get(uid)
29
+
30
+
31
+ @profile_bp.route("", methods=["GET"])
32
+ def get_profile():
33
+ user = _current_user()
34
+ if not user:
35
+ return jsonify({"error": "Not authenticated"}), 401
36
+ return jsonify({"profile": user.to_dict()}), 200
37
+
38
+
39
+ @profile_bp.route("", methods=["PUT"])
40
+ def update_profile():
41
+ user = _current_user()
42
+ if not user:
43
+ return jsonify({"error": "Not authenticated"}), 401
44
+
45
+ data = request.get_json(silent=True) or {}
46
+
47
+ # bio
48
+ bio = data.get("bio")
49
+ if bio is not None:
50
+ bio = str(bio).strip()[:500]
51
+ user.bio = bio or None
52
+
53
+ # gender
54
+ gender = data.get("gender")
55
+ if gender is not None:
56
+ gender = str(gender).strip().lower()
57
+ if gender and gender not in ALLOWED_GENDERS:
58
+ return jsonify({"error": "Invalid gender value"}), 400
59
+ user.gender = gender or None
60
+
61
+ # working_status
62
+ ws = data.get("working_status")
63
+ if ws is not None:
64
+ ws = str(ws).strip().lower()
65
+ if ws and ws not in ALLOWED_WORKING:
66
+ return jsonify({"error": "Invalid working status"}), 400
67
+ user.working_status = ws or None
68
+
69
+ # dob (YYYY-MM-DD)
70
+ dob = data.get("dob")
71
+ if dob is not None:
72
+ dob = str(dob).strip()
73
+ if dob:
74
+ # basic format validation — no future dates, sensible range
75
+ import re
76
+ if not re.match(r"^\d{4}-\d{2}-\d{2}$", dob):
77
+ return jsonify({"error": "dob must be YYYY-MM-DD"}), 400
78
+ user.dob = dob or None
79
+
80
+ # is_anonymous
81
+ anon = data.get("is_anonymous")
82
+ if anon is not None:
83
+ user.is_anonymous = bool(anon)
84
+
85
+ db.session.commit()
86
+ return jsonify({"message": "Profile updated", "profile": user.to_dict()}), 200
87
+
88
+
89
+ @profile_bp.route("/avatar", methods=["POST"])
90
+ def upload_avatar():
91
+ """Accept a base64 data-url in JSON body: { "avatar": "data:image/png;base64,..." }"""
92
+ user = _current_user()
93
+ if not user:
94
+ return jsonify({"error": "Not authenticated"}), 401
95
+
96
+ data = request.get_json(silent=True) or {}
97
+ avatar = data.get("avatar", "")
98
+
99
+ if not avatar:
100
+ user.avatar = None
101
+ db.session.commit()
102
+ return jsonify({"message": "Avatar removed"}), 200
103
+
104
+ # Validate it is a data-url
105
+ if not avatar.startswith("data:image/"):
106
+ return jsonify({"error": "avatar must be an image data-url"}), 400
107
+
108
+ # Check size (base64 overhead ~33 %)
109
+ try:
110
+ header, b64data = avatar.split(",", 1)
111
+ raw = base64.b64decode(b64data)
112
+ except Exception:
113
+ return jsonify({"error": "Invalid base64 data"}), 400
114
+
115
+ if len(raw) > _MAX_AVATAR_BYTES:
116
+ return jsonify({"error": "Image too large (max 2 MB)"}), 413
117
+
118
+ # Validate actual image type
119
+ img_type = imghdr.what(None, h=raw)
120
+ if img_type not in ("jpeg", "png", "gif", "webp"):
121
+ return jsonify({"error": "Unsupported image format"}), 415
122
+
123
+ user.avatar = avatar
124
+ db.session.commit()
125
+ return jsonify({"message": "Avatar updated", "avatar": user.avatar}), 200
frontend/.tool-versions ADDED
@@ -0,0 +1 @@
 
 
1
+ nodejs 20.18.1
frontend/index.html ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>BREATHE — Stress Intelligence</title>
7
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ <script type="module" src="/src/main.jsx"></script>
14
+ </body>
15
+ </html>
frontend/package-lock.json ADDED
@@ -0,0 +1,2097 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "breathe-frontend",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "breathe-frontend",
9
+ "version": "1.0.0",
10
+ "dependencies": {
11
+ "react": "^18.3.0",
12
+ "react-dom": "^18.3.0",
13
+ "react-router-dom": "^6.23.0",
14
+ "recharts": "^2.12.0"
15
+ },
16
+ "devDependencies": {
17
+ "@vitejs/plugin-react": "^4.7.0",
18
+ "vite": "^5.4.21"
19
+ }
20
+ },
21
+ "node_modules/@babel/code-frame": {
22
+ "version": "7.29.0",
23
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz",
24
+ "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==",
25
+ "dev": true,
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "@babel/helper-validator-identifier": "^7.28.5",
29
+ "js-tokens": "^4.0.0",
30
+ "picocolors": "^1.1.1"
31
+ },
32
+ "engines": {
33
+ "node": ">=6.9.0"
34
+ }
35
+ },
36
+ "node_modules/@babel/compat-data": {
37
+ "version": "7.29.3",
38
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.3.tgz",
39
+ "integrity": "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==",
40
+ "dev": true,
41
+ "license": "MIT",
42
+ "engines": {
43
+ "node": ">=6.9.0"
44
+ }
45
+ },
46
+ "node_modules/@babel/core": {
47
+ "version": "7.29.0",
48
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
49
+ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
50
+ "dev": true,
51
+ "license": "MIT",
52
+ "dependencies": {
53
+ "@babel/code-frame": "^7.29.0",
54
+ "@babel/generator": "^7.29.0",
55
+ "@babel/helper-compilation-targets": "^7.28.6",
56
+ "@babel/helper-module-transforms": "^7.28.6",
57
+ "@babel/helpers": "^7.28.6",
58
+ "@babel/parser": "^7.29.0",
59
+ "@babel/template": "^7.28.6",
60
+ "@babel/traverse": "^7.29.0",
61
+ "@babel/types": "^7.29.0",
62
+ "@jridgewell/remapping": "^2.3.5",
63
+ "convert-source-map": "^2.0.0",
64
+ "debug": "^4.1.0",
65
+ "gensync": "^1.0.0-beta.2",
66
+ "json5": "^2.2.3",
67
+ "semver": "^6.3.1"
68
+ },
69
+ "engines": {
70
+ "node": ">=6.9.0"
71
+ },
72
+ "funding": {
73
+ "type": "opencollective",
74
+ "url": "https://opencollective.com/babel"
75
+ }
76
+ },
77
+ "node_modules/@babel/generator": {
78
+ "version": "7.29.1",
79
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz",
80
+ "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==",
81
+ "dev": true,
82
+ "license": "MIT",
83
+ "dependencies": {
84
+ "@babel/parser": "^7.29.0",
85
+ "@babel/types": "^7.29.0",
86
+ "@jridgewell/gen-mapping": "^0.3.12",
87
+ "@jridgewell/trace-mapping": "^0.3.28",
88
+ "jsesc": "^3.0.2"
89
+ },
90
+ "engines": {
91
+ "node": ">=6.9.0"
92
+ }
93
+ },
94
+ "node_modules/@babel/helper-compilation-targets": {
95
+ "version": "7.28.6",
96
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",
97
+ "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",
98
+ "dev": true,
99
+ "license": "MIT",
100
+ "dependencies": {
101
+ "@babel/compat-data": "^7.28.6",
102
+ "@babel/helper-validator-option": "^7.27.1",
103
+ "browserslist": "^4.24.0",
104
+ "lru-cache": "^5.1.1",
105
+ "semver": "^6.3.1"
106
+ },
107
+ "engines": {
108
+ "node": ">=6.9.0"
109
+ }
110
+ },
111
+ "node_modules/@babel/helper-globals": {
112
+ "version": "7.28.0",
113
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz",
114
+ "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==",
115
+ "dev": true,
116
+ "license": "MIT",
117
+ "engines": {
118
+ "node": ">=6.9.0"
119
+ }
120
+ },
121
+ "node_modules/@babel/helper-module-imports": {
122
+ "version": "7.28.6",
123
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz",
124
+ "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==",
125
+ "dev": true,
126
+ "license": "MIT",
127
+ "dependencies": {
128
+ "@babel/traverse": "^7.28.6",
129
+ "@babel/types": "^7.28.6"
130
+ },
131
+ "engines": {
132
+ "node": ">=6.9.0"
133
+ }
134
+ },
135
+ "node_modules/@babel/helper-module-transforms": {
136
+ "version": "7.28.6",
137
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz",
138
+ "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==",
139
+ "dev": true,
140
+ "license": "MIT",
141
+ "dependencies": {
142
+ "@babel/helper-module-imports": "^7.28.6",
143
+ "@babel/helper-validator-identifier": "^7.28.5",
144
+ "@babel/traverse": "^7.28.6"
145
+ },
146
+ "engines": {
147
+ "node": ">=6.9.0"
148
+ },
149
+ "peerDependencies": {
150
+ "@babel/core": "^7.0.0"
151
+ }
152
+ },
153
+ "node_modules/@babel/helper-plugin-utils": {
154
+ "version": "7.28.6",
155
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz",
156
+ "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==",
157
+ "dev": true,
158
+ "license": "MIT",
159
+ "engines": {
160
+ "node": ">=6.9.0"
161
+ }
162
+ },
163
+ "node_modules/@babel/helper-string-parser": {
164
+ "version": "7.27.1",
165
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
166
+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
167
+ "dev": true,
168
+ "license": "MIT",
169
+ "engines": {
170
+ "node": ">=6.9.0"
171
+ }
172
+ },
173
+ "node_modules/@babel/helper-validator-identifier": {
174
+ "version": "7.28.5",
175
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",
176
+ "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",
177
+ "dev": true,
178
+ "license": "MIT",
179
+ "engines": {
180
+ "node": ">=6.9.0"
181
+ }
182
+ },
183
+ "node_modules/@babel/helper-validator-option": {
184
+ "version": "7.27.1",
185
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
186
+ "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
187
+ "dev": true,
188
+ "license": "MIT",
189
+ "engines": {
190
+ "node": ">=6.9.0"
191
+ }
192
+ },
193
+ "node_modules/@babel/helpers": {
194
+ "version": "7.29.2",
195
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz",
196
+ "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==",
197
+ "dev": true,
198
+ "license": "MIT",
199
+ "dependencies": {
200
+ "@babel/template": "^7.28.6",
201
+ "@babel/types": "^7.29.0"
202
+ },
203
+ "engines": {
204
+ "node": ">=6.9.0"
205
+ }
206
+ },
207
+ "node_modules/@babel/parser": {
208
+ "version": "7.29.3",
209
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz",
210
+ "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==",
211
+ "dev": true,
212
+ "license": "MIT",
213
+ "dependencies": {
214
+ "@babel/types": "^7.29.0"
215
+ },
216
+ "bin": {
217
+ "parser": "bin/babel-parser.js"
218
+ },
219
+ "engines": {
220
+ "node": ">=6.0.0"
221
+ }
222
+ },
223
+ "node_modules/@babel/plugin-transform-react-jsx-self": {
224
+ "version": "7.27.1",
225
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz",
226
+ "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==",
227
+ "dev": true,
228
+ "license": "MIT",
229
+ "dependencies": {
230
+ "@babel/helper-plugin-utils": "^7.27.1"
231
+ },
232
+ "engines": {
233
+ "node": ">=6.9.0"
234
+ },
235
+ "peerDependencies": {
236
+ "@babel/core": "^7.0.0-0"
237
+ }
238
+ },
239
+ "node_modules/@babel/plugin-transform-react-jsx-source": {
240
+ "version": "7.27.1",
241
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz",
242
+ "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==",
243
+ "dev": true,
244
+ "license": "MIT",
245
+ "dependencies": {
246
+ "@babel/helper-plugin-utils": "^7.27.1"
247
+ },
248
+ "engines": {
249
+ "node": ">=6.9.0"
250
+ },
251
+ "peerDependencies": {
252
+ "@babel/core": "^7.0.0-0"
253
+ }
254
+ },
255
+ "node_modules/@babel/runtime": {
256
+ "version": "7.29.2",
257
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
258
+ "integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
259
+ "license": "MIT",
260
+ "engines": {
261
+ "node": ">=6.9.0"
262
+ }
263
+ },
264
+ "node_modules/@babel/template": {
265
+ "version": "7.28.6",
266
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",
267
+ "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==",
268
+ "dev": true,
269
+ "license": "MIT",
270
+ "dependencies": {
271
+ "@babel/code-frame": "^7.28.6",
272
+ "@babel/parser": "^7.28.6",
273
+ "@babel/types": "^7.28.6"
274
+ },
275
+ "engines": {
276
+ "node": ">=6.9.0"
277
+ }
278
+ },
279
+ "node_modules/@babel/traverse": {
280
+ "version": "7.29.0",
281
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz",
282
+ "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==",
283
+ "dev": true,
284
+ "license": "MIT",
285
+ "dependencies": {
286
+ "@babel/code-frame": "^7.29.0",
287
+ "@babel/generator": "^7.29.0",
288
+ "@babel/helper-globals": "^7.28.0",
289
+ "@babel/parser": "^7.29.0",
290
+ "@babel/template": "^7.28.6",
291
+ "@babel/types": "^7.29.0",
292
+ "debug": "^4.3.1"
293
+ },
294
+ "engines": {
295
+ "node": ">=6.9.0"
296
+ }
297
+ },
298
+ "node_modules/@babel/types": {
299
+ "version": "7.29.0",
300
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",
301
+ "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",
302
+ "dev": true,
303
+ "license": "MIT",
304
+ "dependencies": {
305
+ "@babel/helper-string-parser": "^7.27.1",
306
+ "@babel/helper-validator-identifier": "^7.28.5"
307
+ },
308
+ "engines": {
309
+ "node": ">=6.9.0"
310
+ }
311
+ },
312
+ "node_modules/@esbuild/aix-ppc64": {
313
+ "version": "0.21.5",
314
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
315
+ "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
316
+ "cpu": [
317
+ "ppc64"
318
+ ],
319
+ "dev": true,
320
+ "license": "MIT",
321
+ "optional": true,
322
+ "os": [
323
+ "aix"
324
+ ],
325
+ "engines": {
326
+ "node": ">=12"
327
+ }
328
+ },
329
+ "node_modules/@esbuild/android-arm": {
330
+ "version": "0.21.5",
331
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
332
+ "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
333
+ "cpu": [
334
+ "arm"
335
+ ],
336
+ "dev": true,
337
+ "license": "MIT",
338
+ "optional": true,
339
+ "os": [
340
+ "android"
341
+ ],
342
+ "engines": {
343
+ "node": ">=12"
344
+ }
345
+ },
346
+ "node_modules/@esbuild/android-arm64": {
347
+ "version": "0.21.5",
348
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
349
+ "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
350
+ "cpu": [
351
+ "arm64"
352
+ ],
353
+ "dev": true,
354
+ "license": "MIT",
355
+ "optional": true,
356
+ "os": [
357
+ "android"
358
+ ],
359
+ "engines": {
360
+ "node": ">=12"
361
+ }
362
+ },
363
+ "node_modules/@esbuild/android-x64": {
364
+ "version": "0.21.5",
365
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
366
+ "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
367
+ "cpu": [
368
+ "x64"
369
+ ],
370
+ "dev": true,
371
+ "license": "MIT",
372
+ "optional": true,
373
+ "os": [
374
+ "android"
375
+ ],
376
+ "engines": {
377
+ "node": ">=12"
378
+ }
379
+ },
380
+ "node_modules/@esbuild/darwin-arm64": {
381
+ "version": "0.21.5",
382
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
383
+ "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
384
+ "cpu": [
385
+ "arm64"
386
+ ],
387
+ "dev": true,
388
+ "license": "MIT",
389
+ "optional": true,
390
+ "os": [
391
+ "darwin"
392
+ ],
393
+ "engines": {
394
+ "node": ">=12"
395
+ }
396
+ },
397
+ "node_modules/@esbuild/darwin-x64": {
398
+ "version": "0.21.5",
399
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
400
+ "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
401
+ "cpu": [
402
+ "x64"
403
+ ],
404
+ "dev": true,
405
+ "license": "MIT",
406
+ "optional": true,
407
+ "os": [
408
+ "darwin"
409
+ ],
410
+ "engines": {
411
+ "node": ">=12"
412
+ }
413
+ },
414
+ "node_modules/@esbuild/freebsd-arm64": {
415
+ "version": "0.21.5",
416
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
417
+ "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
418
+ "cpu": [
419
+ "arm64"
420
+ ],
421
+ "dev": true,
422
+ "license": "MIT",
423
+ "optional": true,
424
+ "os": [
425
+ "freebsd"
426
+ ],
427
+ "engines": {
428
+ "node": ">=12"
429
+ }
430
+ },
431
+ "node_modules/@esbuild/freebsd-x64": {
432
+ "version": "0.21.5",
433
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
434
+ "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
435
+ "cpu": [
436
+ "x64"
437
+ ],
438
+ "dev": true,
439
+ "license": "MIT",
440
+ "optional": true,
441
+ "os": [
442
+ "freebsd"
443
+ ],
444
+ "engines": {
445
+ "node": ">=12"
446
+ }
447
+ },
448
+ "node_modules/@esbuild/linux-arm": {
449
+ "version": "0.21.5",
450
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
451
+ "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
452
+ "cpu": [
453
+ "arm"
454
+ ],
455
+ "dev": true,
456
+ "license": "MIT",
457
+ "optional": true,
458
+ "os": [
459
+ "linux"
460
+ ],
461
+ "engines": {
462
+ "node": ">=12"
463
+ }
464
+ },
465
+ "node_modules/@esbuild/linux-arm64": {
466
+ "version": "0.21.5",
467
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
468
+ "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
469
+ "cpu": [
470
+ "arm64"
471
+ ],
472
+ "dev": true,
473
+ "license": "MIT",
474
+ "optional": true,
475
+ "os": [
476
+ "linux"
477
+ ],
478
+ "engines": {
479
+ "node": ">=12"
480
+ }
481
+ },
482
+ "node_modules/@esbuild/linux-ia32": {
483
+ "version": "0.21.5",
484
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
485
+ "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
486
+ "cpu": [
487
+ "ia32"
488
+ ],
489
+ "dev": true,
490
+ "license": "MIT",
491
+ "optional": true,
492
+ "os": [
493
+ "linux"
494
+ ],
495
+ "engines": {
496
+ "node": ">=12"
497
+ }
498
+ },
499
+ "node_modules/@esbuild/linux-loong64": {
500
+ "version": "0.21.5",
501
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
502
+ "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
503
+ "cpu": [
504
+ "loong64"
505
+ ],
506
+ "dev": true,
507
+ "license": "MIT",
508
+ "optional": true,
509
+ "os": [
510
+ "linux"
511
+ ],
512
+ "engines": {
513
+ "node": ">=12"
514
+ }
515
+ },
516
+ "node_modules/@esbuild/linux-mips64el": {
517
+ "version": "0.21.5",
518
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
519
+ "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
520
+ "cpu": [
521
+ "mips64el"
522
+ ],
523
+ "dev": true,
524
+ "license": "MIT",
525
+ "optional": true,
526
+ "os": [
527
+ "linux"
528
+ ],
529
+ "engines": {
530
+ "node": ">=12"
531
+ }
532
+ },
533
+ "node_modules/@esbuild/linux-ppc64": {
534
+ "version": "0.21.5",
535
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
536
+ "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
537
+ "cpu": [
538
+ "ppc64"
539
+ ],
540
+ "dev": true,
541
+ "license": "MIT",
542
+ "optional": true,
543
+ "os": [
544
+ "linux"
545
+ ],
546
+ "engines": {
547
+ "node": ">=12"
548
+ }
549
+ },
550
+ "node_modules/@esbuild/linux-riscv64": {
551
+ "version": "0.21.5",
552
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
553
+ "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
554
+ "cpu": [
555
+ "riscv64"
556
+ ],
557
+ "dev": true,
558
+ "license": "MIT",
559
+ "optional": true,
560
+ "os": [
561
+ "linux"
562
+ ],
563
+ "engines": {
564
+ "node": ">=12"
565
+ }
566
+ },
567
+ "node_modules/@esbuild/linux-s390x": {
568
+ "version": "0.21.5",
569
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
570
+ "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
571
+ "cpu": [
572
+ "s390x"
573
+ ],
574
+ "dev": true,
575
+ "license": "MIT",
576
+ "optional": true,
577
+ "os": [
578
+ "linux"
579
+ ],
580
+ "engines": {
581
+ "node": ">=12"
582
+ }
583
+ },
584
+ "node_modules/@esbuild/linux-x64": {
585
+ "version": "0.21.5",
586
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
587
+ "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
588
+ "cpu": [
589
+ "x64"
590
+ ],
591
+ "dev": true,
592
+ "license": "MIT",
593
+ "optional": true,
594
+ "os": [
595
+ "linux"
596
+ ],
597
+ "engines": {
598
+ "node": ">=12"
599
+ }
600
+ },
601
+ "node_modules/@esbuild/netbsd-x64": {
602
+ "version": "0.21.5",
603
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
604
+ "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
605
+ "cpu": [
606
+ "x64"
607
+ ],
608
+ "dev": true,
609
+ "license": "MIT",
610
+ "optional": true,
611
+ "os": [
612
+ "netbsd"
613
+ ],
614
+ "engines": {
615
+ "node": ">=12"
616
+ }
617
+ },
618
+ "node_modules/@esbuild/openbsd-x64": {
619
+ "version": "0.21.5",
620
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
621
+ "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
622
+ "cpu": [
623
+ "x64"
624
+ ],
625
+ "dev": true,
626
+ "license": "MIT",
627
+ "optional": true,
628
+ "os": [
629
+ "openbsd"
630
+ ],
631
+ "engines": {
632
+ "node": ">=12"
633
+ }
634
+ },
635
+ "node_modules/@esbuild/sunos-x64": {
636
+ "version": "0.21.5",
637
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
638
+ "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
639
+ "cpu": [
640
+ "x64"
641
+ ],
642
+ "dev": true,
643
+ "license": "MIT",
644
+ "optional": true,
645
+ "os": [
646
+ "sunos"
647
+ ],
648
+ "engines": {
649
+ "node": ">=12"
650
+ }
651
+ },
652
+ "node_modules/@esbuild/win32-arm64": {
653
+ "version": "0.21.5",
654
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
655
+ "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
656
+ "cpu": [
657
+ "arm64"
658
+ ],
659
+ "dev": true,
660
+ "license": "MIT",
661
+ "optional": true,
662
+ "os": [
663
+ "win32"
664
+ ],
665
+ "engines": {
666
+ "node": ">=12"
667
+ }
668
+ },
669
+ "node_modules/@esbuild/win32-ia32": {
670
+ "version": "0.21.5",
671
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
672
+ "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
673
+ "cpu": [
674
+ "ia32"
675
+ ],
676
+ "dev": true,
677
+ "license": "MIT",
678
+ "optional": true,
679
+ "os": [
680
+ "win32"
681
+ ],
682
+ "engines": {
683
+ "node": ">=12"
684
+ }
685
+ },
686
+ "node_modules/@esbuild/win32-x64": {
687
+ "version": "0.21.5",
688
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
689
+ "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
690
+ "cpu": [
691
+ "x64"
692
+ ],
693
+ "dev": true,
694
+ "license": "MIT",
695
+ "optional": true,
696
+ "os": [
697
+ "win32"
698
+ ],
699
+ "engines": {
700
+ "node": ">=12"
701
+ }
702
+ },
703
+ "node_modules/@jridgewell/gen-mapping": {
704
+ "version": "0.3.13",
705
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
706
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
707
+ "dev": true,
708
+ "license": "MIT",
709
+ "dependencies": {
710
+ "@jridgewell/sourcemap-codec": "^1.5.0",
711
+ "@jridgewell/trace-mapping": "^0.3.24"
712
+ }
713
+ },
714
+ "node_modules/@jridgewell/remapping": {
715
+ "version": "2.3.5",
716
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
717
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
718
+ "dev": true,
719
+ "license": "MIT",
720
+ "dependencies": {
721
+ "@jridgewell/gen-mapping": "^0.3.5",
722
+ "@jridgewell/trace-mapping": "^0.3.24"
723
+ }
724
+ },
725
+ "node_modules/@jridgewell/resolve-uri": {
726
+ "version": "3.1.2",
727
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
728
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
729
+ "dev": true,
730
+ "license": "MIT",
731
+ "engines": {
732
+ "node": ">=6.0.0"
733
+ }
734
+ },
735
+ "node_modules/@jridgewell/sourcemap-codec": {
736
+ "version": "1.5.5",
737
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
738
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
739
+ "dev": true,
740
+ "license": "MIT"
741
+ },
742
+ "node_modules/@jridgewell/trace-mapping": {
743
+ "version": "0.3.31",
744
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
745
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
746
+ "dev": true,
747
+ "license": "MIT",
748
+ "dependencies": {
749
+ "@jridgewell/resolve-uri": "^3.1.0",
750
+ "@jridgewell/sourcemap-codec": "^1.4.14"
751
+ }
752
+ },
753
+ "node_modules/@remix-run/router": {
754
+ "version": "1.23.2",
755
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz",
756
+ "integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==",
757
+ "license": "MIT",
758
+ "engines": {
759
+ "node": ">=14.0.0"
760
+ }
761
+ },
762
+ "node_modules/@rolldown/pluginutils": {
763
+ "version": "1.0.0-beta.27",
764
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
765
+ "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
766
+ "dev": true,
767
+ "license": "MIT"
768
+ },
769
+ "node_modules/@rollup/rollup-android-arm-eabi": {
770
+ "version": "4.60.2",
771
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.2.tgz",
772
+ "integrity": "sha512-dnlp69efPPg6Uaw2dVqzWRfAWRnYVb1XJ8CyyhIbZeaq4CA5/mLeZ1IEt9QqQxmbdvagjLIm2ZL8BxXv5lH4Yw==",
773
+ "cpu": [
774
+ "arm"
775
+ ],
776
+ "dev": true,
777
+ "license": "MIT",
778
+ "optional": true,
779
+ "os": [
780
+ "android"
781
+ ]
782
+ },
783
+ "node_modules/@rollup/rollup-android-arm64": {
784
+ "version": "4.60.2",
785
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.2.tgz",
786
+ "integrity": "sha512-OqZTwDRDchGRHHm/hwLOL7uVPB9aUvI0am/eQuWMNyFHf5PSEQmyEeYYheA0EPPKUO/l0uigCp+iaTjoLjVoHg==",
787
+ "cpu": [
788
+ "arm64"
789
+ ],
790
+ "dev": true,
791
+ "license": "MIT",
792
+ "optional": true,
793
+ "os": [
794
+ "android"
795
+ ]
796
+ },
797
+ "node_modules/@rollup/rollup-darwin-arm64": {
798
+ "version": "4.60.2",
799
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.2.tgz",
800
+ "integrity": "sha512-UwRE7CGpvSVEQS8gUMBe1uADWjNnVgP3Iusyda1nSRwNDCsRjnGc7w6El6WLQsXmZTbLZx9cecegumcitNfpmA==",
801
+ "cpu": [
802
+ "arm64"
803
+ ],
804
+ "dev": true,
805
+ "license": "MIT",
806
+ "optional": true,
807
+ "os": [
808
+ "darwin"
809
+ ]
810
+ },
811
+ "node_modules/@rollup/rollup-darwin-x64": {
812
+ "version": "4.60.2",
813
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.2.tgz",
814
+ "integrity": "sha512-gjEtURKLCC5VXm1I+2i1u9OhxFsKAQJKTVB8WvDAHF+oZlq0GTVFOlTlO1q3AlCTE/DF32c16ESvfgqR7343/g==",
815
+ "cpu": [
816
+ "x64"
817
+ ],
818
+ "dev": true,
819
+ "license": "MIT",
820
+ "optional": true,
821
+ "os": [
822
+ "darwin"
823
+ ]
824
+ },
825
+ "node_modules/@rollup/rollup-freebsd-arm64": {
826
+ "version": "4.60.2",
827
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.2.tgz",
828
+ "integrity": "sha512-Bcl6CYDeAgE70cqZaMojOi/eK63h5Me97ZqAQoh77VPjMysA/4ORQBRGo3rRy45x4MzVlU9uZxs8Uwy7ZaKnBw==",
829
+ "cpu": [
830
+ "arm64"
831
+ ],
832
+ "dev": true,
833
+ "license": "MIT",
834
+ "optional": true,
835
+ "os": [
836
+ "freebsd"
837
+ ]
838
+ },
839
+ "node_modules/@rollup/rollup-freebsd-x64": {
840
+ "version": "4.60.2",
841
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.2.tgz",
842
+ "integrity": "sha512-LU+TPda3mAE2QB0/Hp5VyeKJivpC6+tlOXd1VMoXV/YFMvk/MNk5iXeBfB4MQGRWyOYVJ01625vjkr0Az98OJQ==",
843
+ "cpu": [
844
+ "x64"
845
+ ],
846
+ "dev": true,
847
+ "license": "MIT",
848
+ "optional": true,
849
+ "os": [
850
+ "freebsd"
851
+ ]
852
+ },
853
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
854
+ "version": "4.60.2",
855
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.2.tgz",
856
+ "integrity": "sha512-2QxQrM+KQ7DAW4o22j+XZ6RKdxjLD7BOWTP0Bv0tmjdyhXSsr2Ul1oJDQqh9Zf5qOwTuTc7Ek83mOFaKnodPjg==",
857
+ "cpu": [
858
+ "arm"
859
+ ],
860
+ "dev": true,
861
+ "license": "MIT",
862
+ "optional": true,
863
+ "os": [
864
+ "linux"
865
+ ]
866
+ },
867
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
868
+ "version": "4.60.2",
869
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.2.tgz",
870
+ "integrity": "sha512-TbziEu2DVsTEOPif2mKWkMeDMLoYjx95oESa9fkQQK7r/Orta0gnkcDpzwufEcAO2BLBsD7mZkXGFqEdMRRwfw==",
871
+ "cpu": [
872
+ "arm"
873
+ ],
874
+ "dev": true,
875
+ "license": "MIT",
876
+ "optional": true,
877
+ "os": [
878
+ "linux"
879
+ ]
880
+ },
881
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
882
+ "version": "4.60.2",
883
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.2.tgz",
884
+ "integrity": "sha512-bO/rVDiDUuM2YfuCUwZ1t1cP+/yqjqz+Xf2VtkdppefuOFS2OSeAfgafaHNkFn0t02hEyXngZkxtGqXcXwO8Rg==",
885
+ "cpu": [
886
+ "arm64"
887
+ ],
888
+ "dev": true,
889
+ "license": "MIT",
890
+ "optional": true,
891
+ "os": [
892
+ "linux"
893
+ ]
894
+ },
895
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
896
+ "version": "4.60.2",
897
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.2.tgz",
898
+ "integrity": "sha512-hr26p7e93Rl0Za+JwW7EAnwAvKkehh12BU1Llm9Ykiibg4uIr2rbpxG9WCf56GuvidlTG9KiiQT/TXT1yAWxTA==",
899
+ "cpu": [
900
+ "arm64"
901
+ ],
902
+ "dev": true,
903
+ "license": "MIT",
904
+ "optional": true,
905
+ "os": [
906
+ "linux"
907
+ ]
908
+ },
909
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
910
+ "version": "4.60.2",
911
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.2.tgz",
912
+ "integrity": "sha512-pOjB/uSIyDt+ow3k/RcLvUAOGpysT2phDn7TTUB3n75SlIgZzM6NKAqlErPhoFU+npgY3/n+2HYIQVbF70P9/A==",
913
+ "cpu": [
914
+ "loong64"
915
+ ],
916
+ "dev": true,
917
+ "license": "MIT",
918
+ "optional": true,
919
+ "os": [
920
+ "linux"
921
+ ]
922
+ },
923
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
924
+ "version": "4.60.2",
925
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.2.tgz",
926
+ "integrity": "sha512-2/w+q8jszv9Ww1c+6uJT3OwqhdmGP2/4T17cu8WuwyUuuaCDDJ2ojdyYwZzCxx0GcsZBhzi3HmH+J5pZNXnd+Q==",
927
+ "cpu": [
928
+ "loong64"
929
+ ],
930
+ "dev": true,
931
+ "license": "MIT",
932
+ "optional": true,
933
+ "os": [
934
+ "linux"
935
+ ]
936
+ },
937
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
938
+ "version": "4.60.2",
939
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.2.tgz",
940
+ "integrity": "sha512-11+aL5vKheYgczxtPVVRhdptAM2H7fcDR5Gw4/bTcteuZBlH4oP9f5s9zYO9aGZvoGeBpqXI/9TZZihZ609wKw==",
941
+ "cpu": [
942
+ "ppc64"
943
+ ],
944
+ "dev": true,
945
+ "license": "MIT",
946
+ "optional": true,
947
+ "os": [
948
+ "linux"
949
+ ]
950
+ },
951
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
952
+ "version": "4.60.2",
953
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.2.tgz",
954
+ "integrity": "sha512-i16fokAGK46IVZuV8LIIwMdtqhin9hfYkCh8pf8iC3QU3LpwL+1FSFGej+O7l3E/AoknL6Dclh2oTdnRMpTzFQ==",
955
+ "cpu": [
956
+ "ppc64"
957
+ ],
958
+ "dev": true,
959
+ "license": "MIT",
960
+ "optional": true,
961
+ "os": [
962
+ "linux"
963
+ ]
964
+ },
965
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
966
+ "version": "4.60.2",
967
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.2.tgz",
968
+ "integrity": "sha512-49FkKS6RGQoriDSK/6E2GkAsAuU5kETFCh7pG4yD/ylj9rKhTmO3elsnmBvRD4PgJPds5W2PkhC82aVwmUcJ7A==",
969
+ "cpu": [
970
+ "riscv64"
971
+ ],
972
+ "dev": true,
973
+ "license": "MIT",
974
+ "optional": true,
975
+ "os": [
976
+ "linux"
977
+ ]
978
+ },
979
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
980
+ "version": "4.60.2",
981
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.2.tgz",
982
+ "integrity": "sha512-mjYNkHPfGpUR00DuM1ZZIgs64Hpf4bWcz9Z41+4Q+pgDx73UwWdAYyf6EG/lRFldmdHHzgrYyge5akFUW0D3mQ==",
983
+ "cpu": [
984
+ "riscv64"
985
+ ],
986
+ "dev": true,
987
+ "license": "MIT",
988
+ "optional": true,
989
+ "os": [
990
+ "linux"
991
+ ]
992
+ },
993
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
994
+ "version": "4.60.2",
995
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.2.tgz",
996
+ "integrity": "sha512-ALyvJz965BQk8E9Al/JDKKDLH2kfKFLTGMlgkAbbYtZuJt9LU8DW3ZoDMCtQpXAltZxwBHevXz5u+gf0yA0YoA==",
997
+ "cpu": [
998
+ "s390x"
999
+ ],
1000
+ "dev": true,
1001
+ "license": "MIT",
1002
+ "optional": true,
1003
+ "os": [
1004
+ "linux"
1005
+ ]
1006
+ },
1007
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
1008
+ "version": "4.60.2",
1009
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.2.tgz",
1010
+ "integrity": "sha512-UQjrkIdWrKI626Du8lCQ6MJp/6V1LAo2bOK9OTu4mSn8GGXIkPXk/Vsp4bLHCd9Z9Iz2OTEaokUE90VweJgIYQ==",
1011
+ "cpu": [
1012
+ "x64"
1013
+ ],
1014
+ "dev": true,
1015
+ "license": "MIT",
1016
+ "optional": true,
1017
+ "os": [
1018
+ "linux"
1019
+ ]
1020
+ },
1021
+ "node_modules/@rollup/rollup-linux-x64-musl": {
1022
+ "version": "4.60.2",
1023
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.2.tgz",
1024
+ "integrity": "sha512-bTsRGj6VlSdn/XD4CGyzMnzaBs9bsRxy79eTqTCBsA8TMIEky7qg48aPkvJvFe1HyzQ5oMZdg7AnVlWQSKLTnw==",
1025
+ "cpu": [
1026
+ "x64"
1027
+ ],
1028
+ "dev": true,
1029
+ "license": "MIT",
1030
+ "optional": true,
1031
+ "os": [
1032
+ "linux"
1033
+ ]
1034
+ },
1035
+ "node_modules/@rollup/rollup-openbsd-x64": {
1036
+ "version": "4.60.2",
1037
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.2.tgz",
1038
+ "integrity": "sha512-6d4Z3534xitaA1FcMWP7mQPq5zGwBmGbhphh2DwaA1aNIXUu3KTOfwrWpbwI4/Gr0uANo7NTtaykFyO2hPuFLg==",
1039
+ "cpu": [
1040
+ "x64"
1041
+ ],
1042
+ "dev": true,
1043
+ "license": "MIT",
1044
+ "optional": true,
1045
+ "os": [
1046
+ "openbsd"
1047
+ ]
1048
+ },
1049
+ "node_modules/@rollup/rollup-openharmony-arm64": {
1050
+ "version": "4.60.2",
1051
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.2.tgz",
1052
+ "integrity": "sha512-NetAg5iO2uN7eB8zE5qrZ3CSil+7IJt4WDFLcC75Ymywq1VZVD6qJ6EvNLjZ3rEm6gB7XW5JdT60c6MN35Z85Q==",
1053
+ "cpu": [
1054
+ "arm64"
1055
+ ],
1056
+ "dev": true,
1057
+ "license": "MIT",
1058
+ "optional": true,
1059
+ "os": [
1060
+ "openharmony"
1061
+ ]
1062
+ },
1063
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
1064
+ "version": "4.60.2",
1065
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.2.tgz",
1066
+ "integrity": "sha512-NCYhOotpgWZ5kdxCZsv6Iudx0wX8980Q/oW4pNFNihpBKsDbEA1zpkfxJGC0yugsUuyDZ7gL37dbzwhR0VI7pQ==",
1067
+ "cpu": [
1068
+ "arm64"
1069
+ ],
1070
+ "dev": true,
1071
+ "license": "MIT",
1072
+ "optional": true,
1073
+ "os": [
1074
+ "win32"
1075
+ ]
1076
+ },
1077
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
1078
+ "version": "4.60.2",
1079
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.2.tgz",
1080
+ "integrity": "sha512-RXsaOqXxfoUBQoOgvmmijVxJnW2IGB0eoMO7F8FAjaj0UTywUO/luSqimWBJn04WNgUkeNhh7fs7pESXajWmkg==",
1081
+ "cpu": [
1082
+ "ia32"
1083
+ ],
1084
+ "dev": true,
1085
+ "license": "MIT",
1086
+ "optional": true,
1087
+ "os": [
1088
+ "win32"
1089
+ ]
1090
+ },
1091
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
1092
+ "version": "4.60.2",
1093
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.2.tgz",
1094
+ "integrity": "sha512-qdAzEULD+/hzObedtmV6iBpdL5TIbKVztGiK7O3/KYSf+HIzU257+MX1EXJcyIiDbMAqmbwaufcYPvyRryeZtA==",
1095
+ "cpu": [
1096
+ "x64"
1097
+ ],
1098
+ "dev": true,
1099
+ "license": "MIT",
1100
+ "optional": true,
1101
+ "os": [
1102
+ "win32"
1103
+ ]
1104
+ },
1105
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
1106
+ "version": "4.60.2",
1107
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.2.tgz",
1108
+ "integrity": "sha512-Nd/SgG27WoA9e+/TdK74KnHz852TLa94ovOYySo/yMPuTmpckK/jIF2jSwS3g7ELSKXK13/cVdmg1Z/DaCWKxA==",
1109
+ "cpu": [
1110
+ "x64"
1111
+ ],
1112
+ "dev": true,
1113
+ "license": "MIT",
1114
+ "optional": true,
1115
+ "os": [
1116
+ "win32"
1117
+ ]
1118
+ },
1119
+ "node_modules/@types/babel__core": {
1120
+ "version": "7.20.5",
1121
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
1122
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
1123
+ "dev": true,
1124
+ "license": "MIT",
1125
+ "dependencies": {
1126
+ "@babel/parser": "^7.20.7",
1127
+ "@babel/types": "^7.20.7",
1128
+ "@types/babel__generator": "*",
1129
+ "@types/babel__template": "*",
1130
+ "@types/babel__traverse": "*"
1131
+ }
1132
+ },
1133
+ "node_modules/@types/babel__generator": {
1134
+ "version": "7.27.0",
1135
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
1136
+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
1137
+ "dev": true,
1138
+ "license": "MIT",
1139
+ "dependencies": {
1140
+ "@babel/types": "^7.0.0"
1141
+ }
1142
+ },
1143
+ "node_modules/@types/babel__template": {
1144
+ "version": "7.4.4",
1145
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
1146
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
1147
+ "dev": true,
1148
+ "license": "MIT",
1149
+ "dependencies": {
1150
+ "@babel/parser": "^7.1.0",
1151
+ "@babel/types": "^7.0.0"
1152
+ }
1153
+ },
1154
+ "node_modules/@types/babel__traverse": {
1155
+ "version": "7.28.0",
1156
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
1157
+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
1158
+ "dev": true,
1159
+ "license": "MIT",
1160
+ "dependencies": {
1161
+ "@babel/types": "^7.28.2"
1162
+ }
1163
+ },
1164
+ "node_modules/@types/d3-array": {
1165
+ "version": "3.2.2",
1166
+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",
1167
+ "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",
1168
+ "license": "MIT"
1169
+ },
1170
+ "node_modules/@types/d3-color": {
1171
+ "version": "3.1.3",
1172
+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
1173
+ "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
1174
+ "license": "MIT"
1175
+ },
1176
+ "node_modules/@types/d3-ease": {
1177
+ "version": "3.0.2",
1178
+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
1179
+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
1180
+ "license": "MIT"
1181
+ },
1182
+ "node_modules/@types/d3-interpolate": {
1183
+ "version": "3.0.4",
1184
+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
1185
+ "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
1186
+ "license": "MIT",
1187
+ "dependencies": {
1188
+ "@types/d3-color": "*"
1189
+ }
1190
+ },
1191
+ "node_modules/@types/d3-path": {
1192
+ "version": "3.1.1",
1193
+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
1194
+ "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
1195
+ "license": "MIT"
1196
+ },
1197
+ "node_modules/@types/d3-scale": {
1198
+ "version": "4.0.9",
1199
+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
1200
+ "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
1201
+ "license": "MIT",
1202
+ "dependencies": {
1203
+ "@types/d3-time": "*"
1204
+ }
1205
+ },
1206
+ "node_modules/@types/d3-shape": {
1207
+ "version": "3.1.8",
1208
+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz",
1209
+ "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==",
1210
+ "license": "MIT",
1211
+ "dependencies": {
1212
+ "@types/d3-path": "*"
1213
+ }
1214
+ },
1215
+ "node_modules/@types/d3-time": {
1216
+ "version": "3.0.4",
1217
+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
1218
+ "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
1219
+ "license": "MIT"
1220
+ },
1221
+ "node_modules/@types/d3-timer": {
1222
+ "version": "3.0.2",
1223
+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
1224
+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
1225
+ "license": "MIT"
1226
+ },
1227
+ "node_modules/@types/estree": {
1228
+ "version": "1.0.8",
1229
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
1230
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
1231
+ "dev": true,
1232
+ "license": "MIT"
1233
+ },
1234
+ "node_modules/@vitejs/plugin-react": {
1235
+ "version": "4.7.0",
1236
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
1237
+ "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==",
1238
+ "dev": true,
1239
+ "license": "MIT",
1240
+ "dependencies": {
1241
+ "@babel/core": "^7.28.0",
1242
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
1243
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
1244
+ "@rolldown/pluginutils": "1.0.0-beta.27",
1245
+ "@types/babel__core": "^7.20.5",
1246
+ "react-refresh": "^0.17.0"
1247
+ },
1248
+ "engines": {
1249
+ "node": "^14.18.0 || >=16.0.0"
1250
+ },
1251
+ "peerDependencies": {
1252
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
1253
+ }
1254
+ },
1255
+ "node_modules/baseline-browser-mapping": {
1256
+ "version": "2.10.25",
1257
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.25.tgz",
1258
+ "integrity": "sha512-QO/VHsXCQdnzADMfmkeOPvHdIAkoB7i0/rGjINPJEetLx75hNttVWGQ/jycHUDP9zZ9rupbm60WRxcwViB0MiA==",
1259
+ "dev": true,
1260
+ "license": "Apache-2.0",
1261
+ "bin": {
1262
+ "baseline-browser-mapping": "dist/cli.cjs"
1263
+ },
1264
+ "engines": {
1265
+ "node": ">=6.0.0"
1266
+ }
1267
+ },
1268
+ "node_modules/browserslist": {
1269
+ "version": "4.28.2",
1270
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
1271
+ "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==",
1272
+ "dev": true,
1273
+ "funding": [
1274
+ {
1275
+ "type": "opencollective",
1276
+ "url": "https://opencollective.com/browserslist"
1277
+ },
1278
+ {
1279
+ "type": "tidelift",
1280
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
1281
+ },
1282
+ {
1283
+ "type": "github",
1284
+ "url": "https://github.com/sponsors/ai"
1285
+ }
1286
+ ],
1287
+ "license": "MIT",
1288
+ "dependencies": {
1289
+ "baseline-browser-mapping": "^2.10.12",
1290
+ "caniuse-lite": "^1.0.30001782",
1291
+ "electron-to-chromium": "^1.5.328",
1292
+ "node-releases": "^2.0.36",
1293
+ "update-browserslist-db": "^1.2.3"
1294
+ },
1295
+ "bin": {
1296
+ "browserslist": "cli.js"
1297
+ },
1298
+ "engines": {
1299
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1300
+ }
1301
+ },
1302
+ "node_modules/caniuse-lite": {
1303
+ "version": "1.0.30001791",
1304
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001791.tgz",
1305
+ "integrity": "sha512-yk0l/YSrOnFZk3UROpDLQD9+kC1l4meK/wed583AXrzoarMGJcbRi2Q4RaUYbKxYAsZ8sWmaSa/DsLmdBeI1vQ==",
1306
+ "dev": true,
1307
+ "funding": [
1308
+ {
1309
+ "type": "opencollective",
1310
+ "url": "https://opencollective.com/browserslist"
1311
+ },
1312
+ {
1313
+ "type": "tidelift",
1314
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
1315
+ },
1316
+ {
1317
+ "type": "github",
1318
+ "url": "https://github.com/sponsors/ai"
1319
+ }
1320
+ ],
1321
+ "license": "CC-BY-4.0"
1322
+ },
1323
+ "node_modules/clsx": {
1324
+ "version": "2.1.1",
1325
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
1326
+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
1327
+ "license": "MIT",
1328
+ "engines": {
1329
+ "node": ">=6"
1330
+ }
1331
+ },
1332
+ "node_modules/convert-source-map": {
1333
+ "version": "2.0.0",
1334
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
1335
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
1336
+ "dev": true,
1337
+ "license": "MIT"
1338
+ },
1339
+ "node_modules/csstype": {
1340
+ "version": "3.2.3",
1341
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
1342
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
1343
+ "license": "MIT"
1344
+ },
1345
+ "node_modules/d3-array": {
1346
+ "version": "3.2.4",
1347
+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
1348
+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
1349
+ "license": "ISC",
1350
+ "dependencies": {
1351
+ "internmap": "1 - 2"
1352
+ },
1353
+ "engines": {
1354
+ "node": ">=12"
1355
+ }
1356
+ },
1357
+ "node_modules/d3-color": {
1358
+ "version": "3.1.0",
1359
+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
1360
+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
1361
+ "license": "ISC",
1362
+ "engines": {
1363
+ "node": ">=12"
1364
+ }
1365
+ },
1366
+ "node_modules/d3-ease": {
1367
+ "version": "3.0.1",
1368
+ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
1369
+ "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
1370
+ "license": "BSD-3-Clause",
1371
+ "engines": {
1372
+ "node": ">=12"
1373
+ }
1374
+ },
1375
+ "node_modules/d3-format": {
1376
+ "version": "3.1.2",
1377
+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",
1378
+ "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==",
1379
+ "license": "ISC",
1380
+ "engines": {
1381
+ "node": ">=12"
1382
+ }
1383
+ },
1384
+ "node_modules/d3-interpolate": {
1385
+ "version": "3.0.1",
1386
+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
1387
+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
1388
+ "license": "ISC",
1389
+ "dependencies": {
1390
+ "d3-color": "1 - 3"
1391
+ },
1392
+ "engines": {
1393
+ "node": ">=12"
1394
+ }
1395
+ },
1396
+ "node_modules/d3-path": {
1397
+ "version": "3.1.0",
1398
+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
1399
+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
1400
+ "license": "ISC",
1401
+ "engines": {
1402
+ "node": ">=12"
1403
+ }
1404
+ },
1405
+ "node_modules/d3-scale": {
1406
+ "version": "4.0.2",
1407
+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
1408
+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
1409
+ "license": "ISC",
1410
+ "dependencies": {
1411
+ "d3-array": "2.10.0 - 3",
1412
+ "d3-format": "1 - 3",
1413
+ "d3-interpolate": "1.2.0 - 3",
1414
+ "d3-time": "2.1.1 - 3",
1415
+ "d3-time-format": "2 - 4"
1416
+ },
1417
+ "engines": {
1418
+ "node": ">=12"
1419
+ }
1420
+ },
1421
+ "node_modules/d3-shape": {
1422
+ "version": "3.2.0",
1423
+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
1424
+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
1425
+ "license": "ISC",
1426
+ "dependencies": {
1427
+ "d3-path": "^3.1.0"
1428
+ },
1429
+ "engines": {
1430
+ "node": ">=12"
1431
+ }
1432
+ },
1433
+ "node_modules/d3-time": {
1434
+ "version": "3.1.0",
1435
+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
1436
+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
1437
+ "license": "ISC",
1438
+ "dependencies": {
1439
+ "d3-array": "2 - 3"
1440
+ },
1441
+ "engines": {
1442
+ "node": ">=12"
1443
+ }
1444
+ },
1445
+ "node_modules/d3-time-format": {
1446
+ "version": "4.1.0",
1447
+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
1448
+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
1449
+ "license": "ISC",
1450
+ "dependencies": {
1451
+ "d3-time": "1 - 3"
1452
+ },
1453
+ "engines": {
1454
+ "node": ">=12"
1455
+ }
1456
+ },
1457
+ "node_modules/d3-timer": {
1458
+ "version": "3.0.1",
1459
+ "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
1460
+ "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
1461
+ "license": "ISC",
1462
+ "engines": {
1463
+ "node": ">=12"
1464
+ }
1465
+ },
1466
+ "node_modules/debug": {
1467
+ "version": "4.4.3",
1468
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
1469
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
1470
+ "dev": true,
1471
+ "license": "MIT",
1472
+ "dependencies": {
1473
+ "ms": "^2.1.3"
1474
+ },
1475
+ "engines": {
1476
+ "node": ">=6.0"
1477
+ },
1478
+ "peerDependenciesMeta": {
1479
+ "supports-color": {
1480
+ "optional": true
1481
+ }
1482
+ }
1483
+ },
1484
+ "node_modules/decimal.js-light": {
1485
+ "version": "2.5.1",
1486
+ "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
1487
+ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
1488
+ "license": "MIT"
1489
+ },
1490
+ "node_modules/dom-helpers": {
1491
+ "version": "5.2.1",
1492
+ "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
1493
+ "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
1494
+ "license": "MIT",
1495
+ "dependencies": {
1496
+ "@babel/runtime": "^7.8.7",
1497
+ "csstype": "^3.0.2"
1498
+ }
1499
+ },
1500
+ "node_modules/electron-to-chromium": {
1501
+ "version": "1.5.349",
1502
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.349.tgz",
1503
+ "integrity": "sha512-QsWVGyRuY07Aqb234QytTfwd5d9AJlfNIQ5wIOl1L+PZDzI9d9+Fn0FRale/QYlFxt/bUnB0/nLd1jFPGxGK1A==",
1504
+ "dev": true,
1505
+ "license": "ISC"
1506
+ },
1507
+ "node_modules/esbuild": {
1508
+ "version": "0.21.5",
1509
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
1510
+ "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
1511
+ "dev": true,
1512
+ "hasInstallScript": true,
1513
+ "license": "MIT",
1514
+ "bin": {
1515
+ "esbuild": "bin/esbuild"
1516
+ },
1517
+ "engines": {
1518
+ "node": ">=12"
1519
+ },
1520
+ "optionalDependencies": {
1521
+ "@esbuild/aix-ppc64": "0.21.5",
1522
+ "@esbuild/android-arm": "0.21.5",
1523
+ "@esbuild/android-arm64": "0.21.5",
1524
+ "@esbuild/android-x64": "0.21.5",
1525
+ "@esbuild/darwin-arm64": "0.21.5",
1526
+ "@esbuild/darwin-x64": "0.21.5",
1527
+ "@esbuild/freebsd-arm64": "0.21.5",
1528
+ "@esbuild/freebsd-x64": "0.21.5",
1529
+ "@esbuild/linux-arm": "0.21.5",
1530
+ "@esbuild/linux-arm64": "0.21.5",
1531
+ "@esbuild/linux-ia32": "0.21.5",
1532
+ "@esbuild/linux-loong64": "0.21.5",
1533
+ "@esbuild/linux-mips64el": "0.21.5",
1534
+ "@esbuild/linux-ppc64": "0.21.5",
1535
+ "@esbuild/linux-riscv64": "0.21.5",
1536
+ "@esbuild/linux-s390x": "0.21.5",
1537
+ "@esbuild/linux-x64": "0.21.5",
1538
+ "@esbuild/netbsd-x64": "0.21.5",
1539
+ "@esbuild/openbsd-x64": "0.21.5",
1540
+ "@esbuild/sunos-x64": "0.21.5",
1541
+ "@esbuild/win32-arm64": "0.21.5",
1542
+ "@esbuild/win32-ia32": "0.21.5",
1543
+ "@esbuild/win32-x64": "0.21.5"
1544
+ }
1545
+ },
1546
+ "node_modules/escalade": {
1547
+ "version": "3.2.0",
1548
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
1549
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
1550
+ "dev": true,
1551
+ "license": "MIT",
1552
+ "engines": {
1553
+ "node": ">=6"
1554
+ }
1555
+ },
1556
+ "node_modules/eventemitter3": {
1557
+ "version": "4.0.7",
1558
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
1559
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
1560
+ "license": "MIT"
1561
+ },
1562
+ "node_modules/fast-equals": {
1563
+ "version": "5.4.0",
1564
+ "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.0.tgz",
1565
+ "integrity": "sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==",
1566
+ "license": "MIT",
1567
+ "engines": {
1568
+ "node": ">=6.0.0"
1569
+ }
1570
+ },
1571
+ "node_modules/fsevents": {
1572
+ "version": "2.3.3",
1573
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
1574
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
1575
+ "dev": true,
1576
+ "hasInstallScript": true,
1577
+ "license": "MIT",
1578
+ "optional": true,
1579
+ "os": [
1580
+ "darwin"
1581
+ ],
1582
+ "engines": {
1583
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
1584
+ }
1585
+ },
1586
+ "node_modules/gensync": {
1587
+ "version": "1.0.0-beta.2",
1588
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
1589
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
1590
+ "dev": true,
1591
+ "license": "MIT",
1592
+ "engines": {
1593
+ "node": ">=6.9.0"
1594
+ }
1595
+ },
1596
+ "node_modules/internmap": {
1597
+ "version": "2.0.3",
1598
+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
1599
+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
1600
+ "license": "ISC",
1601
+ "engines": {
1602
+ "node": ">=12"
1603
+ }
1604
+ },
1605
+ "node_modules/js-tokens": {
1606
+ "version": "4.0.0",
1607
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
1608
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
1609
+ "license": "MIT"
1610
+ },
1611
+ "node_modules/jsesc": {
1612
+ "version": "3.1.0",
1613
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
1614
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
1615
+ "dev": true,
1616
+ "license": "MIT",
1617
+ "bin": {
1618
+ "jsesc": "bin/jsesc"
1619
+ },
1620
+ "engines": {
1621
+ "node": ">=6"
1622
+ }
1623
+ },
1624
+ "node_modules/json5": {
1625
+ "version": "2.2.3",
1626
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
1627
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
1628
+ "dev": true,
1629
+ "license": "MIT",
1630
+ "bin": {
1631
+ "json5": "lib/cli.js"
1632
+ },
1633
+ "engines": {
1634
+ "node": ">=6"
1635
+ }
1636
+ },
1637
+ "node_modules/lodash": {
1638
+ "version": "4.18.1",
1639
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
1640
+ "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
1641
+ "license": "MIT"
1642
+ },
1643
+ "node_modules/loose-envify": {
1644
+ "version": "1.4.0",
1645
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
1646
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
1647
+ "license": "MIT",
1648
+ "dependencies": {
1649
+ "js-tokens": "^3.0.0 || ^4.0.0"
1650
+ },
1651
+ "bin": {
1652
+ "loose-envify": "cli.js"
1653
+ }
1654
+ },
1655
+ "node_modules/lru-cache": {
1656
+ "version": "5.1.1",
1657
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
1658
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
1659
+ "dev": true,
1660
+ "license": "ISC",
1661
+ "dependencies": {
1662
+ "yallist": "^3.0.2"
1663
+ }
1664
+ },
1665
+ "node_modules/ms": {
1666
+ "version": "2.1.3",
1667
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1668
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
1669
+ "dev": true,
1670
+ "license": "MIT"
1671
+ },
1672
+ "node_modules/nanoid": {
1673
+ "version": "3.3.12",
1674
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
1675
+ "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
1676
+ "dev": true,
1677
+ "funding": [
1678
+ {
1679
+ "type": "github",
1680
+ "url": "https://github.com/sponsors/ai"
1681
+ }
1682
+ ],
1683
+ "license": "MIT",
1684
+ "bin": {
1685
+ "nanoid": "bin/nanoid.cjs"
1686
+ },
1687
+ "engines": {
1688
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
1689
+ }
1690
+ },
1691
+ "node_modules/node-releases": {
1692
+ "version": "2.0.38",
1693
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.38.tgz",
1694
+ "integrity": "sha512-3qT/88Y3FbH/Kx4szpQQ4HzUbVrHPKTLVpVocKiLfoYvw9XSGOX2FmD2d6DrXbVYyAQTF2HeF6My8jmzx7/CRw==",
1695
+ "dev": true,
1696
+ "license": "MIT"
1697
+ },
1698
+ "node_modules/object-assign": {
1699
+ "version": "4.1.1",
1700
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
1701
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
1702
+ "license": "MIT",
1703
+ "engines": {
1704
+ "node": ">=0.10.0"
1705
+ }
1706
+ },
1707
+ "node_modules/picocolors": {
1708
+ "version": "1.1.1",
1709
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
1710
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
1711
+ "dev": true,
1712
+ "license": "ISC"
1713
+ },
1714
+ "node_modules/postcss": {
1715
+ "version": "8.5.13",
1716
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.13.tgz",
1717
+ "integrity": "sha512-qif0+jGGZoLWdHey3UFHHWP0H7Gbmsk8T5VEqyYFbWqPr1XqvLGBbk/sl8V5exGmcYJklJOhOQq1pV9IcsiFag==",
1718
+ "dev": true,
1719
+ "funding": [
1720
+ {
1721
+ "type": "opencollective",
1722
+ "url": "https://opencollective.com/postcss/"
1723
+ },
1724
+ {
1725
+ "type": "tidelift",
1726
+ "url": "https://tidelift.com/funding/github/npm/postcss"
1727
+ },
1728
+ {
1729
+ "type": "github",
1730
+ "url": "https://github.com/sponsors/ai"
1731
+ }
1732
+ ],
1733
+ "license": "MIT",
1734
+ "dependencies": {
1735
+ "nanoid": "^3.3.11",
1736
+ "picocolors": "^1.1.1",
1737
+ "source-map-js": "^1.2.1"
1738
+ },
1739
+ "engines": {
1740
+ "node": "^10 || ^12 || >=14"
1741
+ }
1742
+ },
1743
+ "node_modules/prop-types": {
1744
+ "version": "15.8.1",
1745
+ "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
1746
+ "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
1747
+ "license": "MIT",
1748
+ "dependencies": {
1749
+ "loose-envify": "^1.4.0",
1750
+ "object-assign": "^4.1.1",
1751
+ "react-is": "^16.13.1"
1752
+ }
1753
+ },
1754
+ "node_modules/prop-types/node_modules/react-is": {
1755
+ "version": "16.13.1",
1756
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
1757
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
1758
+ "license": "MIT"
1759
+ },
1760
+ "node_modules/react": {
1761
+ "version": "18.3.1",
1762
+ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
1763
+ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
1764
+ "license": "MIT",
1765
+ "dependencies": {
1766
+ "loose-envify": "^1.1.0"
1767
+ },
1768
+ "engines": {
1769
+ "node": ">=0.10.0"
1770
+ }
1771
+ },
1772
+ "node_modules/react-dom": {
1773
+ "version": "18.3.1",
1774
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
1775
+ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
1776
+ "license": "MIT",
1777
+ "dependencies": {
1778
+ "loose-envify": "^1.1.0",
1779
+ "scheduler": "^0.23.2"
1780
+ },
1781
+ "peerDependencies": {
1782
+ "react": "^18.3.1"
1783
+ }
1784
+ },
1785
+ "node_modules/react-is": {
1786
+ "version": "18.3.1",
1787
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
1788
+ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
1789
+ "license": "MIT"
1790
+ },
1791
+ "node_modules/react-refresh": {
1792
+ "version": "0.17.0",
1793
+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
1794
+ "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
1795
+ "dev": true,
1796
+ "license": "MIT",
1797
+ "engines": {
1798
+ "node": ">=0.10.0"
1799
+ }
1800
+ },
1801
+ "node_modules/react-router": {
1802
+ "version": "6.30.3",
1803
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz",
1804
+ "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==",
1805
+ "license": "MIT",
1806
+ "dependencies": {
1807
+ "@remix-run/router": "1.23.2"
1808
+ },
1809
+ "engines": {
1810
+ "node": ">=14.0.0"
1811
+ },
1812
+ "peerDependencies": {
1813
+ "react": ">=16.8"
1814
+ }
1815
+ },
1816
+ "node_modules/react-router-dom": {
1817
+ "version": "6.30.3",
1818
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz",
1819
+ "integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==",
1820
+ "license": "MIT",
1821
+ "dependencies": {
1822
+ "@remix-run/router": "1.23.2",
1823
+ "react-router": "6.30.3"
1824
+ },
1825
+ "engines": {
1826
+ "node": ">=14.0.0"
1827
+ },
1828
+ "peerDependencies": {
1829
+ "react": ">=16.8",
1830
+ "react-dom": ">=16.8"
1831
+ }
1832
+ },
1833
+ "node_modules/react-smooth": {
1834
+ "version": "4.0.4",
1835
+ "resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz",
1836
+ "integrity": "sha512-gnGKTpYwqL0Iii09gHobNolvX4Kiq4PKx6eWBCYYix+8cdw+cGo3do906l1NBPKkSWx1DghC1dlWG9L2uGd61Q==",
1837
+ "license": "MIT",
1838
+ "dependencies": {
1839
+ "fast-equals": "^5.0.1",
1840
+ "prop-types": "^15.8.1",
1841
+ "react-transition-group": "^4.4.5"
1842
+ },
1843
+ "peerDependencies": {
1844
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
1845
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
1846
+ }
1847
+ },
1848
+ "node_modules/react-transition-group": {
1849
+ "version": "4.4.5",
1850
+ "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
1851
+ "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
1852
+ "license": "BSD-3-Clause",
1853
+ "dependencies": {
1854
+ "@babel/runtime": "^7.5.5",
1855
+ "dom-helpers": "^5.0.1",
1856
+ "loose-envify": "^1.4.0",
1857
+ "prop-types": "^15.6.2"
1858
+ },
1859
+ "peerDependencies": {
1860
+ "react": ">=16.6.0",
1861
+ "react-dom": ">=16.6.0"
1862
+ }
1863
+ },
1864
+ "node_modules/recharts": {
1865
+ "version": "2.15.4",
1866
+ "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.4.tgz",
1867
+ "integrity": "sha512-UT/q6fwS3c1dHbXv2uFgYJ9BMFHu3fwnd7AYZaEQhXuYQ4hgsxLvsUXzGdKeZrW5xopzDCvuA2N41WJ88I7zIw==",
1868
+ "license": "MIT",
1869
+ "dependencies": {
1870
+ "clsx": "^2.0.0",
1871
+ "eventemitter3": "^4.0.1",
1872
+ "lodash": "^4.17.21",
1873
+ "react-is": "^18.3.1",
1874
+ "react-smooth": "^4.0.4",
1875
+ "recharts-scale": "^0.4.4",
1876
+ "tiny-invariant": "^1.3.1",
1877
+ "victory-vendor": "^36.6.8"
1878
+ },
1879
+ "engines": {
1880
+ "node": ">=14"
1881
+ },
1882
+ "peerDependencies": {
1883
+ "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
1884
+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
1885
+ }
1886
+ },
1887
+ "node_modules/recharts-scale": {
1888
+ "version": "0.4.5",
1889
+ "resolved": "https://registry.npmjs.org/recharts-scale/-/recharts-scale-0.4.5.tgz",
1890
+ "integrity": "sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w==",
1891
+ "license": "MIT",
1892
+ "dependencies": {
1893
+ "decimal.js-light": "^2.4.1"
1894
+ }
1895
+ },
1896
+ "node_modules/rollup": {
1897
+ "version": "4.60.2",
1898
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.2.tgz",
1899
+ "integrity": "sha512-J9qZyW++QK/09NyN/zeO0dG/1GdGfyp9lV8ajHnRVLfo/uFsbji5mHnDgn/qYdUHyCkM2N+8VyspgZclfAh0eQ==",
1900
+ "dev": true,
1901
+ "license": "MIT",
1902
+ "dependencies": {
1903
+ "@types/estree": "1.0.8"
1904
+ },
1905
+ "bin": {
1906
+ "rollup": "dist/bin/rollup"
1907
+ },
1908
+ "engines": {
1909
+ "node": ">=18.0.0",
1910
+ "npm": ">=8.0.0"
1911
+ },
1912
+ "optionalDependencies": {
1913
+ "@rollup/rollup-android-arm-eabi": "4.60.2",
1914
+ "@rollup/rollup-android-arm64": "4.60.2",
1915
+ "@rollup/rollup-darwin-arm64": "4.60.2",
1916
+ "@rollup/rollup-darwin-x64": "4.60.2",
1917
+ "@rollup/rollup-freebsd-arm64": "4.60.2",
1918
+ "@rollup/rollup-freebsd-x64": "4.60.2",
1919
+ "@rollup/rollup-linux-arm-gnueabihf": "4.60.2",
1920
+ "@rollup/rollup-linux-arm-musleabihf": "4.60.2",
1921
+ "@rollup/rollup-linux-arm64-gnu": "4.60.2",
1922
+ "@rollup/rollup-linux-arm64-musl": "4.60.2",
1923
+ "@rollup/rollup-linux-loong64-gnu": "4.60.2",
1924
+ "@rollup/rollup-linux-loong64-musl": "4.60.2",
1925
+ "@rollup/rollup-linux-ppc64-gnu": "4.60.2",
1926
+ "@rollup/rollup-linux-ppc64-musl": "4.60.2",
1927
+ "@rollup/rollup-linux-riscv64-gnu": "4.60.2",
1928
+ "@rollup/rollup-linux-riscv64-musl": "4.60.2",
1929
+ "@rollup/rollup-linux-s390x-gnu": "4.60.2",
1930
+ "@rollup/rollup-linux-x64-gnu": "4.60.2",
1931
+ "@rollup/rollup-linux-x64-musl": "4.60.2",
1932
+ "@rollup/rollup-openbsd-x64": "4.60.2",
1933
+ "@rollup/rollup-openharmony-arm64": "4.60.2",
1934
+ "@rollup/rollup-win32-arm64-msvc": "4.60.2",
1935
+ "@rollup/rollup-win32-ia32-msvc": "4.60.2",
1936
+ "@rollup/rollup-win32-x64-gnu": "4.60.2",
1937
+ "@rollup/rollup-win32-x64-msvc": "4.60.2",
1938
+ "fsevents": "~2.3.2"
1939
+ }
1940
+ },
1941
+ "node_modules/scheduler": {
1942
+ "version": "0.23.2",
1943
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
1944
+ "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
1945
+ "license": "MIT",
1946
+ "dependencies": {
1947
+ "loose-envify": "^1.1.0"
1948
+ }
1949
+ },
1950
+ "node_modules/semver": {
1951
+ "version": "6.3.1",
1952
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
1953
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
1954
+ "dev": true,
1955
+ "license": "ISC",
1956
+ "bin": {
1957
+ "semver": "bin/semver.js"
1958
+ }
1959
+ },
1960
+ "node_modules/source-map-js": {
1961
+ "version": "1.2.1",
1962
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
1963
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
1964
+ "dev": true,
1965
+ "license": "BSD-3-Clause",
1966
+ "engines": {
1967
+ "node": ">=0.10.0"
1968
+ }
1969
+ },
1970
+ "node_modules/tiny-invariant": {
1971
+ "version": "1.3.3",
1972
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
1973
+ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
1974
+ "license": "MIT"
1975
+ },
1976
+ "node_modules/update-browserslist-db": {
1977
+ "version": "1.2.3",
1978
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
1979
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
1980
+ "dev": true,
1981
+ "funding": [
1982
+ {
1983
+ "type": "opencollective",
1984
+ "url": "https://opencollective.com/browserslist"
1985
+ },
1986
+ {
1987
+ "type": "tidelift",
1988
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
1989
+ },
1990
+ {
1991
+ "type": "github",
1992
+ "url": "https://github.com/sponsors/ai"
1993
+ }
1994
+ ],
1995
+ "license": "MIT",
1996
+ "dependencies": {
1997
+ "escalade": "^3.2.0",
1998
+ "picocolors": "^1.1.1"
1999
+ },
2000
+ "bin": {
2001
+ "update-browserslist-db": "cli.js"
2002
+ },
2003
+ "peerDependencies": {
2004
+ "browserslist": ">= 4.21.0"
2005
+ }
2006
+ },
2007
+ "node_modules/victory-vendor": {
2008
+ "version": "36.9.2",
2009
+ "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz",
2010
+ "integrity": "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ==",
2011
+ "license": "MIT AND ISC",
2012
+ "dependencies": {
2013
+ "@types/d3-array": "^3.0.3",
2014
+ "@types/d3-ease": "^3.0.0",
2015
+ "@types/d3-interpolate": "^3.0.1",
2016
+ "@types/d3-scale": "^4.0.2",
2017
+ "@types/d3-shape": "^3.1.0",
2018
+ "@types/d3-time": "^3.0.0",
2019
+ "@types/d3-timer": "^3.0.0",
2020
+ "d3-array": "^3.1.6",
2021
+ "d3-ease": "^3.0.1",
2022
+ "d3-interpolate": "^3.0.1",
2023
+ "d3-scale": "^4.0.2",
2024
+ "d3-shape": "^3.1.0",
2025
+ "d3-time": "^3.0.0",
2026
+ "d3-timer": "^3.0.1"
2027
+ }
2028
+ },
2029
+ "node_modules/vite": {
2030
+ "version": "5.4.21",
2031
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
2032
+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
2033
+ "dev": true,
2034
+ "license": "MIT",
2035
+ "dependencies": {
2036
+ "esbuild": "^0.21.3",
2037
+ "postcss": "^8.4.43",
2038
+ "rollup": "^4.20.0"
2039
+ },
2040
+ "bin": {
2041
+ "vite": "bin/vite.js"
2042
+ },
2043
+ "engines": {
2044
+ "node": "^18.0.0 || >=20.0.0"
2045
+ },
2046
+ "funding": {
2047
+ "url": "https://github.com/vitejs/vite?sponsor=1"
2048
+ },
2049
+ "optionalDependencies": {
2050
+ "fsevents": "~2.3.3"
2051
+ },
2052
+ "peerDependencies": {
2053
+ "@types/node": "^18.0.0 || >=20.0.0",
2054
+ "less": "*",
2055
+ "lightningcss": "^1.21.0",
2056
+ "sass": "*",
2057
+ "sass-embedded": "*",
2058
+ "stylus": "*",
2059
+ "sugarss": "*",
2060
+ "terser": "^5.4.0"
2061
+ },
2062
+ "peerDependenciesMeta": {
2063
+ "@types/node": {
2064
+ "optional": true
2065
+ },
2066
+ "less": {
2067
+ "optional": true
2068
+ },
2069
+ "lightningcss": {
2070
+ "optional": true
2071
+ },
2072
+ "sass": {
2073
+ "optional": true
2074
+ },
2075
+ "sass-embedded": {
2076
+ "optional": true
2077
+ },
2078
+ "stylus": {
2079
+ "optional": true
2080
+ },
2081
+ "sugarss": {
2082
+ "optional": true
2083
+ },
2084
+ "terser": {
2085
+ "optional": true
2086
+ }
2087
+ }
2088
+ },
2089
+ "node_modules/yallist": {
2090
+ "version": "3.1.1",
2091
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
2092
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
2093
+ "dev": true,
2094
+ "license": "ISC"
2095
+ }
2096
+ }
2097
+ }
frontend/package.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "breathe-frontend",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "^18.3.0",
13
+ "react-dom": "^18.3.0",
14
+ "react-router-dom": "^6.23.0",
15
+ "recharts": "^2.12.0"
16
+ },
17
+ "devDependencies": {
18
+ "@vitejs/plugin-react": "^4.7.0",
19
+ "vite": "^5.4.21"
20
+ }
21
+ }
frontend/public/favicon.svg ADDED
frontend/public/logo.svg ADDED
frontend/src/App.jsx ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Routes, Route, Navigate } from 'react-router-dom'
2
+ import { AuthProvider, useAuth } from './context/AuthContext'
3
+ import { ThemeProvider } from './context/ThemeContext'
4
+ import AuthPage from './pages/AuthPage'
5
+ import LandingPage from './pages/LandingPage'
6
+ import Layout from './components/Layout'
7
+ import DashboardPage from './pages/DashboardPage'
8
+ import AssessPage from './pages/AssessPage'
9
+ import HistoryPage from './pages/HistoryPage'
10
+ import ProfilePage from './pages/ProfilePage'
11
+ import BreathePage from './pages/BreathePage'
12
+ import BoxBreathingPage from './pages/BoxBreathingPage'
13
+ import GratitudePage from './pages/GratitudePage'
14
+ import TodoPage from './pages/TodoPage'
15
+
16
+ function PrivateRoute({ children }) {
17
+ const { user, loading } = useAuth()
18
+ if (loading) return <div className="full-loader"><div className="spinner" /></div>
19
+ return user ? children : <Navigate to="/auth" replace />
20
+ }
21
+
22
+ function PublicRoute({ children }) {
23
+ const { user, loading } = useAuth()
24
+ if (loading) return <div className="full-loader"><div className="spinner" /></div>
25
+ return user ? <Navigate to="/app/breathe" replace /> : children
26
+ }
27
+
28
+ export default function App() {
29
+ return (
30
+ <ThemeProvider>
31
+ <AuthProvider>
32
+ <Routes>
33
+ {/* Public landing */}
34
+ <Route path="/" element={<PublicRoute><LandingPage /></PublicRoute>} />
35
+ <Route path="/auth" element={<PublicRoute><AuthPage /></PublicRoute>} />
36
+
37
+ {/* Breathe hub — full-screen, no sidebar */}
38
+ <Route path="/app/breathe" element={<PrivateRoute><BreathePage /></PrivateRoute>} />
39
+ <Route path="/app/breathe/box" element={<PrivateRoute><BoxBreathingPage /></PrivateRoute>} />
40
+
41
+ {/* Protected app shell (with sidebar) */}
42
+ <Route path="/app" element={<PrivateRoute><Layout /></PrivateRoute>}>
43
+ <Route index element={<Navigate to="breathe" replace />} />
44
+ <Route path="dashboard" element={<DashboardPage />} />
45
+ <Route path="assess" element={<AssessPage />} />
46
+ <Route path="history" element={<HistoryPage />} />
47
+ <Route path="profile" element={<ProfilePage />} />
48
+ <Route path="gratitude" element={<GratitudePage />} />
49
+ <Route path="todo" element={<TodoPage />} />
50
+ </Route>
51
+
52
+ {/* Legacy short URLs — redirect logged-in users straight to app */}
53
+ <Route path="/dashboard" element={<PrivateRoute><Navigate to="/app/dashboard" replace /></PrivateRoute>} />
54
+ <Route path="/assess" element={<PrivateRoute><Navigate to="/app/assess" replace /></PrivateRoute>} />
55
+ <Route path="/history" element={<PrivateRoute><Navigate to="/app/history" replace /></PrivateRoute>} />
56
+
57
+ <Route path="*" element={<Navigate to="/" replace />} />
58
+ </Routes>
59
+ </AuthProvider> </ThemeProvider> )
60
+ }
frontend/src/api/client.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const BASE = '' // same-origin in prod; Vite proxy handles /api in dev
2
+
3
+ async function request(path, options = {}) {
4
+ const res = await fetch(BASE + path, {
5
+ credentials: 'include',
6
+ headers: { 'Content-Type': 'application/json', ...(options.headers || {}) },
7
+ ...options,
8
+ })
9
+ const json = await res.json().catch(() => ({}))
10
+ if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`)
11
+ return json
12
+ }
13
+
14
+ export const api = {
15
+ get: (path) => request(path),
16
+ post: (path, body) => request(path, { method: 'POST', body: JSON.stringify(body) }),
17
+ put: (path, body) => request(path, { method: 'PUT', body: JSON.stringify(body) }),
18
+ del: (path) => request(path, { method: 'DELETE' }),
19
+ }
frontend/src/components/DeepBreathWidget.jsx ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect, useRef } from 'react'
2
+
3
+ const PHASES = [
4
+ { label: 'Inhale', duration: 4, scale: 1.55 },
5
+ { label: 'Hold', duration: 4, scale: 1.55 },
6
+ { label: 'Exhale', duration: 6, scale: 1.0 },
7
+ { label: 'Hold', duration: 2, scale: 1.0 },
8
+ ]
9
+
10
+ export default function DeepBreathWidget() {
11
+ const [running, setRunning] = useState(false)
12
+ const [phaseIdx, setPhaseIdx] = useState(0)
13
+ const [tick, setTick] = useState(PHASES[0].duration)
14
+ const [breaths, setBreaths] = useState(0)
15
+ const intervalRef = useRef(null)
16
+
17
+ function stop() {
18
+ clearInterval(intervalRef.current)
19
+ setRunning(false)
20
+ setPhaseIdx(0)
21
+ setTick(PHASES[0].duration)
22
+ }
23
+
24
+ function start() {
25
+ setRunning(true)
26
+ setPhaseIdx(0)
27
+ setTick(PHASES[0].duration)
28
+ }
29
+
30
+ useEffect(() => {
31
+ if (!running) return
32
+ intervalRef.current = setInterval(() => {
33
+ setTick(t => {
34
+ if (t > 1) return t - 1
35
+ setPhaseIdx(pi => {
36
+ const next = (pi + 1) % PHASES.length
37
+ if (next === 0) setBreaths(b => b + 1)
38
+ setTick(PHASES[next].duration)
39
+ return next
40
+ })
41
+ return PHASES[0].duration
42
+ })
43
+ }, 1000)
44
+ return () => clearInterval(intervalRef.current)
45
+ }, [running])
46
+
47
+ const phase = PHASES[phaseIdx]
48
+ const pct = running ? (tick / phase.duration) : 1
49
+
50
+ return (
51
+ <div className="dbw">
52
+ <div className="dbw-orb-wrap">
53
+ <div className={`dbw-ring dbw-ring-1 ${running ? `dbw-ring--${phaseIdx}` : ''}`} />
54
+ <div className={`dbw-ring dbw-ring-2 ${running ? `dbw-ring--${phaseIdx}` : ''}`} />
55
+
56
+ <div
57
+ className="dbw-orb"
58
+ style={{
59
+ transform: running ? `scale(${phase.scale})` : 'scale(1)',
60
+ transition: phaseIdx === 0
61
+ ? `transform ${phase.duration}s cubic-bezier(.4,0,.2,1)`
62
+ : phaseIdx === 2
63
+ ? `transform ${phase.duration}s cubic-bezier(.4,0,.2,1)`
64
+ : 'none',
65
+ }}
66
+ >
67
+ <img src="/logo.svg" alt="" className="dbw-logo" />
68
+ </div>
69
+
70
+ {running && (
71
+ <svg className="dbw-arc" viewBox="0 0 120 120">
72
+ <circle cx="60" cy="60" r="54" fill="none" stroke="rgba(255,255,255,.08)" strokeWidth="4"/>
73
+ <circle
74
+ cx="60" cy="60" r="54"
75
+ fill="none"
76
+ stroke="url(#arcGrad)"
77
+ strokeWidth="4"
78
+ strokeLinecap="round"
79
+ strokeDasharray={`${2 * Math.PI * 54}`}
80
+ strokeDashoffset={`${2 * Math.PI * 54 * (1 - pct)}`}
81
+ transform="rotate(-90 60 60)"
82
+ />
83
+ <defs>
84
+ <linearGradient id="arcGrad" x1="0" y1="0" x2="1" y2="1">
85
+ <stop offset="0%" stopColor="#FF4A26"/>
86
+ <stop offset="100%" stopColor="#7B4ABE"/>
87
+ </linearGradient>
88
+ </defs>
89
+ </svg>
90
+ )}
91
+ </div>
92
+
93
+ <div className="dbw-info">
94
+ <div className="dbw-phase">{running ? phase.label : 'Box Breathing'}</div>
95
+ <div className="dbw-tick">{running ? tick : '—'}</div>
96
+ <div className="dbw-counter">
97
+ {breaths > 0 || running
98
+ ? `${breaths} breath${breaths !== 1 ? 's' : ''} completed`
99
+ : 'Tap start to begin'}
100
+ </div>
101
+ </div>
102
+
103
+ <div className="dbw-controls">
104
+ {!running
105
+ ? <button className="dbw-btn dbw-btn--start" onClick={start}>▶ Start</button>
106
+ : <button className="dbw-btn dbw-btn--stop" onClick={stop}>■ Stop</button>
107
+ }
108
+ {!running && breaths > 0 && (
109
+ <button className="dbw-btn dbw-btn--reset" onClick={() => setBreaths(0)}>Reset</button>
110
+ )}
111
+ </div>
112
+ </div>
113
+ )
114
+ }
frontend/src/components/Layout.jsx ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { Outlet, NavLink, useNavigate, Link } from 'react-router-dom'
3
+ import { useAuth } from '../context/AuthContext'
4
+ import { useTheme } from '../context/ThemeContext'
5
+
6
+ const NAV_MAIN = [
7
+ { to: '/app/dashboard', icon: '◈', label: 'Dashboard' },
8
+ { to: '/app/assess', icon: '⊕', label: 'New Assessment' },
9
+ { to: '/app/history', icon: '◷', label: 'History' },
10
+ ]
11
+
12
+ const NAV_WELLNESS = [
13
+ { to: '/app/breathe', icon: '🫁', label: 'Breathe Hub' },
14
+ { to: '/app/gratitude', icon: '✍️', label: 'Gratitude' },
15
+ { to: '/app/todo', icon: '✅', label: 'Daily To-Do' },
16
+ ]
17
+
18
+ export default function Layout() {
19
+ const { user, logout } = useAuth()
20
+ const { theme, toggle } = useTheme()
21
+ const navigate = useNavigate()
22
+ const [open, setOpen] = useState(false) // mobile sidebar
23
+
24
+ async function handleLogout() {
25
+ await logout()
26
+ navigate('/auth')
27
+ }
28
+
29
+ const initials = user?.username?.slice(0, 2).toUpperCase() || 'U'
30
+
31
+ return (
32
+ <div className="app-shell">
33
+ {/* Mobile top bar */}
34
+ <header className="mobile-bar">
35
+ <button className="hamburger" onClick={() => setOpen(o => !o)}>☰</button>
36
+ <Link to="/app/breathe" className="mobile-brand-link">
37
+ <img src="/logo.svg" alt="BREATHE" className="mobile-brand-logo" />
38
+ </Link>
39
+ <button className="mobile-theme-toggle" onClick={toggle} aria-label="Toggle theme">
40
+ {theme === 'dark' ? '☀️' : '🌙'}
41
+ </button>
42
+ </header>
43
+
44
+ {/* Backdrop (mobile) */}
45
+ {open && <div className="sidebar-backdrop" onClick={() => setOpen(false)} />}
46
+
47
+ <aside className={`sidebar ${open ? 'sidebar--open' : ''}`}>
48
+ <div className="sidebar-top">
49
+ <div className="sidebar-brand">
50
+ <Link to="/app/breathe" className="sidebar-brand-link" onClick={() => setOpen(false)}>
51
+ <img src="/logo.svg" alt="BREATHE" className="brand-logo" />
52
+ <div className="brand-sub">Stress Intelligence</div>
53
+ </Link>
54
+ </div>
55
+
56
+ <nav className="sidebar-nav">
57
+ <div className="nav-section-label">Overview</div>
58
+ {NAV_MAIN.map(n => (
59
+ <NavLink
60
+ key={n.to}
61
+ to={n.to}
62
+ className={({ isActive }) => `nav-link ${isActive ? 'nav-link--active' : ''}`}
63
+ onClick={() => setOpen(false)}
64
+ >
65
+ <span className="nav-icon">{n.icon}</span>
66
+ <span>{n.label}</span>
67
+ </NavLink>
68
+ ))}
69
+
70
+ <div className="nav-section-label" style={{ marginTop: '16px' }}>Wellness</div>
71
+ {NAV_WELLNESS.map(n => (
72
+ <NavLink
73
+ key={n.to}
74
+ to={n.to}
75
+ className={({ isActive }) => `nav-link ${isActive ? 'nav-link--active' : ''}`}
76
+ onClick={() => setOpen(false)}
77
+ >
78
+ <span className="nav-icon">{n.icon}</span>
79
+ <span>{n.label}</span>
80
+ </NavLink>
81
+ ))}
82
+ </nav>
83
+ </div>
84
+
85
+ <div className="sidebar-bottom">
86
+ <div className="user-chip">
87
+ <Link to="/app/profile" className="user-chip-link" onClick={() => setOpen(false)}>
88
+ {user?.avatar
89
+ ? <img src={user.avatar} alt="avatar" className="user-avatar user-avatar--img" />
90
+ : <div className="user-avatar">{initials}</div>
91
+ }
92
+ <div className="user-meta">
93
+ <div className="user-name">{user?.display_name || user?.username}</div>
94
+ <div className="user-email">{user?.email}</div>
95
+ </div>
96
+ </Link>
97
+ </div>
98
+ <button className="theme-toggle" onClick={toggle}>
99
+ <span className="theme-toggle-icon">{theme === 'dark' ? '☀️' : '🌙'}</span>
100
+ {theme === 'dark' ? 'Light mode' : 'Dark mode'}
101
+ </button>
102
+ <button className="logout-btn" onClick={handleLogout}>
103
+ ↩ Log out
104
+ </button>
105
+ </div>
106
+ </aside>
107
+
108
+ <main className="main-area">
109
+ <Outlet />
110
+ </main>
111
+ </div>
112
+ )
113
+ }
frontend/src/components/VideoBackground.jsx ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export default function VideoBackground() {
2
+ return (
3
+ <div className="video-bg-wrap">
4
+ <video
5
+ className="video-bg"
6
+ src="/bg-video.mp4"
7
+ autoPlay
8
+ muted
9
+ loop
10
+ playsInline
11
+ />
12
+ <div className="video-bg-overlay" />
13
+ </div>
14
+ )
15
+ }
frontend/src/context/AuthContext.jsx ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createContext, useContext, useState, useEffect } from 'react'
2
+ import { api } from '../api/client'
3
+
4
+ const AuthContext = createContext(null)
5
+
6
+ export function AuthProvider({ children }) {
7
+ const [user, setUser] = useState(null)
8
+ const [loading, setLoading] = useState(true)
9
+
10
+ useEffect(() => {
11
+ api.get('/api/auth/me')
12
+ .then(d => setUser(d.user))
13
+ .catch(() => setUser(null))
14
+ .finally(() => setLoading(false))
15
+ }, [])
16
+
17
+ async function login(identity, password) {
18
+ const d = await api.post('/api/auth/login', { email: identity, username: identity, password })
19
+ setUser(d.user)
20
+ return d.user
21
+ }
22
+
23
+ async function signup(username, email, password) {
24
+ const d = await api.post('/api/auth/signup', { username, email, password })
25
+ setUser(d.user)
26
+ return d.user
27
+ }
28
+
29
+ async function logout() {
30
+ await api.post('/api/auth/logout', {}).catch(() => {})
31
+ setUser(null)
32
+ }
33
+
34
+ return (
35
+ <AuthContext.Provider value={{ user, setUser, loading, login, signup, logout }}>
36
+ {children}
37
+ </AuthContext.Provider>
38
+ )
39
+ }
40
+
41
+ export const useAuth = () => useContext(AuthContext)
frontend/src/context/ThemeContext.jsx ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createContext, useContext, useEffect, useState } from 'react'
2
+
3
+ const ThemeContext = createContext()
4
+
5
+ export function ThemeProvider({ children }) {
6
+ const [theme, setTheme] = useState(() => localStorage.getItem('breathe-theme') || 'dark')
7
+
8
+ useEffect(() => {
9
+ document.documentElement.setAttribute('data-theme', theme)
10
+ localStorage.setItem('breathe-theme', theme)
11
+ }, [theme])
12
+
13
+ function toggle() {
14
+ setTheme(t => t === 'dark' ? 'light' : 'dark')
15
+ }
16
+
17
+ return (
18
+ <ThemeContext.Provider value={{ theme, toggle }}>
19
+ {children}
20
+ </ThemeContext.Provider>
21
+ )
22
+ }
23
+
24
+ export function useTheme() {
25
+ return useContext(ThemeContext)
26
+ }
frontend/src/index.css ADDED
@@ -0,0 +1,1717 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ═══════════════════════════════════════════════════════════
2
+ BREATHE — Design System
3
+ ═══════════════════════════════════════════════════════════ */
4
+
5
+ /* ─────────────────────────────────────────────────────────────
6
+ LANDING PAGE
7
+ ───────────────────────────────────────────────────────────── */
8
+
9
+ /* Root wrapper */
10
+ .lp {
11
+ background: var(--bg);
12
+ color: var(--text);
13
+ font-family: 'Inter', sans-serif;
14
+ overflow-x: hidden;
15
+ }
16
+
17
+ /* ── Shared gradient text ── */
18
+ .lp-gradient-text {
19
+ background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 60%, #f472b6 100%);
20
+ -webkit-background-clip: text;
21
+ -webkit-text-fill-color: transparent;
22
+ background-clip: text;
23
+ }
24
+
25
+ /* ── Nav ─────────────────────────────────────────────────── */
26
+ .lp-nav {
27
+ position: fixed; top: 0; left: 0; right: 0; z-index: 90;
28
+ background: rgba(var(--nav-bg-rgb, 7,9,15),.85);
29
+ backdrop-filter: blur(20px);
30
+ border-bottom: 1px solid var(--border);
31
+ }
32
+ .lp-nav-inner {
33
+ max-width: 1100px; margin: 0 auto;
34
+ display: flex; align-items: center;
35
+ padding: 0 24px; height: 64px; gap: 32px;
36
+ }
37
+ .lp-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
38
+ .lp-logo-img { height: 48px; width: auto; display: block; }
39
+ .lp-nav-links { display: flex; gap: 4px; flex: 1; }
40
+ .lp-nav-link { padding: 7px 14px; border-radius: var(--r-sm); color: var(--muted);
41
+ font-size: .88rem; font-weight: 500; transition: var(--t); text-decoration: none; }
42
+ .lp-nav-link:hover { color: var(--text); background: var(--surface2); }
43
+ .lp-nav-cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
44
+
45
+ /* Nav buttons */
46
+ .lp-btn-ghost {
47
+ padding: 8px 18px; border: 1px solid var(--border2); border-radius: var(--r-sm);
48
+ color: var(--muted2); font-size: .88rem; font-weight: 500;
49
+ background: transparent; text-decoration: none; transition: var(--t);
50
+ }
51
+ .lp-btn-ghost:hover { color: var(--text); border-color: var(--accent); }
52
+
53
+ .lp-btn-solid {
54
+ padding: 8px 18px; border-radius: var(--r-sm); border: none;
55
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
56
+ color: #fff; font-size: .88rem; font-weight: 600; text-decoration: none;
57
+ transition: opacity var(--t), box-shadow var(--t);
58
+ box-shadow: 0 4px 14px rgba(91,156,246,.3);
59
+ }
60
+ .lp-btn-solid:hover { opacity: .88; box-shadow: 0 6px 20px rgba(91,156,246,.45); }
61
+
62
+ /* ── Hero ─────────────────────────────────────────────────── */
63
+ .lp-hero {
64
+ min-height: 100vh;
65
+ display: flex; align-items: center; justify-content: center;
66
+ text-align: center;
67
+ position: relative; overflow: hidden;
68
+ padding: 120px 24px 80px;
69
+ }
70
+
71
+ /* Rings */
72
+ .lp-rings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
73
+ .lp-ring { position: absolute; border-radius: 50%; animation: lp-breathe 6s ease-in-out infinite; }
74
+ .lp-ring-1 { width: 160px; height: 160px; border: 1.5px solid rgba(91,156,246,.5); animation-delay: 0s; }
75
+ .lp-ring-2 { width: 300px; height: 300px; border: 1px solid rgba(91,156,246,.28); animation-delay: .8s; }
76
+ .lp-ring-3 { width: 460px; height: 460px; border: 1px solid rgba(167,139,250,.18);animation-delay: 1.6s; }
77
+ .lp-ring-4 { width: 640px; height: 640px; border: 1px solid rgba(167,139,250,.1); animation-delay: 2.4s; }
78
+ .lp-ring-5 { width: 860px; height: 860px; border: 1px solid rgba(91,156,246,.06); animation-delay: 3.2s; }
79
+
80
+ @keyframes lp-breathe {
81
+ 0%,100% { transform: scale(.94); opacity: .6; }
82
+ 50% { transform: scale(1.06); opacity: .2; }
83
+ }
84
+
85
+ /* Radial glow behind hero */
86
+ .lp-hero::before {
87
+ content: '';
88
+ position: absolute; inset: 0;
89
+ background: radial-gradient(ellipse 60% 50% at 50% 40%, rgba(91,156,246,.1) 0%, transparent 70%);
90
+ pointer-events: none;
91
+ }
92
+
93
+ .lp-hero-content { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
94
+
95
+ .lp-hero-badge {
96
+ display: inline-block; margin-bottom: 24px;
97
+ padding: 6px 16px; border-radius: 20px;
98
+ background: rgba(91,156,246,.1); border: 1px solid rgba(91,156,246,.25);
99
+ color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .04em;
100
+ }
101
+
102
+ .lp-hero-h1 {
103
+ font-size: clamp(2.4rem, 6vw, 4.2rem);
104
+ font-weight: 900; line-height: 1.1; letter-spacing: -.02em;
105
+ color: var(--text); margin-bottom: 22px;
106
+ }
107
+
108
+ .lp-hero-sub {
109
+ font-size: clamp(.95rem, 2vw, 1.15rem);
110
+ color: var(--muted2); line-height: 1.75;
111
+ max-width: 580px; margin: 0 auto 36px;
112
+ }
113
+
114
+ .lp-hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
115
+
116
+ /* Hero CTA buttons */
117
+ .lp-btn-hero-primary {
118
+ display: inline-flex; align-items: center; gap: 8px;
119
+ padding: 14px 32px; border-radius: var(--r-sm); border: none;
120
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
121
+ color: #fff; font-size: 1rem; font-weight: 700; text-decoration: none;
122
+ box-shadow: 0 6px 28px rgba(91,156,246,.4);
123
+ transition: opacity var(--t), transform var(--t), box-shadow var(--t);
124
+ }
125
+ .lp-btn-hero-primary:hover { opacity: .88; transform: translateY(-2px); box-shadow: 0 10px 36px rgba(91,156,246,.55); }
126
+ .lp-btn--xl { padding: 16px 40px; font-size: 1.05rem; }
127
+
128
+ .lp-btn-hero-ghost {
129
+ display: inline-flex; align-items: center; gap: 8px;
130
+ padding: 14px 32px; border-radius: var(--r-sm);
131
+ border: 1px solid var(--border2); color: var(--muted2);
132
+ font-size: 1rem; font-weight: 500; text-decoration: none;
133
+ transition: var(--t); background: transparent;
134
+ }
135
+ .lp-btn-hero-ghost:hover { color: var(--text); border-color: var(--accent); background: rgba(91,156,246,.05); }
136
+ .lp-btn-arrow { transition: transform var(--t); }
137
+ .lp-btn-hero-primary:hover .lp-btn-arrow { transform: translateX(4px); }
138
+
139
+ /* ── Stats bar ─────────────────────────────────────────────── */
140
+ .lp-stats {
141
+ display: flex; align-items: center; justify-content: center;
142
+ gap: 0; flex-wrap: wrap;
143
+ background: var(--surface);
144
+ border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
145
+ padding: 28px 24px;
146
+ }
147
+ .lp-stat { text-align: center; padding: 8px 40px; }
148
+ .lp-stat-num { font-size: 1.7rem; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
149
+ .lp-stat-lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
150
+ .lp-stat-div { width: 1px; height: 44px; background: var(--border); flex-shrink: 0; }
151
+
152
+ /* ── Sections ──────────────────────────────────────────────── */
153
+ .lp-section {
154
+ max-width: 1100px; margin: 0 auto;
155
+ padding: 96px 24px;
156
+ text-align: center;
157
+ }
158
+ .lp-section--alt {
159
+ background: var(--surface);
160
+ max-width: 100%; padding: 96px 24px;
161
+ }
162
+ .lp-section--alt > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
163
+
164
+ .lp-section-label {
165
+ font-size: .73rem; font-weight: 700; letter-spacing: .12em;
166
+ text-transform: uppercase; color: var(--accent);
167
+ margin-bottom: 14px;
168
+ }
169
+ .lp-section-h2 {
170
+ font-size: clamp(1.7rem, 4vw, 2.8rem); font-weight: 800;
171
+ line-height: 1.2; letter-spacing: -.02em; color: var(--text);
172
+ margin-bottom: 14px;
173
+ }
174
+ .lp-section-sub {
175
+ color: var(--muted2); font-size: 1rem; max-width: 520px;
176
+ margin: 0 auto 56px; line-height: 1.7;
177
+ }
178
+
179
+ /* ── Feature cards ─────────────────────────────────────────── */
180
+ .lp-features {
181
+ display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
182
+ margin-top: 56px;
183
+ }
184
+ .lp-feat-card {
185
+ background: var(--surface); border: 1px solid var(--border);
186
+ border-radius: var(--r); padding: 28px 24px; text-align: left;
187
+ transition: border-color var(--t), transform var(--t), box-shadow var(--t);
188
+ }
189
+ .lp-feat-card:hover {
190
+ border-color: var(--fc, var(--accent));
191
+ transform: translateY(-4px);
192
+ box-shadow: 0 12px 40px rgba(0,0,0,.4);
193
+ }
194
+ .lp-feat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 18px; }
195
+ .lp-feat-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
196
+ .lp-feat-desc { font-size: .875rem; color: var(--muted); line-height: 1.7; }
197
+
198
+ /* ── How it works ──────────────────────────────────────────── */
199
+ .lp-steps {
200
+ display: flex; align-items: flex-start; justify-content: center;
201
+ gap: 0; margin-top: 56px; position: relative;
202
+ max-width: 800px; margin-left: auto; margin-right: auto;
203
+ }
204
+ .lp-step {
205
+ flex: 1; display: flex; flex-direction: column; align-items: center;
206
+ text-align: center; position: relative; padding: 0 16px;
207
+ }
208
+ .lp-step-n {
209
+ width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
210
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
211
+ color: #fff; font-size: 1rem; font-weight: 800;
212
+ display: flex; align-items: center; justify-content: center;
213
+ box-shadow: 0 0 0 6px rgba(91,156,246,.15), 0 4px 18px rgba(91,156,246,.3);
214
+ margin-bottom: 20px; z-index: 1;
215
+ }
216
+ .lp-step-line {
217
+ position: absolute; top: 28px; left: calc(50% + 36px); right: calc(-50% + 36px);
218
+ height: 1px; background: linear-gradient(90deg, var(--accent), var(--accent2));
219
+ opacity: .35;
220
+ }
221
+ .lp-step-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
222
+ .lp-step-desc { font-size: .875rem; color: var(--muted); line-height: 1.65; }
223
+
224
+ /* ── Stress levels ─────────────────────────────────────────── */
225
+ .lp-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 56px; }
226
+ .lp-level-card {
227
+ background: var(--lb, rgba(91,156,246,.08));
228
+ border: 1px solid rgba(255,255,255,.06);
229
+ border-top: 3px solid var(--lc, var(--accent));
230
+ border-radius: var(--r); padding: 22px 18px; text-align: left;
231
+ transition: transform var(--t), box-shadow var(--t);
232
+ }
233
+ .lp-level-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
234
+ .lp-level-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
235
+ .lp-level-badge { padding: 4px 12px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
236
+ .lp-level-range { font-size: .75rem; color: var(--muted); }
237
+ .lp-level-desc { font-size: .82rem; color: var(--muted2); line-height: 1.55; margin-bottom: 16px; }
238
+ .lp-level-bar-track { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
239
+ .lp-level-bar-fill { height: 100%; width: 100%; border-radius: 2px; }
240
+
241
+ /* ── CTA section ───────────────────────────────────────────── */
242
+ .lp-cta {
243
+ position: relative; text-align: center;
244
+ padding: 120px 24px;
245
+ background: var(--surface);
246
+ border-top: 1px solid var(--border);
247
+ overflow: hidden;
248
+ }
249
+ .lp-cta-glow {
250
+ position: absolute; top: 50%; left: 50%;
251
+ transform: translate(-50%, -50%);
252
+ width: 600px; height: 300px;
253
+ background: radial-gradient(ellipse, rgba(91,156,246,.15) 0%, transparent 70%);
254
+ pointer-events: none;
255
+ }
256
+ .lp-cta-h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; position: relative; }
257
+ .lp-cta-sub { color: var(--muted2); font-size: 1rem; margin-bottom: 36px; position: relative; }
258
+
259
+ /* ── Footer ────────────────────────────────────────────────── */
260
+ .lp-footer {
261
+ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
262
+ gap: 14px; padding: 28px 40px;
263
+ border-top: 1px solid var(--border);
264
+ background: var(--bg);
265
+ }
266
+ .lp-footer-logo { display: flex; align-items: center; }
267
+ .lp-footer-logo-img { height: 32px; width: auto; }
268
+ .lp-footer-copy { font-size: .8rem; color: var(--muted); }
269
+ .lp-footer-links { display: flex; gap: 20px; }
270
+ .lp-footer-link { font-size: .82rem; color: var(--muted); transition: color var(--t); text-decoration: none; }
271
+ .lp-footer-link:hover { color: var(--text); }
272
+
273
+ /* ── Landing page responsive ───────────────────────────────── */
274
+ @media (max-width: 1024px) {
275
+ .lp-features { grid-template-columns: repeat(2, 1fr); }
276
+ .lp-levels { grid-template-columns: repeat(3, 1fr); }
277
+ }
278
+
279
+ @media (max-width: 768px) {
280
+ .lp-nav-links { display: none; }
281
+ .lp-hero { padding: 100px 20px 60px; }
282
+ .lp-stats { gap: 0; }
283
+ .lp-stat { padding: 8px 20px; }
284
+ .lp-stat-div { display: none; }
285
+ .lp-steps { flex-direction: column; align-items: center; gap: 32px; }
286
+ .lp-step-line { display: none; }
287
+ .lp-levels { grid-template-columns: repeat(2, 1fr); }
288
+ .lp-footer { flex-direction: column; align-items: center; text-align: center; padding: 24px 20px; }
289
+ }
290
+
291
+ @media (max-width: 540px) {
292
+ .lp-features { grid-template-columns: 1fr; }
293
+ .lp-levels { grid-template-columns: 1fr; }
294
+ .lp-nav-cta .lp-btn-ghost { display: none; }
295
+ .lp-section { padding: 64px 20px; }
296
+ .lp-cta { padding: 80px 20px; }
297
+ }
298
+
299
+ :root,
300
+ [data-theme="dark"] {
301
+ --bg: #07090f;
302
+ --surface: #0d1420;
303
+ --surface2: #121c2e;
304
+ --surface3: #192436;
305
+ --border: #1a2840;
306
+ --border2: #243554;
307
+
308
+ --accent: #5b9cf6;
309
+ --accent2: #a78bfa;
310
+ --glow: rgba(91,156,246,.2);
311
+
312
+ --text: #e2e8f0;
313
+ --muted: #64748b;
314
+ --muted2: #94a3b8;
315
+
316
+ --success: #2dd4a5;
317
+ --warning: #fbbf24;
318
+ --danger: #f87171;
319
+
320
+ --minimal: #2dd4a5;
321
+ --mild: #86efac;
322
+ --moderate: #fbbf24;
323
+ --severe: #fb923c;
324
+ --critical: #f87171;
325
+
326
+ --r: 16px;
327
+ --r-sm: 10px;
328
+ --r-xs: 6px;
329
+ --sh: 0 8px 40px rgba(0,0,0,.55);
330
+ --sh-sm:0 4px 20px rgba(0,0,0,.35);
331
+ --t: 200ms cubic-bezier(.4,0,.2,1);
332
+ --nav-bg-rgb: 7,9,15;
333
+ }
334
+
335
+ [data-theme="light"] {
336
+ /* Palette: FFDDDA · FFF4CB · CBEDD4 · E3D7FF · D0EAFF · FFF9F2 */
337
+ --bg: #FFF9F2; /* warm cream — page background */
338
+ --surface: #FFFFFF; /* pure white — cards / modals */
339
+ --surface2: #FFDDDA; /* rose petal — hover / secondary surface */
340
+ --surface3: #FFF4CB; /* soft yellow — tertiary / highlight */
341
+ --border: #F0C8C4; /* rose border (FFDDDA darkened) */
342
+ --border2: #C4E8D0; /* mint border (CBEDD4 darkened) */
343
+
344
+ --accent: #6A9FD8; /* D0EAFF deepened — interactive blue */
345
+ --accent2: #9B8BD4; /* E3D7FF deepened — interactive lavender */
346
+ --glow: rgba(208,234,255,.45);
347
+
348
+ --text: #1a1228; /* near-black with warm-purple tint */
349
+ --muted: #7a6e80;
350
+ --muted2: #5c5266;
351
+
352
+ --success: #2ea868; /* CBEDD4 deepened */
353
+ --warning: #c98a0a; /* FFF4CB deepened */
354
+ --danger: #d94f4f; /* FFDDDA deepened */
355
+
356
+ --minimal: #2ea868;
357
+ --mild: #52c48a;
358
+ --moderate: #c98a0a;
359
+ --severe: #e07030;
360
+ --critical: #d94f4f;
361
+
362
+ --sh: 0 8px 40px rgba(255,221,218,.55);
363
+ --sh-sm: 0 4px 20px rgba(227,215,255,.35);
364
+ --nav-bg-rgb: 255,249,242;
365
+ }
366
+
367
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
368
+ html { scroll-behavior: smooth; }
369
+ body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text);
370
+ font-size: 15px; line-height: 1.6; min-height: 100vh; }
371
+ a { text-decoration: none; }
372
+ button { font-family: inherit; cursor: pointer; }
373
+
374
+ /* ── Scrollbar ─────────────────────────────────────────────── */
375
+ ::-webkit-scrollbar { width: 6px; }
376
+ ::-webkit-scrollbar-track { background: var(--bg); }
377
+ ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
378
+
379
+ /* ── Loaders ───────────────────────────────────────────────── */
380
+ .full-loader { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
381
+ .page-loader { display: flex; align-items: center; justify-content: center; min-height: 40vh; }
382
+ .spinner { width: 32px; height: 32px; border: 3px solid var(--border2);
383
+ border-top-color: var(--accent); border-radius: 50%;
384
+ animation: spin .7s linear infinite; }
385
+ @keyframes spin { to { transform: rotate(360deg); } }
386
+
387
+ /* ─────────────────────────────────────────────────────────────
388
+ AUTH SCREEN
389
+ ───────────────────────────────────────────────────────────── */
390
+ .auth-screen {
391
+ min-height: 100vh;
392
+ display: flex; align-items: center; justify-content: center;
393
+ background: var(--bg);
394
+ position: relative; overflow: hidden;
395
+ }
396
+
397
+ /* Breathing rings animation */
398
+ .breath-rings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
399
+ .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(91,156,246,.18); animation: breathe 5s ease-in-out infinite; }
400
+ .ring-1 { width: 180px; height: 180px; animation-delay: 0s; border-color: rgba(91,156,246,.35); }
401
+ .ring-2 { width: 320px; height: 320px; animation-delay: .7s; border-color: rgba(91,156,246,.2); }
402
+ .ring-3 { width: 480px; height: 480px; animation-delay: 1.4s; border-color: rgba(167,139,250,.12); }
403
+ .ring-4 { width: 660px; height: 660px; animation-delay: 2.1s; border-color: rgba(167,139,250,.07); }
404
+
405
+ @keyframes breathe {
406
+ 0%,100% { transform: scale(.95); opacity: .5; }
407
+ 50% { transform: scale(1.05); opacity: .2; }
408
+ }
409
+
410
+ .auth-card {
411
+ position: relative; z-index: 1;
412
+ background: rgba(13,20,32,.9);
413
+ backdrop-filter: blur(24px);
414
+ border: 1px solid var(--border2);
415
+ border-radius: var(--r);
416
+ padding: 44px 40px;
417
+ width: 100%; max-width: 420px;
418
+ box-shadow: var(--sh), 0 0 80px rgba(91,156,246,.1);
419
+ }
420
+
421
+ .auth-brand { text-align: center; margin-bottom: 28px; }
422
+ .auth-logo { height: 100px; width: auto; display: block; margin: 0 auto 8px; }
423
+ .auth-title { font-size: 1.9rem; font-weight: 800; letter-spacing: .08em;
424
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
425
+ -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
426
+ .auth-subtitle { color: var(--muted); font-size: .85rem; margin-top: 4px; }
427
+
428
+ .auth-tabs { display: flex; background: var(--bg); border-radius: var(--r-sm); padding: 4px; margin-bottom: 24px; }
429
+ .auth-tab { flex: 1; padding: 9px; border: none; border-radius: 7px; background: transparent;
430
+ color: var(--muted); font-size: .9rem; font-weight: 500; transition: var(--t); }
431
+ .auth-tab--active { background: var(--surface2); color: var(--text); box-shadow: var(--sh-sm); }
432
+
433
+ .auth-form { display: flex; flex-direction: column; gap: 14px; }
434
+
435
+ /* ─────────────────���───────────────────────────────────────────
436
+ FORM ELEMENTS
437
+ ───────────────────────────────────────────────────────────── */
438
+ .field { display: flex; flex-direction: column; gap: 6px; }
439
+ .field label { font-size: .78rem; font-weight: 600; color: var(--muted2);
440
+ text-transform: uppercase; letter-spacing: .05em; }
441
+ .field label small { text-transform: none; font-weight: 400; color: var(--muted); }
442
+
443
+ input[type=text], input[type=email], input[type=password], input[type=number],
444
+ select, textarea {
445
+ width: 100%; padding: 11px 14px;
446
+ background: var(--bg); border: 1px solid var(--border);
447
+ border-radius: var(--r-sm); color: var(--text);
448
+ font-size: .92rem; font-family: inherit; outline: none;
449
+ transition: border-color var(--t), box-shadow var(--t);
450
+ }
451
+ input:focus, select:focus, textarea:focus {
452
+ border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,156,246,.14);
453
+ }
454
+ input::placeholder { color: var(--muted); }
455
+ select option { background: var(--surface2); }
456
+ textarea { resize: vertical; }
457
+
458
+ .form-error {
459
+ background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.35);
460
+ border-radius: var(--r-sm); color: var(--danger);
461
+ padding: 10px 14px; font-size: .88rem; margin-bottom: 4px;
462
+ }
463
+
464
+ /* ── Buttons ───────────────────────────────────────────────── */
465
+ .btn-primary {
466
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px;
467
+ padding: 11px 24px; border: none; border-radius: var(--r-sm);
468
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
469
+ color: #fff; font-size: .95rem; font-weight: 600;
470
+ transition: opacity var(--t), transform var(--t), box-shadow var(--t);
471
+ box-shadow: 0 4px 18px rgba(91,156,246,.35);
472
+ letter-spacing: .01em;
473
+ }
474
+ .btn-primary:hover { opacity: .88; transform: translateY(-2px); box-shadow: 0 8px 28px rgba(91,156,246,.5); }
475
+ .btn-primary:active { opacity: 1; transform: translateY(0); }
476
+ .btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
477
+ .btn--full { width: 100%; }
478
+ .btn--lg { padding: 13px 32px; font-size: 1rem; }
479
+
480
+ .btn-secondary {
481
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
482
+ padding: 10px 22px; border: 1px solid var(--accent);
483
+ border-radius: var(--r-sm); color: var(--accent);
484
+ font-size: .9rem; font-weight: 500; background: transparent;
485
+ transition: var(--t);
486
+ }
487
+ .btn-secondary:hover { background: rgba(91,156,246,.1); border-color: var(--accent2); }
488
+
489
+ .btn-ghost {
490
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
491
+ padding: 9px 18px; border: 1px solid var(--border2);
492
+ border-radius: var(--r-sm); color: var(--muted2);
493
+ font-size: .88rem; font-weight: 500; background: transparent;
494
+ transition: var(--t);
495
+ }
496
+ .btn-ghost:hover { color: var(--text); border-color: var(--accent); background: rgba(91,156,246,.05); }
497
+
498
+ .btn-spinner {
499
+ display: inline-block; width: 16px; height: 16px;
500
+ border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
501
+ border-radius: 50%; animation: spin .7s linear infinite;
502
+ }
503
+
504
+ /* ─────────────────────────────────────────────────────────────
505
+ APP SHELL
506
+ ───────────────────────────────────────────────────────────── */
507
+ .app-shell { display: flex; min-height: 100vh; }
508
+
509
+ /* Mobile bar */
510
+ .mobile-bar {
511
+ display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 50;
512
+ height: 56px; background: var(--surface);
513
+ border-bottom: 1px solid var(--border);
514
+ align-items: center; gap: 14px; padding: 0 16px;
515
+ }
516
+ .hamburger { background: none; border: none; color: var(--text); font-size: 1.3rem; }
517
+ .mobile-brand { font-weight: 700; font-size: 1rem; color: var(--accent); letter-spacing: .05em; }
518
+
519
+ /* Sidebar */
520
+ .sidebar {
521
+ width: 248px; flex-shrink: 0;
522
+ background: var(--surface);
523
+ border-right: 1px solid var(--border);
524
+ display: flex; flex-direction: column;
525
+ position: sticky; top: 0; height: 100vh;
526
+ }
527
+ .sidebar-top { flex: 1; padding: 20px 12px 0; overflow-y: auto; }
528
+ .sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }
529
+
530
+ .sidebar-brand {
531
+ display: flex; align-items: center; gap: 10px;
532
+ margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
533
+ }
534
+ .brand-logo { height: 52px; width: auto; display: block; }
535
+ .mobile-brand-logo { height: 32px; width: auto; display: block; }
536
+ .mobile-theme-toggle {
537
+ background: none; border: none; font-size: 1.2rem;
538
+ cursor: pointer; padding: 4px 8px; border-radius: var(--r-xs);
539
+ transition: var(--t); line-height: 1;
540
+ }
541
+ .mobile-theme-toggle:hover { background: var(--surface2); }
542
+ .brand-name { font-size: .95rem; font-weight: 800; color: var(--accent); letter-spacing: .06em; }
543
+ .brand-sub { font-size: .68rem; color: var(--muted); margin-top: 1px; }
544
+
545
+ .sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
546
+ .nav-section-label {
547
+ font-size: .67rem; font-weight: 700; letter-spacing: .1em;
548
+ text-transform: uppercase; color: var(--muted); padding: 6px 12px 4px;
549
+ margin-top: 4px;
550
+ }
551
+ .nav-link {
552
+ display: flex; align-items: center; gap: 10px;
553
+ padding: 9px 12px; border-radius: var(--r-sm);
554
+ color: var(--muted); font-size: .88rem; font-weight: 500;
555
+ transition: var(--t); position: relative;
556
+ border-left: 2px solid transparent;
557
+ }
558
+ .nav-link:hover { background: var(--surface2); color: var(--text); border-left-color: var(--border2); }
559
+ .nav-link--active { background: rgba(91,156,246,.1); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
560
+ .nav-link--active .nav-icon { filter: drop-shadow(0 0 5px var(--accent)); }
561
+ .nav-icon { font-size: 1rem; flex-shrink: 0; }
562
+
563
+ .user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
564
+ .user-avatar {
565
+ width: 34px; height: 34px; border-radius: 50%;
566
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
567
+ display: flex; align-items: center; justify-content: center;
568
+ font-size: .78rem; font-weight: 700; color: #fff; flex-shrink: 0;
569
+ border: 2px solid rgba(91,156,246,.3);
570
+ }
571
+ .user-meta { min-width: 0; }
572
+ .user-name { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
573
+ .user-email { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
574
+ .logout-btn {
575
+ width: 100%; padding: 8px 12px;
576
+ background: none; border: 1px solid var(--border);
577
+ border-radius: var(--r-sm); color: var(--muted);
578
+ font-size: .82rem; transition: var(--t);
579
+ display: flex; align-items: center; justify-content: center; gap: 6px;
580
+ }
581
+ .logout-btn:hover { color: var(--danger); border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.05); }
582
+
583
+ /* Theme toggle */
584
+ .theme-toggle {
585
+ width: 100%; padding: 8px 12px; margin-bottom: 6px;
586
+ background: none; border: 1px solid var(--border);
587
+ border-radius: var(--r-sm); color: var(--muted);
588
+ font-size: .82rem; transition: var(--t);
589
+ display: flex; align-items: center; justify-content: center; gap: 8px;
590
+ }
591
+ .theme-toggle:hover { color: var(--text); border-color: var(--accent); background: rgba(91,156,246,.06); }
592
+ .theme-toggle-icon { font-size: 1rem; line-height: 1; }
593
+
594
+ /* Main area */
595
+ .main-area { flex: 1; overflow-y: auto; min-width: 0; }
596
+
597
+ /* ─────────────────────────────────────────────────────────────
598
+ PAGE LAYOUT
599
+ ───────────────────────────────────────────────────────────── */
600
+ .page { max-width: 1080px; margin: 0 auto; padding: 36px 32px; animation: pageIn .25s ease; }
601
+ .page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
602
+ .page-title { font-size: 1.7rem; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
603
+ .page-sub { color: var(--muted); font-size: .88rem; margin-top: 4px; }
604
+
605
+ @keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
606
+
607
+ /* ─────────────────────────────────────────────────────────────
608
+ CARDS
609
+ ───────────────────────────────────────────────────────────── */
610
+ .card {
611
+ background: var(--surface); border: 1px solid var(--border);
612
+ border-radius: var(--r); padding: 24px; margin-bottom: 20px;
613
+ box-shadow: var(--sh-sm);
614
+ transition: border-color var(--t), box-shadow var(--t);
615
+ }
616
+ .card:hover { border-color: var(--border2); }
617
+ .card-title {
618
+ font-size: .72rem; font-weight: 700; color: var(--muted);
619
+ text-transform: uppercase; letter-spacing: .1em; margin-bottom: 16px;
620
+ }
621
+ .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
622
+
623
+ /* ─────────────────────────────────────────────────────────────
624
+ STAT CARDS
625
+ ───────────────────────────────────────────────────────────── */
626
+ .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
627
+ .stat-card {
628
+ background: var(--surface); border: 1px solid var(--border);
629
+ border-radius: var(--r); padding: 20px 18px;
630
+ transition: border-color var(--t), transform var(--t), box-shadow var(--t);
631
+ position: relative; overflow: hidden;
632
+ }
633
+ .stat-card::before {
634
+ content: '';
635
+ position: absolute; top: 0; left: 0; right: 0; height: 3px;
636
+ background: linear-gradient(90deg, var(--accent), var(--accent2));
637
+ opacity: 0; transition: opacity var(--t);
638
+ }
639
+ .stat-card:hover { border-color: var(--border2); transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
640
+ .stat-card:hover::before { opacity: 1; }
641
+ .stat-icon { font-size: 1.5rem; margin-bottom: 12px; }
642
+ .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 6px; letter-spacing: -.02em; }
643
+ .stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
644
+
645
+ .trend--up { color: var(--danger) !important; }
646
+ .trend--down { color: var(--success) !important; }
647
+ .trend--flat { color: var(--muted) !important; }
648
+
649
+ /* ─────────────────────────────────────────────────────────────
650
+ DASHBOARD — RECENT LIST
651
+ ───────────────────────────────────────────────────────────── */
652
+ .recent-list { display: flex; flex-direction: column; gap: 6px; }
653
+ .recent-item {
654
+ display: flex; align-items: center; justify-content: space-between;
655
+ padding: 11px 14px; background: var(--surface2); border-radius: var(--r-sm);
656
+ cursor: pointer; border: 1px solid transparent; transition: var(--t);
657
+ }
658
+ .recent-item:hover { border-color: var(--border2); background: var(--surface3); transform: translateX(3px); }
659
+ .recent-left { display: flex; align-items: center; gap: 12px; }
660
+ .level-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
661
+ .recent-label { font-size: .88rem; font-weight: 600; }
662
+ .recent-date { font-size: .75rem; color: var(--muted); margin-top: 2px; }
663
+ .recent-score { font-size: .9rem; font-weight: 700; }
664
+ .empty-text { color: var(--muted); font-size: .9rem; text-align: center; padding: 24px 0; }
665
+
666
+ /* ─────────────────────────────────────────────────────────────
667
+ EMPTY STATE
668
+ ───────────────────────────────────────────────────────────── */
669
+ .empty-dashboard {
670
+ text-align: center; padding: 80px 24px;
671
+ background: var(--surface); border: 1px dashed var(--border2);
672
+ border-radius: var(--r);
673
+ }
674
+ .empty-icon { font-size: 3.5rem; margin-bottom: 16px; display: block; }
675
+ .empty-dashboard h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
676
+ .empty-dashboard p { color: var(--muted); margin-bottom: 24px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.6; }
677
+
678
+ /* ─────────────────────────────────────────────────────────────
679
+ ASSESSMENT FORM
680
+ ───────────────────────────────────────────────────────────── */
681
+ .section-card { margin-bottom: 20px; }
682
+ .section-head {
683
+ display: flex; align-items: flex-start; gap: 14px;
684
+ margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
685
+ }
686
+ .section-head h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
687
+ .section-icon-lg { font-size: 1.6rem; flex-shrink: 0; margin-top: 2px; }
688
+ .section-desc { font-size: .85rem; color: var(--muted); }
689
+ .badge-optional { margin-left: auto; padding: 3px 10px; border-radius: 20px; font-size: .73rem; font-weight: 600;
690
+ background: rgba(100,116,139,.12); color: var(--muted); border: 1px solid rgba(100,116,139,.25); flex-shrink: 0; }
691
+
692
+ /* Sliders */
693
+ .slider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-bottom: 18px; }
694
+ .slider-field { display: flex; flex-direction: column; gap: 6px; }
695
+ .slider-header { display: flex; justify-content: space-between; align-items: center; }
696
+ .slider-header label { font-size: .78rem; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: .05em; }
697
+ .slider-value { font-size: .85rem; font-weight: 700; color: var(--accent); min-width: 48px; text-align: right; }
698
+ .slider-range { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: 1px; }
699
+
700
+ input[type=range] {
701
+ -webkit-appearance: none; width: 100%; height: 4px;
702
+ background: var(--border2); border-radius: 2px; outline: none; padding: 0;
703
+ border: none; box-shadow: none;
704
+ }
705
+ input[type=range]::-webkit-slider-thumb {
706
+ -webkit-appearance: none; width: 16px; height: 16px;
707
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
708
+ border-radius: 50%; cursor: pointer;
709
+ box-shadow: 0 0 0 3px rgba(91,156,246,.2);
710
+ transition: box-shadow var(--t);
711
+ }
712
+ input[type=range]::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(91,156,246,.3); }
713
+ input[type=range]:focus { box-shadow: none; }
714
+
715
+ .cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
716
+
717
+ /* ─────────────────────────────────────────────────────────────
718
+ RESULT PAGE
719
+ ───────────────────────────────────────────────────────────── */
720
+ .result-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
721
+ .result-main { text-align: center; }
722
+ .result-side { }
723
+ .result-actions { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
724
+
725
+ /* Gauge */
726
+ .gauge-wrap { position: relative; width: 200px; height: 200px; margin: 12px auto 8px; }
727
+ .gauge-svg { width: 100%; height: 100%; }
728
+ .gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
729
+ .gauge-pct { font-size: 2.2rem; font-weight: 800; line-height: 1; }
730
+ .gauge-lbl { font-size: .85rem; font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
731
+
732
+ /* Breakdown */
733
+ .breakdown-list { display: flex; flex-direction: column; gap: 8px; }
734
+ .breakdown-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--surface2); border-radius: var(--r-sm); }
735
+ .breakdown-item--main { border: 1px solid var(--border2); background: var(--surface3); }
736
+ .breakdown-key { font-size: .82rem; color: var(--muted); }
737
+ .breakdown-right { display: flex; align-items: center; gap: 8px; }
738
+ .breakdown-label { font-size: .88rem; font-weight: 600; }
739
+ .breakdown-score { font-size: .82rem; color: var(--muted2); }
740
+ .modality-badge { padding: 3px 10px; border-radius: 20px; font-size: .76rem; font-weight: 600;
741
+ background: var(--surface3); color: var(--muted2); border: 1px solid var(--border); text-transform: capitalize; }
742
+ .muted { color: var(--muted); }
743
+
744
+ /* Advice box */
745
+ .advice-box {
746
+ padding: 16px 18px; border-radius: var(--r-sm);
747
+ border-left: 4px solid var(--accent);
748
+ background: rgba(91,156,246,.07);
749
+ font-size: .9rem; line-height: 1.7; color: var(--muted2);
750
+ position: relative;
751
+ }
752
+
753
+ /* Detail grid */
754
+ .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
755
+ .detail-item { background: var(--surface2); padding: 10px 14px; border-radius: var(--r-sm); }
756
+ .detail-key { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
757
+ .detail-val { font-size: .92rem; font-weight: 600; }
758
+ .detail-note { margin-bottom: 12px; }
759
+ .detail-note-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; font-weight: 600; }
760
+ .detail-note p { background: var(--surface2); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; line-height: 1.6; }
761
+
762
+ /* ─────────────────────────────────────────────────────────────
763
+ DASHBOARD LAYOUT (main + activity side panel)
764
+ ───────────────────────────────────────────────────────────── */
765
+ .dash-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
766
+ .dash-main { min-width: 0; }
767
+ .dash-side { position: sticky; top: 24px; }
768
+
769
+ /* ─────────────────────────────────────────────────────────────
770
+ ACTIVITY PANEL
771
+ ───────────────────────────────────────────────────────────── */
772
+ .activity-panel { padding: 20px; }
773
+ .activity-list { display: flex; flex-direction: column; gap: 6px; }
774
+
775
+ .activity-item {
776
+ border-radius: var(--r-sm);
777
+ overflow: hidden;
778
+ border: 1px solid var(--border);
779
+ transition: border-color var(--t);
780
+ }
781
+ .activity-item:hover { border-color: var(--ac, var(--accent)); }
782
+
783
+ .activity-header {
784
+ display: flex; align-items: center; gap: 10px;
785
+ width: 100%; padding: 10px 12px;
786
+ background: none; border: none; cursor: pointer;
787
+ text-align: left; color: var(--text);
788
+ }
789
+ .activity-header:hover { background: var(--surface2); }
790
+
791
+ .activity-icon {
792
+ width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
793
+ display: flex; align-items: center; justify-content: center;
794
+ font-size: 1rem;
795
+ }
796
+ .activity-meta { flex: 1; min-width: 0; }
797
+ .activity-title { display: block; font-size: .88rem; font-weight: 600; color: var(--text); }
798
+ .activity-dur { display: block; font-size: .73rem; color: var(--muted); margin-top: 1px; }
799
+ .activity-chevron {
800
+ font-size: 1.1rem; color: var(--muted); transition: transform var(--t); line-height: 1;
801
+ }
802
+ .activity-chevron--open { transform: rotate(90deg); color: var(--ac, var(--accent)); }
803
+
804
+ .activity-steps {
805
+ list-style: none; padding: 0 12px 12px 12px;
806
+ background: var(--surface2); counter-reset: step;
807
+ display: flex; flex-direction: column; gap: 6px;
808
+ }
809
+ .activity-steps li {
810
+ counter-increment: step;
811
+ font-size: .8rem; color: var(--muted2); line-height: 1.5;
812
+ padding-left: 22px; position: relative;
813
+ }
814
+ .activity-steps li::before {
815
+ content: counter(step);
816
+ position: absolute; left: 0;
817
+ width: 16px; height: 16px; border-radius: 50%;
818
+ background: var(--ac, var(--accent)); color: #fff;
819
+ font-size: .65rem; font-weight: 700;
820
+ display: flex; align-items: center; justify-content: center;
821
+ top: 1px;
822
+ }
823
+
824
+ /* ─────────────────────────────────────────────────────────────
825
+ HISTORY PAGE
826
+ ───────────────────────────────────────────────────────────── */
827
+ .history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; margin-bottom: 20px; }
828
+ .history-card {
829
+ background: var(--surface); border: 1px solid var(--border);
830
+ border-radius: var(--r); padding: 18px; cursor: pointer;
831
+ transition: border-color var(--t), transform var(--t), box-shadow var(--t);
832
+ border-top: 3px solid var(--level-color, var(--border));
833
+ position: relative; overflow: hidden;
834
+ }
835
+ .history-card::after {
836
+ content: '';
837
+ position: absolute; inset: 0; border-radius: var(--r);
838
+ background: radial-gradient(ellipse at top left, rgba(91,156,246,.05) 0%, transparent 60%);
839
+ pointer-events: none; opacity: 0; transition: opacity var(--t);
840
+ }
841
+ .history-card:hover { border-color: var(--level-color, var(--border2)); transform: translateY(-3px); box-shadow: 0 10px 36px rgba(0,0,0,.45); }
842
+ .history-card:hover::after { opacity: 1; }
843
+
844
+ .hc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
845
+ .hc-badge { padding: 4px 12px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
846
+ .hc-score { font-size: 1.3rem; font-weight: 800; color: var(--text); }
847
+
848
+ .hc-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
849
+ .hc-bar-wrap { display: flex; flex-direction: column; gap: 3px; }
850
+ .hc-bar-label{ font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
851
+ .hc-bar-track{ height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
852
+ .hc-bar-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(.4,0,.2,1); }
853
+
854
+ .hc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
855
+ .hc-modality { font-size: .73rem; color: var(--muted2); background: var(--surface2); padding: 2px 8px; border-radius: 10px; text-transform: capitalize; }
856
+ .hc-date { font-size: .74rem; color: var(--muted); }
857
+
858
+ /* Pagination */
859
+ .pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
860
+ .page-btn { padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface); color: var(--muted); font-size: .85rem; transition: var(--t); }
861
+ .page-btn:hover, .page-btn--active { border-color: var(--accent); color: var(--accent); background: rgba(91,156,246,.08); }
862
+ .page-btn:disabled { opacity: .4; cursor: not-allowed; }
863
+
864
+ /* ─────────────────────────────────────────────────────────────
865
+ MODAL
866
+ ───────────────────────────────────────────────────────────── */
867
+ .modal-overlay {
868
+ position: fixed; inset: 0; z-index: 100;
869
+ display: flex; align-items: center; justify-content: center;
870
+ background: rgba(0,0,0,.75); backdrop-filter: blur(10px);
871
+ animation: fadeIn .15s ease;
872
+ }
873
+ .modal-box {
874
+ position: relative; background: var(--surface);
875
+ border: 1px solid var(--border2); border-radius: var(--r);
876
+ padding: 28px 30px; width: 90%; max-width: 520px;
877
+ max-height: 85vh; overflow-y: auto; box-shadow: var(--sh), 0 0 60px rgba(0,0,0,.5);
878
+ animation: slideUp .2s ease;
879
+ }
880
+ .modal-close {
881
+ position: absolute; top: 14px; right: 16px; background: none; border: none;
882
+ color: var(--muted); font-size: 1.1rem;
883
+ width: 28px; height: 28px; border-radius: 50%;
884
+ display: flex; align-items: center; justify-content: center;
885
+ transition: background var(--t), color var(--t);
886
+ }
887
+ .modal-close:hover { color: var(--text); background: var(--surface2); }
888
+ .modal-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; letter-spacing: -.01em; }
889
+
890
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
891
+ @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
892
+
893
+ /* ─────────────────────────────────────────────────────────────
894
+ MOBILE
895
+ ───────────────────────────────────────────────────────────── */
896
+ .sidebar-backdrop { display: none; }
897
+
898
+ @media (max-width: 860px) {
899
+ .main-area { padding-top: 56px; }
900
+ .mobile-bar { display: flex; }
901
+ .sidebar { position: fixed; left: -240px; top: 0; height: 100vh; z-index: 60; transition: left var(--t); }
902
+ .sidebar--open { left: 0; box-shadow: var(--sh); }
903
+ .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.5); }
904
+ .stat-grid { grid-template-columns: repeat(2, 1fr); }
905
+ .two-col { grid-template-columns: 1fr; }
906
+ .result-layout { grid-template-columns: 1fr; }
907
+ .page { padding: 20px 16px; }
908
+ .history-grid { grid-template-columns: 1fr; }
909
+ .detail-grid { grid-template-columns: 1fr; }
910
+ /* Dashboard: stack side panel below main on tablet */
911
+ .dash-layout { grid-template-columns: 1fr; }
912
+ .dash-side { position: static; }
913
+ }
914
+
915
+ @media (max-width: 480px) {
916
+ .stat-grid { grid-template-columns: 1fr 1fr; }
917
+ .slider-grid { grid-template-columns: 1fr; }
918
+ .cat-grid { grid-template-columns: 1fr; }
919
+ }
920
+
921
+ /* ═══════════════════════════════════════════════
922
+ PROFILE PAGE
923
+ ═══════════════════════════════════════════════ */
924
+ .profile-page {
925
+ max-width: 720px;
926
+ margin: 0 auto;
927
+ padding: 32px 24px 60px;
928
+ }
929
+
930
+ .profile-header-bar {
931
+ margin-bottom: 32px;
932
+ }
933
+ .profile-header-bar .page-title {
934
+ font-size: 1.8rem;
935
+ font-weight: 700;
936
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
937
+ -webkit-background-clip: text;
938
+ -webkit-text-fill-color: transparent;
939
+ margin-bottom: 4px;
940
+ }
941
+ .profile-header-bar .page-sub {
942
+ color: var(--muted);
943
+ font-size: .9rem;
944
+ }
945
+
946
+ .profile-form { display: flex; flex-direction: column; gap: 28px; }
947
+
948
+ .profile-section {
949
+ background: var(--surface);
950
+ border: 1px solid var(--border);
951
+ border-radius: 16px;
952
+ padding: 24px;
953
+ }
954
+ .section-title {
955
+ font-size: 1rem;
956
+ font-weight: 600;
957
+ color: var(--text);
958
+ margin-bottom: 18px;
959
+ letter-spacing: .03em;
960
+ }
961
+
962
+ /* Avatar upload */
963
+ .avatar-upload-row {
964
+ display: flex;
965
+ align-items: center;
966
+ gap: 20px;
967
+ flex-wrap: wrap;
968
+ }
969
+ .avatar-large {
970
+ position: relative;
971
+ width: 88px;
972
+ height: 88px;
973
+ border-radius: 50%;
974
+ background: linear-gradient(135deg, #1a2840, #1e3060);
975
+ border: 2px solid var(--border);
976
+ cursor: pointer;
977
+ overflow: hidden;
978
+ flex-shrink: 0;
979
+ transition: border-color .2s;
980
+ }
981
+ .avatar-large:hover { border-color: var(--accent); }
982
+ .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
983
+ .avatar-initials {
984
+ position: absolute;
985
+ inset: 0;
986
+ display: flex;
987
+ align-items: center;
988
+ justify-content: center;
989
+ font-size: 1.6rem;
990
+ font-weight: 700;
991
+ color: var(--accent);
992
+ letter-spacing: .05em;
993
+ }
994
+ .avatar-overlay {
995
+ position: absolute;
996
+ inset: 0;
997
+ background: rgba(0,0,0,.5);
998
+ display: flex;
999
+ align-items: center;
1000
+ justify-content: center;
1001
+ font-size: 1.3rem;
1002
+ opacity: 0;
1003
+ transition: opacity .2s;
1004
+ }
1005
+ .avatar-large:hover .avatar-overlay { opacity: 1; }
1006
+
1007
+ .avatar-actions {
1008
+ display: flex;
1009
+ flex-direction: column;
1010
+ gap: 8px;
1011
+ align-items: flex-start;
1012
+ }
1013
+ .avatar-hint { font-size: .75rem; color: var(--muted); }
1014
+
1015
+ .btn-ghost-danger {
1016
+ background: transparent;
1017
+ border: 1px solid #ef4444;
1018
+ color: #ef4444;
1019
+ padding: 6px 14px;
1020
+ border-radius: 8px;
1021
+ cursor: pointer;
1022
+ font-size: .82rem;
1023
+ transition: background .2s;
1024
+ }
1025
+ .btn-ghost-danger:hover { background: rgba(239,68,68,.1); }
1026
+
1027
+ /* Profile grid (2-col) */
1028
+ .profile-grid {
1029
+ display: grid;
1030
+ grid-template-columns: 1fr 1fr;
1031
+ gap: 16px;
1032
+ }
1033
+ @media (max-width: 540px) { .profile-grid { grid-template-columns: 1fr; } }
1034
+
1035
+ .form-select {
1036
+ width: 100%;
1037
+ background: var(--bg);
1038
+ border: 1px solid var(--border);
1039
+ color: var(--text);
1040
+ border-radius: 10px;
1041
+ padding: 10px 12px;
1042
+ font-size: .88rem;
1043
+ outline: none;
1044
+ transition: border-color .2s;
1045
+ appearance: none;
1046
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
1047
+ background-repeat: no-repeat;
1048
+ background-position: right 12px center;
1049
+ padding-right: 36px;
1050
+ }
1051
+ .form-select:focus { border-color: var(--accent); }
1052
+ .form-select option { background: #0d1420; }
1053
+
1054
+ .form-textarea {
1055
+ width: 100%;
1056
+ background: var(--bg);
1057
+ border: 1px solid var(--border);
1058
+ color: var(--text);
1059
+ border-radius: 10px;
1060
+ padding: 10px 12px;
1061
+ font-size: .88rem;
1062
+ font-family: inherit;
1063
+ resize: vertical;
1064
+ outline: none;
1065
+ transition: border-color .2s;
1066
+ box-sizing: border-box;
1067
+ }
1068
+ .form-textarea:focus { border-color: var(--accent); }
1069
+ .char-count { text-align: right; font-size: .75rem; color: var(--muted); margin-top: 4px; }
1070
+
1071
+ .form-hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
1072
+
1073
+ /* Privacy card */
1074
+ .profile-privacy {}
1075
+ .privacy-card {
1076
+ display: flex;
1077
+ align-items: flex-start;
1078
+ gap: 16px;
1079
+ background: rgba(91,156,246,.06);
1080
+ border: 1px solid rgba(91,156,246,.18);
1081
+ border-radius: 12px;
1082
+ padding: 16px;
1083
+ }
1084
+ .privacy-icon { font-size: 1.5rem; flex-shrink: 0; padding-top: 2px; }
1085
+ .privacy-text { flex: 1; }
1086
+ .privacy-text strong { display: block; margin-bottom: 4px; color: var(--text); font-size: .92rem; }
1087
+ .privacy-text p { font-size: .82rem; color: var(--muted); line-height: 1.5; margin: 0; }
1088
+
1089
+ .anon-notice {
1090
+ margin-top: 12px;
1091
+ padding: 10px 14px;
1092
+ background: rgba(167,139,250,.08);
1093
+ border: 1px solid rgba(167,139,250,.25);
1094
+ border-radius: 10px;
1095
+ font-size: .83rem;
1096
+ color: var(--accent2);
1097
+ }
1098
+
1099
+ /* Toggle switch */
1100
+ .toggle-switch { display: inline-flex; cursor: pointer; flex-shrink: 0; margin-top: 4px; }
1101
+ .toggle-switch input { display: none; }
1102
+ .toggle-track {
1103
+ width: 44px;
1104
+ height: 24px;
1105
+ background: var(--border);
1106
+ border-radius: 999px;
1107
+ position: relative;
1108
+ transition: background .25s;
1109
+ }
1110
+ .toggle-switch input:checked + .toggle-track { background: var(--accent); }
1111
+ .toggle-thumb {
1112
+ position: absolute;
1113
+ top: 3px;
1114
+ left: 3px;
1115
+ width: 18px;
1116
+ height: 18px;
1117
+ background: #fff;
1118
+ border-radius: 50%;
1119
+ transition: transform .25s;
1120
+ box-shadow: 0 1px 4px rgba(0,0,0,.4);
1121
+ }
1122
+ .toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }
1123
+
1124
+ /* Actions row */
1125
+ .profile-actions { display: flex; justify-content: flex-end; gap: 12px; }
1126
+
1127
+ /* Sidebar avatar img support */
1128
+ .user-chip-link {
1129
+ display: flex;
1130
+ align-items: center;
1131
+ gap: 10px;
1132
+ text-decoration: none;
1133
+ color: inherit;
1134
+ width: 100%;
1135
+ border-radius: 10px;
1136
+ padding: 8px;
1137
+ transition: background .15s;
1138
+ }
1139
+ .user-chip-link:hover { background: rgba(255,255,255,.05); }
1140
+ .user-avatar--img {
1141
+ object-fit: cover;
1142
+ border-radius: 50%;
1143
+ width: 34px;
1144
+ height: 34px;
1145
+ flex-shrink: 0;
1146
+ }
1147
+
1148
+ /* form-error / form-success (if not already defined) */
1149
+ .form-error { color: #ef4444; font-size: .85rem; padding: 8px 12px; background: rgba(239,68,68,.08); border-radius: 8px; }
1150
+ .form-success { color: #22c55e; font-size: .85rem; padding: 8px 12px; background: rgba(34,197,94,.08); border-radius: 8px; }
1151
+
1152
+ /* Sidebar brand link */
1153
+ .sidebar-brand-link {
1154
+ display: flex; align-items: center; gap: 10px;
1155
+ text-decoration: none; color: inherit;
1156
+ border-radius: 10px; padding: 6px 8px; margin: -6px -8px;
1157
+ transition: background .15s;
1158
+ }
1159
+ .sidebar-brand-link:hover { background: rgba(255,255,255,.05); }
1160
+ .mobile-brand-link { text-decoration: none; color: inherit; font-weight: 600; font-size: 1rem; }
1161
+
1162
+ /* ═══════════════════════════════════════════════
1163
+ BREATHE HUB PAGE
1164
+ ═══════════════════════════════════════════════ */
1165
+ .breathe-hub { max-width: 960px; margin: 0 auto; padding: 32px 24px 60px; }
1166
+ .breathe-hub-actions {
1167
+ display: flex;
1168
+ gap: 10px;
1169
+ justify-content: center;
1170
+ flex-wrap: wrap;
1171
+ margin-top: 20px;
1172
+ }
1173
+ .breathe-back-btn {
1174
+ display: inline-flex;
1175
+ align-items: center;
1176
+ gap: 6px;
1177
+ color: var(--muted);
1178
+ text-decoration: none;
1179
+ font-size: .88rem;
1180
+ font-weight: 500;
1181
+ padding: 8px 20px;
1182
+ border: 1px solid var(--border);
1183
+ border-radius: 999px;
1184
+ transition: color .15s, border-color .15s, background .15s;
1185
+ }
1186
+ .breathe-back-btn:hover {
1187
+ color: var(--text);
1188
+ border-color: var(--accent);
1189
+ background: rgba(91,156,246,.07);
1190
+ }
1191
+
1192
+ .breathe-hub-header {
1193
+ text-align: center;
1194
+ margin-bottom: 48px;
1195
+ }
1196
+ .breathe-hub-rings {
1197
+ position: relative;
1198
+ width: 100px;
1199
+ height: 100px;
1200
+ margin: 0 auto 20px;
1201
+ display: flex;
1202
+ align-items: center;
1203
+ justify-content: center;
1204
+ }
1205
+ .hub-ring {
1206
+ position: absolute;
1207
+ border-radius: 50%;
1208
+ border: 2px solid var(--accent);
1209
+ opacity: .2;
1210
+ animation: hubPulse 3s ease-in-out infinite;
1211
+ }
1212
+ .hub-ring-1 { width: 60px; height: 60px; animation-delay: 0s; }
1213
+ .hub-ring-2 { width: 80px; height: 80px; animation-delay: .6s; opacity: .15; }
1214
+ .hub-ring-3 { width: 100px; height: 100px; animation-delay: 1.2s; opacity: .08; }
1215
+ @keyframes hubPulse {
1216
+ 0%, 100% { transform: scale(1); opacity: .2; }
1217
+ 50% { transform: scale(1.12); opacity: .35; }
1218
+ }
1219
+ .hub-glyph { width: 70px; height: 70px; object-fit: contain; position: relative; z-index: 1; }
1220
+ .breathe-hub-title {
1221
+ font-size: 2.8rem;
1222
+ font-weight: 900;
1223
+ letter-spacing: .2em;
1224
+ background: linear-gradient(135deg, var(--accent), var(--accent2), #f472b6);
1225
+ -webkit-background-clip: text;
1226
+ -webkit-text-fill-color: transparent;
1227
+ margin-bottom: 10px;
1228
+ }
1229
+ .breathe-hub-sub { color: var(--muted2); font-size: 1rem; max-width: 400px; margin: 0 auto; line-height: 1.6; }
1230
+
1231
+ /* ── Deep Breath Widget ────────────────────────────────────────────────── */
1232
+ .dbw {
1233
+ display: flex;
1234
+ flex-direction: column;
1235
+ align-items: center;
1236
+ gap: 20px;
1237
+ margin: 0 auto 52px;
1238
+ max-width: 340px;
1239
+ }
1240
+ .dbw-orb-wrap {
1241
+ position: relative;
1242
+ width: 180px;
1243
+ height: 180px;
1244
+ display: flex;
1245
+ align-items: center;
1246
+ justify-content: center;
1247
+ }
1248
+ .dbw-orb {
1249
+ width: 110px;
1250
+ height: 110px;
1251
+ border-radius: 50%;
1252
+ background: radial-gradient(circle at 38% 38%, rgba(255,74,38,.22), rgba(123,74,190,.18));
1253
+ display: flex;
1254
+ align-items: center;
1255
+ justify-content: center;
1256
+ position: relative;
1257
+ z-index: 2;
1258
+ box-shadow: 0 0 32px rgba(123,74,190,.25), 0 0 64px rgba(255,74,38,.12);
1259
+ }
1260
+ .dbw-logo {
1261
+ width: 72px;
1262
+ height: 72px;
1263
+ object-fit: contain;
1264
+ pointer-events: none;
1265
+ user-select: none;
1266
+ }
1267
+ .dbw-ring {
1268
+ position: absolute;
1269
+ border-radius: 50%;
1270
+ border: 1.5px solid;
1271
+ z-index: 1;
1272
+ transition: transform 4s cubic-bezier(.4,0,.2,1), opacity .5s;
1273
+ }
1274
+ .dbw-ring-1 {
1275
+ width: 140px; height: 140px;
1276
+ border-color: rgba(232,92,136,.35);
1277
+ opacity: .4;
1278
+ }
1279
+ .dbw-ring-2 {
1280
+ width: 175px; height: 175px;
1281
+ border-color: rgba(123,74,190,.22);
1282
+ opacity: .25;
1283
+ }
1284
+ /* ring expansion matches orb phase */
1285
+ .dbw-ring-1.dbw-ring--0 { transform: scale(1.18); opacity: .55; transition: transform 4s cubic-bezier(.4,0,.2,1); }
1286
+ .dbw-ring-2.dbw-ring--0 { transform: scale(1.12); opacity: .35; transition: transform 4s cubic-bezier(.4,0,.2,1); }
1287
+ .dbw-ring-1.dbw-ring--1 { transform: scale(1.18); opacity: .55; }
1288
+ .dbw-ring-2.dbw-ring--1 { transform: scale(1.12); opacity: .35; }
1289
+ .dbw-ring-1.dbw-ring--2 { transform: scale(1); opacity: .4; transition: transform 6s cubic-bezier(.4,0,.2,1); }
1290
+ .dbw-ring-2.dbw-ring--2 { transform: scale(1); opacity: .25; transition: transform 6s cubic-bezier(.4,0,.2,1); }
1291
+ .dbw-ring-1.dbw-ring--3 { transform: scale(1); opacity: .4; }
1292
+ .dbw-ring-2.dbw-ring--3 { transform: scale(1); opacity: .25; }
1293
+
1294
+ .dbw-arc {
1295
+ position: absolute;
1296
+ top: 0; left: 0;
1297
+ width: 100%; height: 100%;
1298
+ z-index: 3;
1299
+ pointer-events: none;
1300
+ transition: stroke-dashoffset 1s linear;
1301
+ }
1302
+ .dbw-arc circle:nth-child(2) { transition: stroke-dashoffset 1s linear; }
1303
+
1304
+ .dbw-info { text-align: center; }
1305
+ .dbw-phase {
1306
+ font-size: 1.2rem;
1307
+ font-weight: 700;
1308
+ letter-spacing: .12em;
1309
+ background: linear-gradient(135deg, #FF4A26, #7B4ABE);
1310
+ -webkit-background-clip: text;
1311
+ -webkit-text-fill-color: transparent;
1312
+ min-height: 1.5em;
1313
+ }
1314
+ .dbw-tick {
1315
+ font-size: 2.8rem;
1316
+ font-weight: 900;
1317
+ line-height: 1.1;
1318
+ color: var(--text);
1319
+ min-height: 1.1em;
1320
+ }
1321
+ .dbw-counter {
1322
+ font-size: .85rem;
1323
+ color: var(--muted2);
1324
+ margin-top: 4px;
1325
+ }
1326
+ .dbw-controls { display: flex; gap: 10px; }
1327
+ .dbw-btn {
1328
+ padding: 10px 28px;
1329
+ border-radius: 999px;
1330
+ border: none;
1331
+ font-size: .92rem;
1332
+ font-weight: 600;
1333
+ cursor: pointer;
1334
+ transition: opacity .15s, transform .1s;
1335
+ }
1336
+ .dbw-btn:active { transform: scale(.96); }
1337
+ .dbw-btn--start {
1338
+ background: linear-gradient(135deg, #FF4A26, #7B4ABE);
1339
+ color: #fff;
1340
+ }
1341
+ .dbw-btn--stop {
1342
+ background: rgba(255,74,38,.15);
1343
+ color: #FF4A26;
1344
+ border: 1px solid rgba(255,74,38,.4);
1345
+ }
1346
+ .dbw-btn--reset {
1347
+ background: var(--surface2);
1348
+ color: var(--muted);
1349
+ border: 1px solid var(--border);
1350
+ }
1351
+
1352
+ /* ── Box Breathing Page ────────────────────────────────────────────────── */
1353
+ .box-breathing-page {
1354
+ max-width: 540px;
1355
+ margin: 0 auto;
1356
+ padding: 40px 24px 60px;
1357
+ display: flex;
1358
+ flex-direction: column;
1359
+ align-items: center;
1360
+ }
1361
+ .box-breathing-header {
1362
+ text-align: center;
1363
+ margin-bottom: 36px;
1364
+ width: 100%;
1365
+ }
1366
+ .box-breathing-title {
1367
+ font-size: 2rem;
1368
+ font-weight: 900;
1369
+ letter-spacing: .18em;
1370
+ background: linear-gradient(135deg, #FF4A26, #7B4ABE);
1371
+ -webkit-background-clip: text;
1372
+ -webkit-text-fill-color: transparent;
1373
+ margin: 12px 0 8px;
1374
+ }
1375
+ .box-breathing-sub {
1376
+ color: var(--muted2);
1377
+ font-size: .92rem;
1378
+ line-height: 1.6;
1379
+ }
1380
+ .box-breathing-tips {
1381
+ display: grid;
1382
+ grid-template-columns: 1fr 1fr;
1383
+ gap: 12px;
1384
+ width: 100%;
1385
+ margin-top: 8px;
1386
+ }
1387
+ .bbt-card {
1388
+ display: flex;
1389
+ align-items: flex-start;
1390
+ gap: 12px;
1391
+ background: var(--surface2);
1392
+ border: 1px solid var(--border);
1393
+ border-radius: var(--r);
1394
+ padding: 14px 16px;
1395
+ }
1396
+ .bbt-icon { font-size: 1.5rem; flex-shrink: 0; }
1397
+ .bbt-label { font-size: .85rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
1398
+ .bbt-desc { font-size: .78rem; color: var(--muted2); line-height: 1.4; }
1399
+ @media (max-width: 420px) {
1400
+ .box-breathing-tips { grid-template-columns: 1fr; }
1401
+ }
1402
+
1403
+ /* Cards grid */
1404
+ .breathe-cards {
1405
+ display: grid;
1406
+ grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
1407
+ gap: 16px;
1408
+ }
1409
+ .breathe-card {
1410
+ background: var(--surface);
1411
+ border: 1px solid var(--border);
1412
+ border-radius: 18px;
1413
+ padding: 22px 20px;
1414
+ text-align: left;
1415
+ cursor: pointer;
1416
+ transition: transform .2s, border-color .2s, box-shadow .2s;
1417
+ display: flex;
1418
+ flex-direction: column;
1419
+ gap: 12px;
1420
+ position: relative;
1421
+ overflow: hidden;
1422
+ }
1423
+ .breathe-card::before {
1424
+ content: '';
1425
+ position: absolute;
1426
+ top: 0; left: 0; right: 0;
1427
+ height: 3px;
1428
+ background: var(--cc, var(--accent));
1429
+ opacity: 0;
1430
+ transition: opacity .2s;
1431
+ }
1432
+ .breathe-card::after {
1433
+ content: '';
1434
+ position: absolute;
1435
+ inset: 0; border-radius: 18px;
1436
+ background: radial-gradient(ellipse at top left, color-mix(in srgb, var(--cc, var(--accent)) 15%, transparent) 0%, transparent 65%);
1437
+ pointer-events: none;
1438
+ opacity: 0;
1439
+ transition: opacity .2s;
1440
+ }
1441
+ .breathe-card:hover {
1442
+ transform: translateY(-4px);
1443
+ border-color: var(--cc, var(--accent));
1444
+ box-shadow: 0 10px 36px rgba(0,0,0,.4), 0 0 0 1px var(--cc, var(--accent))33;
1445
+ }
1446
+ .breathe-card:hover::before { opacity: 1; }
1447
+ .breathe-card:hover::after { opacity: 1; }
1448
+
1449
+ .bc-icon {
1450
+ width: 52px; height: 52px;
1451
+ border-radius: 14px;
1452
+ display: flex; align-items: center; justify-content: center;
1453
+ font-size: 1.5rem;
1454
+ flex-shrink: 0;
1455
+ position: relative; z-index: 1;
1456
+ }
1457
+ .bc-body { flex: 1; position: relative; z-index: 1; }
1458
+ .bc-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
1459
+ .bc-tagline { font-size: .8rem; color: var(--muted); margin-bottom: 8px; font-style: italic; }
1460
+ .bc-desc { font-size: .84rem; color: var(--muted2); line-height: 1.6; margin: 0; }
1461
+ .bc-local-note {
1462
+ display: block;
1463
+ margin-top: 8px;
1464
+ font-size: .76rem;
1465
+ color: var(--success);
1466
+ background: rgba(45,212,165,.08);
1467
+ padding: 4px 10px;
1468
+ border-radius: 6px;
1469
+ border: 1px solid rgba(45,212,165,.2);
1470
+ }
1471
+ .bc-badge {
1472
+ display: inline-flex;
1473
+ align-items: center;
1474
+ gap: 5px;
1475
+ font-size: .72rem;
1476
+ font-weight: 600;
1477
+ padding: 4px 10px;
1478
+ border-radius: 999px;
1479
+ border: 1px solid;
1480
+ width: fit-content;
1481
+ position: relative; z-index: 1;
1482
+ letter-spacing: .02em;
1483
+ }
1484
+
1485
+ /* Guided modal */
1486
+ .guided-modal { max-width: 460px; padding: 40px 36px; }
1487
+ .guided-header { text-align: center; margin-bottom: 24px; }
1488
+ .guided-icon { font-size: 2.8rem; display: block; margin-bottom: 10px; }
1489
+ .guided-header h2 { font-size: 1.4rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
1490
+ .guided-progress {
1491
+ display: flex; gap: 7px; justify-content: center; margin-bottom: 32px;
1492
+ }
1493
+ .progress-dot {
1494
+ width: 8px; height: 8px; border-radius: 50%;
1495
+ background: var(--border2);
1496
+ transition: background .2s, transform .2s, width .2s;
1497
+ }
1498
+ .progress-dot--active { transform: scale(1.4); width: 20px; border-radius: 4px; }
1499
+ .progress-dot--done { opacity: .8; }
1500
+ .guided-step { text-align: center; min-height: 90px; margin-bottom: 32px; padding: 0 8px; }
1501
+ .guided-step-label { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; }
1502
+ .guided-step-desc { color: var(--muted2); font-size: .93rem; line-height: 1.65; }
1503
+ .guided-actions { display: flex; gap: 10px; justify-content: center; }
1504
+ .btn-outline {
1505
+ display: inline-flex; align-items: center; gap: 6px;
1506
+ padding: 10px 22px; border: 1px solid var(--border2); border-radius: var(--r-sm);
1507
+ background: transparent; color: var(--muted2); font-size: .9rem; font-weight: 500;
1508
+ cursor: pointer; transition: var(--t);
1509
+ }
1510
+ .btn-outline:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }
1511
+
1512
+ /* ═══════════════════════════════════════════════
1513
+ GRATITUDE JOURNAL PAGE
1514
+ ═══════════════════════════════════════════════ */
1515
+ .gratitude-page { max-width: 840px; margin: 0 auto; padding: 32px 24px 60px; }
1516
+
1517
+ .tab-toggle {
1518
+ display: flex;
1519
+ gap: 4px;
1520
+ background: var(--bg);
1521
+ border: 1px solid var(--border);
1522
+ border-radius: 12px;
1523
+ padding: 4px;
1524
+ flex-shrink: 0;
1525
+ }
1526
+ .tab-btn {
1527
+ padding: 8px 18px;
1528
+ border-radius: 9px;
1529
+ border: none;
1530
+ background: transparent;
1531
+ color: var(--muted);
1532
+ font-size: .87rem;
1533
+ cursor: pointer;
1534
+ display: flex; align-items: center; gap: 6px;
1535
+ transition: background .2s, color .2s;
1536
+ white-space: nowrap;
1537
+ }
1538
+ .tab-btn--active {
1539
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
1540
+ color: #fff; font-weight: 600;
1541
+ box-shadow: 0 2px 10px rgba(91,156,246,.35);
1542
+ }
1543
+ .tab-count {
1544
+ background: rgba(255,255,255,.18);
1545
+ border-radius: 999px;
1546
+ padding: 1px 7px;
1547
+ font-size: .73rem;
1548
+ }
1549
+
1550
+ .gratitude-write { display: flex; flex-direction: column; gap: 18px; }
1551
+ .gratitude-card {}
1552
+ .gratitude-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
1553
+ .gratitude-item-row { display: flex; align-items: center; gap: 10px; }
1554
+ .gratitude-num { font-size: 1.1rem; font-weight: 700; color: var(--accent); width: 20px; flex-shrink: 0; }
1555
+ .gratitude-input { flex: 1; }
1556
+
1557
+ .gratitude-mood-row { margin-top: 4px; }
1558
+ .mood-grid {
1559
+ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
1560
+ }
1561
+ .mood-btn {
1562
+ display: flex; flex-direction: column; align-items: center; gap: 3px;
1563
+ padding: 10px 14px;
1564
+ background: var(--bg);
1565
+ border: 1px solid var(--border);
1566
+ border-radius: 12px;
1567
+ cursor: pointer;
1568
+ transition: border-color .15s, background .15s, transform .15s;
1569
+ min-width: 60px;
1570
+ }
1571
+ .mood-btn:hover { transform: translateY(-2px); border-color: var(--border2); }
1572
+ .mood-btn--active { border-color: var(--accent); background: rgba(91,156,246,.12); transform: translateY(-2px); }
1573
+ .mood-emoji { font-size: 1.4rem; }
1574
+ .mood-label { font-size: .7rem; color: var(--muted); }
1575
+ .mood-btn--active .mood-label { color: var(--accent); font-weight: 600; }
1576
+
1577
+ .gratitude-actions { display: flex; gap: 10px; margin-top: 8px; }
1578
+
1579
+ .gratitude-tips { background: rgba(251,191,36,.05); border-color: rgba(251,191,36,.2); }
1580
+ .tips-list { margin: 0; padding-left: 20px; color: var(--muted); font-size: .85rem; line-height: 1.9; }
1581
+
1582
+ /* Entry grid */
1583
+ .gratitude-history {}
1584
+ .gentry-grid {
1585
+ display: grid;
1586
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
1587
+ gap: 16px;
1588
+ }
1589
+ .gentry-card {
1590
+ padding: 18px;
1591
+ transition: border-color var(--t), transform var(--t), box-shadow var(--t);
1592
+ border-left: 3px solid var(--accent2) !important;
1593
+ }
1594
+ .gentry-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
1595
+ .gentry-header {
1596
+ display: flex; align-items: center; gap: 8px;
1597
+ margin-bottom: 12px; flex-wrap: wrap;
1598
+ }
1599
+ .gentry-date { font-size: .77rem; color: var(--muted); flex: 1; }
1600
+ .gentry-mood { font-size: .78rem; background: rgba(91,156,246,.1); color: var(--accent); padding: 3px 9px; border-radius: 999px; }
1601
+ .gentry-delete { background: none; border: none; cursor: pointer; font-size: .9rem; opacity: .5; transition: opacity .15s; }
1602
+ .gentry-delete:hover { opacity: 1; }
1603
+ .gentry-items { margin: 0 0 10px; padding-left: 18px; color: var(--text); font-size: .85rem; line-height: 1.8; }
1604
+ .gentry-content { font-size: .85rem; color: var(--muted); line-height: 1.6; margin: 0 0 6px; white-space: pre-wrap; }
1605
+ .gentry-content--clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
1606
+ .gentry-expand { background: none; border: none; color: var(--accent); font-size: .78rem; cursor: pointer; padding: 0; }
1607
+
1608
+ .pagination {
1609
+ display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 28px;
1610
+ }
1611
+ .page-info { font-size: .85rem; color: var(--muted); }
1612
+
1613
+ .empty-state {
1614
+ text-align: center; padding: 60px 20px;
1615
+ }
1616
+ .empty-state .empty-icon { font-size: 2.8rem; margin-bottom: 12px; }
1617
+ .empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 6px; }
1618
+ .empty-state p { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
1619
+
1620
+ /* ═══════════════════════════════════════════════
1621
+ TO-DO PAGE
1622
+ ═══════════════════════════════════════════════ */
1623
+ .todo-page { max-width: 680px; margin: 0 auto; padding: 32px 24px 60px; }
1624
+
1625
+ .local-storage-notice {
1626
+ display: flex;
1627
+ align-items: flex-start;
1628
+ gap: 12px;
1629
+ background: rgba(45,212,165,.06);
1630
+ border: 1px solid rgba(45,212,165,.25);
1631
+ border-radius: 12px;
1632
+ padding: 14px 16px;
1633
+ margin-bottom: 20px;
1634
+ }
1635
+ .lsn-icon { font-size: 1.4rem; flex-shrink: 0; }
1636
+ .local-storage-notice strong { display: block; color: #2dd4a5; font-size: .88rem; margin-bottom: 2px; }
1637
+ .local-storage-notice p { font-size: .78rem; color: var(--muted); margin: 0; line-height: 1.5; }
1638
+
1639
+ .todo-add-card { padding: 18px; }
1640
+ .todo-add-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
1641
+ .todo-input { flex: 1; min-width: 200px; }
1642
+ .todo-add-btn { flex-shrink: 0; }
1643
+ .todo-priority-select { display: flex; gap: 6px; flex-wrap: wrap; }
1644
+ .priority-pill {
1645
+ padding: 5px 12px;
1646
+ border-radius: 999px;
1647
+ border: 1px solid var(--border);
1648
+ background: transparent;
1649
+ color: var(--muted);
1650
+ font-size: .78rem;
1651
+ cursor: pointer;
1652
+ transition: all .15s;
1653
+ white-space: nowrap;
1654
+ }
1655
+
1656
+ .todo-meta-row {
1657
+ display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
1658
+ margin: 16px 0;
1659
+ }
1660
+ .todo-stats { display: flex; gap: 8px; align-items: center; flex: 1; }
1661
+ .todo-stat { font-size: .82rem; color: var(--muted); }
1662
+ .todo-stat-sep { color: var(--border); }
1663
+ .todo-filters { display: flex; gap: 4px; }
1664
+ .filter-pill {
1665
+ padding: 4px 12px; border-radius: 999px;
1666
+ border: 1px solid var(--border); background: transparent;
1667
+ color: var(--muted); font-size: .78rem; cursor: pointer;
1668
+ transition: all .15s;
1669
+ }
1670
+ .filter-pill--active { background: var(--accent); border-color: var(--accent); color: #fff; }
1671
+
1672
+ .todo-list { display: flex; flex-direction: column; gap: 8px; }
1673
+ .todo-item {
1674
+ display: flex; align-items: center; gap: 12px;
1675
+ background: var(--surface);
1676
+ border: 1px solid var(--border);
1677
+ border-radius: 12px;
1678
+ padding: 12px 14px;
1679
+ transition: border-color var(--t), opacity var(--t), transform var(--t);
1680
+ }
1681
+ .todo-item:hover { border-color: var(--border2); transform: translateX(3px); }
1682
+ .todo-item--done { opacity: .5; }
1683
+ .todo-item--done:hover { transform: none; }
1684
+ .todo-check {
1685
+ width: 22px; height: 22px; border-radius: 50%;
1686
+ border: 2px solid var(--border2);
1687
+ background: transparent;
1688
+ cursor: pointer;
1689
+ flex-shrink: 0;
1690
+ display: flex; align-items: center; justify-content: center;
1691
+ transition: background .15s, border-color .15s, transform .15s;
1692
+ }
1693
+ .todo-check:hover { border-color: var(--success); transform: scale(1.1); }
1694
+ .check-tick { color: #fff; font-size: .75rem; font-weight: 700; }
1695
+ .todo-text-col { flex: 1; min-width: 0; }
1696
+ .todo-text {
1697
+ display: block; font-size: .88rem; color: var(--text);
1698
+ word-break: break-word;
1699
+ }
1700
+ .todo-item--done .todo-text { text-decoration: line-through; }
1701
+ .todo-created { font-size: .72rem; color: var(--muted); }
1702
+ .todo-pri-dot {
1703
+ width: 8px; height: 8px; border-radius: 50%;
1704
+ flex-shrink: 0;
1705
+ }
1706
+ .todo-delete {
1707
+ background: none; border: none; cursor: pointer;
1708
+ font-size: .85rem; opacity: .4; flex-shrink: 0;
1709
+ transition: opacity .15s;
1710
+ }
1711
+ .todo-delete:hover { opacity: 1; }
1712
+
1713
+ @media (max-width: 600px) {
1714
+ .breathe-cards { grid-template-columns: 1fr; }
1715
+ .gentry-grid { grid-template-columns: 1fr; }
1716
+ .tab-toggle { flex-wrap: wrap; }
1717
+ }
frontend/src/main.jsx ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import { BrowserRouter } from 'react-router-dom'
4
+ import App from './App'
5
+ import './index.css'
6
+
7
+ ReactDOM.createRoot(document.getElementById('root')).render(
8
+ <React.StrictMode>
9
+ <BrowserRouter>
10
+ <App />
11
+ </BrowserRouter>
12
+ </React.StrictMode>
13
+ )
frontend/src/pages/AssessPage.jsx ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { api } from '../api/client'
3
+ import { levelColor, stressIcon, ADVICE, formatDate } from '../utils'
4
+
5
+ // ── Slider field ─────────────────────────────────────────────────────────────
6
+ function Slider({ name, label, min, max, step, defaultVal, unit = '' }) {
7
+ const [val, setVal] = useState(defaultVal)
8
+ return (
9
+ <div className="slider-field">
10
+ <div className="slider-header">
11
+ <label>{label}</label>
12
+ <span className="slider-value">{val}{unit}</span>
13
+ </div>
14
+ <input type="range" name={name} min={min} max={max} step={step}
15
+ value={val} onChange={e => setVal(step < 1 ? parseFloat(e.target.value) : parseInt(e.target.value))} />
16
+ <div className="slider-range"><span>{min}</span><span>{max}</span></div>
17
+ </div>
18
+ )
19
+ }
20
+
21
+ // ── Stress arc gauge ─────────────────────────────────────────────────────────
22
+ function StressGauge({ score, label }) {
23
+ const CIRC = 2 * Math.PI * 50 // 314.16
24
+ const MAX_ARC = CIRC * 0.75 // 235.6 (270° sweep)
25
+ const filled = (score || 0) * MAX_ARC
26
+ const color = levelColor(label)
27
+
28
+ return (
29
+ <div className="gauge-wrap">
30
+ <svg viewBox="0 0 120 120" className="gauge-svg">
31
+ {/* Track */}
32
+ <circle cx="60" cy="60" r="50" fill="none" stroke="#1a2840" strokeWidth="10"
33
+ strokeDasharray={`${MAX_ARC} ${CIRC - MAX_ARC}`}
34
+ strokeLinecap="round"
35
+ style={{ transform: 'rotate(-225deg)', transformOrigin: '50% 50%' }} />
36
+ {/* Fill */}
37
+ <circle cx="60" cy="60" r="50" fill="none" stroke={color} strokeWidth="10"
38
+ strokeDasharray={`${filled} ${CIRC - filled}`}
39
+ strokeLinecap="round"
40
+ style={{
41
+ transform: 'rotate(-225deg)',
42
+ transformOrigin: '50% 50%',
43
+ transition: 'stroke-dasharray 1.2s cubic-bezier(.4,0,.2,1), stroke .5s ease',
44
+ filter: `drop-shadow(0 0 6px ${color}80)`,
45
+ }} />
46
+ </svg>
47
+ <div className="gauge-center">
48
+ <div className="gauge-pct" style={{ color }}>{score != null ? (score*100).toFixed(0)+'%' : '—'}</div>
49
+ <div className="gauge-lbl" style={{ color }}>{label || '—'}</div>
50
+ </div>
51
+ </div>
52
+ )
53
+ }
54
+
55
+ // ── Main page ─────────────────────────────────────────────────────────────────
56
+ const NUMERIC = [
57
+ { name: 'Sleep_Duration', label: 'Sleep Duration', min: 0, max: 12, step: 0.5, def: 7, unit: ' hrs' },
58
+ { name: 'Sleep_Quality', label: 'Sleep Quality', min: 1, max: 5, step: 1, def: 3, unit: '/5' },
59
+ { name: 'Work_Hours', label: 'Work Hours / Day', min: 0, max: 16, step: 0.5, def: 8, unit: ' hrs' },
60
+ { name: 'Physical_Activity', label: 'Physical Activity', min: 0, max: 6, step: 0.5, def: 1, unit: ' hrs' },
61
+ { name: 'Screen_Time', label: 'Screen Time', min: 0, max: 16, step: 0.5, def: 4, unit: ' hrs' },
62
+ { name: 'Travel_Time', label: 'Travel Time', min: 0, max: 6, step: 0.5, def: 1, unit: ' hrs' },
63
+ { name: 'Social_Interactions',label: 'Social Interactions', min: 0, max: 20, step: 1, def: 5, unit: '/day' },
64
+ { name: 'Caffeine_Intake', label: 'Caffeine Intake', min: 0, max: 10, step: 1, def: 2, unit: ' cups'},
65
+ { name: 'Alcohol_Intake', label: 'Alcohol Intake', min: 0, max: 20, step: 1, def: 0, unit: ' u/wk'},
66
+ { name: 'Blood_Pressure', label: 'Blood Pressure', min: 60, max: 200,step: 1, def: 120, unit: ' mmHg'},
67
+ { name: 'Cholesterol_Level', label: 'Cholesterol Level', min: 100,max: 400,step: 1, def: 190, unit: ' mg/dL'},
68
+ { name: 'Blood_Sugar_Level', label: 'Blood Sugar', min: 50, max: 300,step: 1, def: 90, unit: ' mg/dL'},
69
+ ]
70
+
71
+ const CATEGORICAL = [
72
+ { name: 'Gender', label: 'Gender', opts: ['Male','Female','Other'] },
73
+ { name: 'Occupation', label: 'Occupation', opts: ['Student','Working Professional','Homemaker','Retired','Unemployed'] },
74
+ { name: 'Smoking_Status', label: 'Smoking Status', opts: ['Non-Smoker','Occasional','Regular'] },
75
+ { name: 'Diet_Quality', label: 'Diet Quality', opts: ['Poor','Average','Good','Excellent'] },
76
+ ]
77
+
78
+ export default function AssessPage() {
79
+ const [step, setStep] = useState('form') // 'form' | 'result'
80
+ const [result, setResult] = useState(null)
81
+ const [assess, setAssess] = useState(null)
82
+ const [error, setError] = useState('')
83
+ const [loading, setLoading] = useState(false)
84
+
85
+ async function handleSubmit(e) {
86
+ e.preventDefault()
87
+ setError(''); setLoading(true)
88
+
89
+ const fd = new FormData(e.target)
90
+ const psycho = {}
91
+ let hasPsycho = false
92
+
93
+ NUMERIC.forEach(f => {
94
+ const v = fd.get(f.name)
95
+ if (v !== null && v !== '') { psycho[f.name] = parseFloat(v); hasPsycho = true }
96
+ })
97
+ CATEGORICAL.forEach(f => {
98
+ const v = fd.get(f.name)
99
+ if (v && v !== '') { psycho[f.name] = v; hasPsycho = true }
100
+ })
101
+
102
+ const textNote = (fd.get('text_note') || '').trim()
103
+ if (!hasPsycho && !textNote) {
104
+ setError('Please fill in at least one section.'); setLoading(false); return
105
+ }
106
+
107
+ try {
108
+ const data = await api.post('/api/assessments', {
109
+ psychometric: hasPsycho ? psycho : null,
110
+ text_note: textNote || null,
111
+ })
112
+ setResult(data.prediction)
113
+ setAssess(data.assessment)
114
+ setStep('result')
115
+ window.scrollTo({ top: 0, behavior: 'smooth' })
116
+ } catch (err) {
117
+ setError(err.message)
118
+ } finally {
119
+ setLoading(false)
120
+ }
121
+ }
122
+
123
+ if (step === 'result' && result) {
124
+ return (
125
+ <div className="page">
126
+ <div className="page-header">
127
+ <h2 className="page-title">Your Results</h2>
128
+ <p className="page-sub">Assessment completed {assess ? formatDate(assess.created_at) : ''}</p>
129
+ </div>
130
+
131
+ <div className="result-layout">
132
+ {/* Gauge card */}
133
+ <div className="card result-main">
134
+ <h3 className="card-title">Stress Level</h3>
135
+ <StressGauge score={result.fused_score} label={result.fused_label} />
136
+ <div className="advice-box" style={{ borderLeftColor: levelColor(result.fused_label), marginTop: 20 }}>
137
+ {ADVICE[result.fused_label]}
138
+ </div>
139
+ </div>
140
+
141
+ {/* Breakdown */}
142
+ <div className="result-side">
143
+ <div className="card">
144
+ <h3 className="card-title">Breakdown</h3>
145
+ <div className="breakdown-list">
146
+ {[
147
+ { label: 'Psychometric', val: result.psycho_label, score: result.psycho_score },
148
+ { label: 'Text Sentiment', val: result.text_label, score: result.text_score },
149
+ { label: 'Fused Result', val: result.fused_label, score: result.fused_score, main: true },
150
+ ].map((r,i) => (
151
+ <div key={i} className={`breakdown-item ${r.main ? 'breakdown-item--main' : ''}`}>
152
+ <div className="breakdown-key">{r.label}</div>
153
+ <div className="breakdown-right">
154
+ {r.val
155
+ ? <>
156
+ <span className="breakdown-label" style={{ color: levelColor(r.val) }}>
157
+ {stressIcon(r.val)} {r.val}
158
+ </span>
159
+ <span className="breakdown-score">{(r.score*100).toFixed(1)}%</span>
160
+ </>
161
+ : <span className="muted">—</span>
162
+ }
163
+ </div>
164
+ </div>
165
+ ))}
166
+ <div className="breakdown-item">
167
+ <div className="breakdown-key">Modality</div>
168
+ <span className="modality-badge">{result.modality_used}</span>
169
+ </div>
170
+ </div>
171
+ </div>
172
+
173
+ <div className="result-actions">
174
+ <button className="btn-primary" onClick={() => { setStep('form'); setResult(null) }}>
175
+ + New Assessment
176
+ </button>
177
+ <a href="/app/history" className="btn-secondary">View History →</a>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ )
183
+ }
184
+
185
+ return (
186
+ <div className="page">
187
+ <div className="page-header">
188
+ <h2 className="page-title">New Assessment</h2>
189
+ <p className="page-sub">Fill in any section — both are optional individually</p>
190
+ </div>
191
+
192
+ <form onSubmit={handleSubmit}>
193
+
194
+ {/* Psychometric section */}
195
+ <div className="card section-card">
196
+ <div className="section-head">
197
+ <span className="section-icon-lg">📋</span>
198
+ <div>
199
+ <h3>Psychometric Cues</h3>
200
+ <p className="section-desc">Rate your lifestyle habits over the past week using the sliders.</p>
201
+ </div>
202
+ <span className="badge-optional">Optional</span>
203
+ </div>
204
+ <div className="slider-grid">
205
+ {NUMERIC.map(f => (
206
+ <Slider key={f.name} name={f.name} label={f.label}
207
+ min={f.min} max={f.max} step={f.step} defaultVal={f.def} unit={f.unit} />
208
+ ))}
209
+ </div>
210
+ <div className="cat-grid">
211
+ {CATEGORICAL.map(f => (
212
+ <div key={f.name} className="field">
213
+ <label>{f.label}</label>
214
+ <select name={f.name} defaultValue="">
215
+ <option value="">— select —</option>
216
+ {f.opts.map(o => <option key={o} value={o}>{o}</option>)}
217
+ </select>
218
+ </div>
219
+ ))}
220
+ </div>
221
+ </div>
222
+
223
+ {/* Text note section */}
224
+ <div className="card section-card">
225
+ <div className="section-head">
226
+ <span className="section-icon-lg">📝</span>
227
+ <div>
228
+ <h3>Text Note</h3>
229
+ <p className="section-desc">Write freely about how you're feeling. Our NLP model analyses the sentiment.</p>
230
+ </div>
231
+ <span className="badge-optional">Optional</span>
232
+ </div>
233
+ <textarea name="text_note" rows={5}
234
+ placeholder="Today I felt… I've been experiencing… My mind keeps going to…" />
235
+ </div>
236
+
237
+ {error && <div className="form-error">{error}</div>}
238
+
239
+ <button type="submit" className="btn-primary btn--lg" disabled={loading}>
240
+ {loading
241
+ ? <><span className="btn-spinner" /> Analysing…</>
242
+ : 'Analyse My Stress →'
243
+ }
244
+ </button>
245
+ </form>
246
+ </div>
247
+ )
248
+ }
frontend/src/pages/AuthPage.jsx ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react'
2
+ import { useNavigate, useSearchParams } from 'react-router-dom'
3
+ import { useAuth } from '../context/AuthContext'
4
+
5
+ export default function AuthPage() {
6
+ const [searchParams] = useSearchParams()
7
+ const [tab, setTab] = useState(searchParams.get('tab') === 'signup' ? 'signup' : 'login')
8
+ const [error, setError] = useState('')
9
+ const [loading, setLoading] = useState(false)
10
+
11
+ // Login fields
12
+ const [identity, setIdentity] = useState('')
13
+ const [loginPw, setLoginPw] = useState('')
14
+
15
+ // Signup fields
16
+ const [uname, setUname] = useState('')
17
+ const [email, setEmail] = useState('')
18
+ const [signupPw, setSignupPw] = useState('')
19
+
20
+ const { login, signup } = useAuth()
21
+ const navigate = useNavigate()
22
+
23
+ async function handleLogin(e) {
24
+ e.preventDefault()
25
+ setError(''); setLoading(true)
26
+ try {
27
+ await login(identity, loginPw)
28
+ navigate('/app/dashboard')
29
+ } catch (err) { setError(err.message) }
30
+ finally { setLoading(false) }
31
+ }
32
+
33
+ async function handleSignup(e) {
34
+ e.preventDefault()
35
+ setError(''); setLoading(true)
36
+ try {
37
+ await signup(uname, email, signupPw)
38
+ navigate('/app/dashboard')
39
+ } catch (err) { setError(err.message) }
40
+ finally { setLoading(false) }
41
+ }
42
+
43
+ return (
44
+ <div className="auth-screen">
45
+ {/* Breathing rings */}
46
+ <div className="breath-rings">
47
+ {[1,2,3,4].map(i => <div key={i} className={`ring ring-${i}`} />)}
48
+ </div>
49
+
50
+ <div className="auth-card">
51
+ {/* Brand */}
52
+ <div className="auth-brand">
53
+ <img src="/logo.svg" alt="BREATHE" className="auth-logo" />
54
+ <p className="auth-subtitle">Stress Intelligence Platform</p>
55
+ </div>
56
+
57
+ {/* Tabs */}
58
+ <div className="auth-tabs">
59
+ <button className={`auth-tab ${tab==='login' ? 'auth-tab--active' : ''}`} onClick={() => { setTab('login'); setError('') }}>Log In</button>
60
+ <button className={`auth-tab ${tab==='signup' ? 'auth-tab--active' : ''}`} onClick={() => { setTab('signup'); setError('') }}>Sign Up</button>
61
+ </div>
62
+
63
+ {error && <div className="form-error">{error}</div>}
64
+
65
+ {/* Login form */}
66
+ {tab === 'login' && (
67
+ <form className="auth-form" onSubmit={handleLogin}>
68
+ <div className="field">
69
+ <label>Email or Username</label>
70
+ <input type="text" placeholder="you@example.com" value={identity}
71
+ onChange={e => setIdentity(e.target.value)} autoComplete="username" required />
72
+ </div>
73
+ <div className="field">
74
+ <label>Password</label>
75
+ <input type="password" placeholder="••••••••" value={loginPw}
76
+ onChange={e => setLoginPw(e.target.value)} autoComplete="current-password" required />
77
+ </div>
78
+ <button type="submit" className="btn-primary btn--full" disabled={loading}>
79
+ {loading ? <span className="btn-spinner" /> : 'Log In →'}
80
+ </button>
81
+ </form>
82
+ )}
83
+
84
+ {/* Signup form */}
85
+ {tab === 'signup' && (
86
+ <form className="auth-form" onSubmit={handleSignup}>
87
+ <div className="field">
88
+ <label>Username</label>
89
+ <input type="text" placeholder="breatheuser" value={uname}
90
+ onChange={e => setUname(e.target.value)} autoComplete="username" required />
91
+ </div>
92
+ <div className="field">
93
+ <label>Email</label>
94
+ <input type="email" placeholder="you@example.com" value={email}
95
+ onChange={e => setEmail(e.target.value)} autoComplete="email" required />
96
+ </div>
97
+ <div className="field">
98
+ <label>Password <small>(min 8 characters)</small></label>
99
+ <input type="password" placeholder="••••••••" value={signupPw}
100
+ onChange={e => setSignupPw(e.target.value)} autoComplete="new-password" required />
101
+ </div>
102
+ <button type="submit" className="btn-primary btn--full" disabled={loading}>
103
+ {loading ? <span className="btn-spinner" /> : 'Create Account →'}
104
+ </button>
105
+ </form>
106
+ )}
107
+ </div>
108
+ </div>
109
+ )
110
+ }
frontend/src/pages/BoxBreathingPage.jsx ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Link } from 'react-router-dom'
2
+ import DeepBreathWidget from '../components/DeepBreathWidget'
3
+
4
+ export default function BoxBreathingPage() {
5
+ return (
6
+ <div className="page box-breathing-page">
7
+ <div className="box-breathing-header">
8
+ <Link to="/app/breathe" className="breathe-back-btn">← Back</Link>
9
+ <h1 className="box-breathing-title">Box Breathing</h1>
10
+ <p className="box-breathing-sub">
11
+ Inhale 4 · Hold 4 · Exhale 6 · Hold 2 — repeat to reset your nervous system
12
+ </p>
13
+ </div>
14
+ <DeepBreathWidget />
15
+ <div className="box-breathing-tips">
16
+ <div className="bbt-card">
17
+ <span className="bbt-icon">👃</span>
18
+ <div>
19
+ <div className="bbt-label">Inhale</div>
20
+ <div className="bbt-desc">Breathe in slowly and deeply through your nose</div>
21
+ </div>
22
+ </div>
23
+ <div className="bbt-card">
24
+ <span className="bbt-icon">🤫</span>
25
+ <div>
26
+ <div className="bbt-label">Hold</div>
27
+ <div className="bbt-desc">Hold your breath gently — no tension</div>
28
+ </div>
29
+ </div>
30
+ <div className="bbt-card">
31
+ <span className="bbt-icon">💨</span>
32
+ <div>
33
+ <div className="bbt-label">Exhale</div>
34
+ <div className="bbt-desc">Release slowly through your mouth</div>
35
+ </div>
36
+ </div>
37
+ <div className="bbt-card">
38
+ <span className="bbt-icon">🌿</span>
39
+ <div>
40
+ <div className="bbt-label">Rest</div>
41
+ <div className="bbt-desc">Pause before the next breath</div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ )
47
+ }
frontend/src/pages/BreathePage.jsx ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useNavigate, Link } from 'react-router-dom'
2
+ import { useTheme } from '../context/ThemeContext'
3
+
4
+ const CARDS = [
5
+ {
6
+ icon: '✍️',
7
+ title: 'Gratitude Journal',
8
+ tagline: 'Write what you are thankful for',
9
+ desc: 'Record 3 things you are grateful for each day. Stored in your account — revisit any time.',
10
+ color: '#fbbf24',
11
+ to: '/app/gratitude',
12
+ badge: 'Saved to account',
13
+ badgeIcon: '☁️',
14
+ },
15
+ {
16
+ icon: '🌬️',
17
+ title: 'Box Breathing',
18
+ tagline: '4-4-4-4 calm technique',
19
+ desc: 'Inhale 4 counts → Hold 4 → Exhale 4 → Hold 4. Repeat to reset your nervous system.',
20
+ color: '#5b9cf6',
21
+ to: '/app/breathe/box',
22
+ badge: 'Guided exercise',
23
+ badgeIcon: '▶',
24
+ },
25
+ {
26
+ icon: '✅',
27
+ title: 'Daily To-Do',
28
+ tagline: 'Clear your mind, clear your tasks',
29
+ desc: 'Add tasks for today. Helps reduce mental load and stress. Saved locally in your browser.',
30
+ color: '#2dd4a5',
31
+ to: '/app/todo',
32
+ badge: 'Saved locally',
33
+ badgeIcon: '💾',
34
+ localNote: true,
35
+ },
36
+ {
37
+ icon: '🧘',
38
+ title: 'Body Scan',
39
+ tagline: 'Release physical tension',
40
+ desc: 'Lie down, close your eyes, and slowly scan from head to toe — releasing tension as you go.',
41
+ color: '#a78bfa',
42
+ to: '/app/breathe/body-scan',
43
+ badge: 'Guided exercise',
44
+ badgeIcon: '▶',
45
+ },
46
+ {
47
+ icon: '🎵',
48
+ title: 'Sound Bath',
49
+ tagline: 'Let calming sounds wash over you',
50
+ desc: 'Put on headphones, choose calming music or nature sounds, and let each note ease your mind.',
51
+ color: '#f472b6',
52
+ to: '/app/breathe/sound-bath',
53
+ badge: 'Guided exercise',
54
+ badgeIcon: '▶',
55
+ },
56
+ {
57
+ icon: '💪',
58
+ title: 'Progressive Relaxation',
59
+ tagline: 'Tense & release muscle groups',
60
+ desc: 'Tense each muscle group for 5 seconds, then release. Work from feet to face while breathing slowly.',
61
+ color: '#fb923c',
62
+ to: '/app/breathe/progressive',
63
+ badge: 'Guided exercise',
64
+ badgeIcon: '▶',
65
+ },
66
+ ]
67
+
68
+ // Steps for guided exercises (not linked to own page)
69
+ const GUIDED = {
70
+ '/app/breathe/body-scan': {
71
+ title: 'Body Scan',
72
+ icon: '🧘',
73
+ color: '#a78bfa',
74
+ steps: [
75
+ { label: 'Lie down', duration: null, desc: 'Find a comfortable position, close your eyes' },
76
+ { label: 'Head & neck', duration: null, desc: 'Notice any tension. Let it go on each exhale' },
77
+ { label: 'Shoulders', duration: null, desc: 'Drop your shoulders away from your ears' },
78
+ { label: 'Chest & belly', duration: null, desc: 'Feel your breath rise and fall naturally' },
79
+ { label: 'Arms & hands', duration: null, desc: 'Let your arms feel heavy and relaxed' },
80
+ { label: 'Legs & feet', duration: null, desc: 'Release all tension from your lower body' },
81
+ ],
82
+ },
83
+ '/app/breathe/sound-bath': {
84
+ title: 'Sound Bath',
85
+ icon: '🎵',
86
+ color: '#f472b6',
87
+ steps: [
88
+ { label: 'Prepare', duration: null, desc: 'Put on headphones and sit or lie comfortably' },
89
+ { label: 'Choose', duration: null, desc: 'Play calming music, singing bowls, or nature sounds' },
90
+ { label: 'Receive', duration: null, desc: 'Close your eyes, let each sound wash over you' },
91
+ { label: 'Breathe', duration: null, desc: 'Match your breath to the rhythm of the music' },
92
+ ],
93
+ },
94
+ '/app/breathe/progressive': {
95
+ title: 'Progressive Relaxation',
96
+ icon: '💪',
97
+ color: '#fb923c',
98
+ steps: [
99
+ { label: 'Feet', duration: 5, desc: 'Tense your feet tightly, then release' },
100
+ { label: 'Calves', duration: 5, desc: 'Tense your calves, hold, then release' },
101
+ { label: 'Thighs', duration: 5, desc: 'Squeeze your thigh muscles, then let go' },
102
+ { label: 'Abdomen', duration: 5, desc: 'Tighten your core, hold, then release' },
103
+ { label: 'Hands', duration: 5, desc: 'Make fists, hold tight, then open slowly' },
104
+ { label: 'Shoulders', duration: 5, desc: 'Raise shoulders to ears, hold, then drop' },
105
+ { label: 'Face', duration: 5, desc: 'Scrunch your face, hold, then relax completely' },
106
+ ],
107
+ },
108
+ }
109
+
110
+ import { useState } from 'react'
111
+
112
+ function GuidedModal({ path, onClose }) {
113
+ const guide = GUIDED[path]
114
+ const [step, setStep] = useState(0)
115
+ if (!guide) return null
116
+ const s = guide.steps[step]
117
+ const last = step === guide.steps.length - 1
118
+
119
+ return (
120
+ <div className="modal-overlay" onClick={onClose}>
121
+ <div className="modal-box guided-modal" onClick={e => e.stopPropagation()}>
122
+ <button className="modal-close" onClick={onClose}>✕</button>
123
+ <div className="guided-header">
124
+ <span className="guided-icon" style={{ color: guide.color }}>{guide.icon}</span>
125
+ <h2 style={{ color: guide.color }}>{guide.title}</h2>
126
+ </div>
127
+ <div className="guided-progress">
128
+ {guide.steps.map((_, i) => (
129
+ <div key={i} className={`progress-dot ${i === step ? 'progress-dot--active' : i < step ? 'progress-dot--done' : ''}`} style={i <= step ? { background: guide.color } : {}} />
130
+ ))}
131
+ </div>
132
+ <div className="guided-step">
133
+ <div className="guided-step-label" style={{ color: guide.color }}>
134
+ {s.label} {s.duration ? `· ${s.duration}s` : ''}
135
+ </div>
136
+ <p className="guided-step-desc">{s.desc}</p>
137
+ </div>
138
+ <div className="guided-actions">
139
+ {step > 0 && (
140
+ <button className="btn-outline" onClick={() => setStep(s => s - 1)}>← Back</button>
141
+ )}
142
+ {!last
143
+ ? <button className="btn-primary" onClick={() => setStep(s => s + 1)}>Next →</button>
144
+ : <button className="btn-primary" onClick={onClose}>✓ Done</button>
145
+ }
146
+ </div>
147
+ </div>
148
+ </div>
149
+ )
150
+ }
151
+
152
+ export default function BreathePage() {
153
+ const navigate = useNavigate()
154
+ const { theme, toggle } = useTheme()
155
+ const [guided, setGuided] = useState(null)
156
+
157
+ function handleCard(to) {
158
+ if (GUIDED[to]) {
159
+ setGuided(to)
160
+ } else {
161
+ navigate(to)
162
+ }
163
+ }
164
+
165
+ return (
166
+ <div className="page breathe-hub">
167
+ <div className="breathe-hub-header">
168
+ <div className="breathe-hub-rings">
169
+ <div className="hub-ring hub-ring-1" />
170
+ <div className="hub-ring hub-ring-2" />
171
+ <div className="hub-ring hub-ring-3" />
172
+ <img src="/logo.svg" alt="BREATHE" className="hub-glyph" />
173
+ </div>
174
+ <h1 className="breathe-hub-title">BREATHE</h1>
175
+ <p className="breathe-hub-sub">Choose an activity to calm your mind and reduce stress</p>
176
+ <div className="breathe-hub-actions">
177
+ <Link to="/app/dashboard" className="breathe-back-btn">
178
+ ◈ Dashboard
179
+ </Link>
180
+ <Link to="/app/profile" className="breathe-back-btn">
181
+ ◉ Profile
182
+ </Link>
183
+ <button className="breathe-back-btn" onClick={toggle}>
184
+ {theme === 'dark' ? '☀️ Light' : '🌙 Dark'}
185
+ </button>
186
+ </div>
187
+ </div>
188
+
189
+ <div className="breathe-cards">
190
+ {CARDS.map((c, i) => (
191
+ <button key={i} className="breathe-card" style={{ '--cc': c.color }} onClick={() => handleCard(c.to)}>
192
+ <div className="bc-icon" style={{ background: c.color + '22', color: c.color }}>{c.icon}</div>
193
+ <div className="bc-body">
194
+ <div className="bc-title">{c.title}</div>
195
+ <div className="bc-tagline">{c.tagline}</div>
196
+ <p className="bc-desc">{c.desc}</p>
197
+ {c.localNote && (
198
+ <span className="bc-local-note">💾 Only stored in your browser — never sent to our servers</span>
199
+ )}
200
+ </div>
201
+ <div className="bc-badge" style={{ color: c.color, borderColor: c.color + '44', background: c.color + '11' }}>
202
+ <span>{c.badgeIcon}</span> {c.badge}
203
+ </div>
204
+ </button>
205
+ ))}
206
+ </div>
207
+
208
+ {guided && <GuidedModal path={guided} onClose={() => setGuided(null)} />}
209
+ </div>
210
+ )
211
+ }
frontend/src/pages/DashboardPage.jsx ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react'
2
+ import { useNavigate } from 'react-router-dom'
3
+ import {
4
+ AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip,
5
+ ResponsiveContainer, PieChart, Pie, Cell, Legend,
6
+ } from 'recharts'
7
+ import { api } from '../api/client'
8
+ import { useAuth } from '../context/AuthContext'
9
+ import { levelColor, levelBg, stressIcon, formatDate } from '../utils'
10
+
11
+ const STAT_ICONS = ['📊', '🎯', '📈', '↕']
12
+
13
+ const ACTIVITIES = [
14
+ {
15
+ icon: '🌬️',
16
+ title: 'Box Breathing',
17
+ duration: '5 min',
18
+ color: '#5b9cf6',
19
+ steps: ['Inhale for 4 counts', 'Hold for 4 counts', 'Exhale for 4 counts', 'Hold for 4 counts'],
20
+ },
21
+ {
22
+ icon: '🧘',
23
+ title: 'Body Scan',
24
+ duration: '10 min',
25
+ color: '#a78bfa',
26
+ steps: ['Lie down comfortably', 'Close your eyes', 'Slowly scan from head to toe', 'Release tension as you go'],
27
+ },
28
+ {
29
+ icon: '🚶',
30
+ title: 'Mindful Walk',
31
+ duration: '15 min',
32
+ color: '#2dd4a5',
33
+ steps: ['Step outside or find space', 'Walk at a natural pace', 'Notice 5 things you can see', 'Focus only on each step'],
34
+ },
35
+ {
36
+ icon: '✍️',
37
+ title: 'Gratitude Journal',
38
+ duration: '5 min',
39
+ color: '#fbbf24',
40
+ steps: ['Open a blank page', "Write 3 things you're grateful for", 'Add one small win today', 'Read it back slowly'],
41
+ },
42
+ {
43
+ icon: '🎵',
44
+ title: 'Sound Bath',
45
+ duration: '10 min',
46
+ color: '#f472b6',
47
+ steps: ['Put on headphones', 'Choose calming music or nature sounds', 'Sit or lie still', 'Let each sound wash over you'],
48
+ },
49
+ {
50
+ icon: '💪',
51
+ title: 'Progressive Relaxation',
52
+ duration: '8 min',
53
+ color: '#fb923c',
54
+ steps: ['Tense each muscle group for 5 s', 'Release and notice the relaxation', 'Work from feet to face', 'Breathe slowly throughout'],
55
+ },
56
+ ]
57
+
58
+ function ActivityPanel() {
59
+ const [open, setOpen] = useState(null)
60
+ return (
61
+ <div className="card activity-panel">
62
+ <h3 className="card-title">🌿 Stress Relief Activities</h3>
63
+ <div className="activity-list">
64
+ {ACTIVITIES.map((a, i) => (
65
+ <div key={i} className="activity-item" style={{ '--ac': a.color }}>
66
+ <button className="activity-header" onClick={() => setOpen(open === i ? null : i)}>
67
+ <span className="activity-icon" style={{ background: a.color + '22', color: a.color }}>{a.icon}</span>
68
+ <div className="activity-meta">
69
+ <span className="activity-title">{a.title}</span>
70
+ <span className="activity-dur">{a.duration}</span>
71
+ </div>
72
+ <span className={`activity-chevron ${open === i ? 'activity-chevron--open' : ''}`}>›</span>
73
+ </button>
74
+ {open === i && (
75
+ <ol className="activity-steps">
76
+ {a.steps.map((s, j) => <li key={j}>{s}</li>)}
77
+ </ol>
78
+ )}
79
+ </div>
80
+ ))}
81
+ </div>
82
+ </div>
83
+ )
84
+ }
85
+
86
+ export default function DashboardPage() {
87
+ const { user } = useAuth()
88
+ const navigate = useNavigate()
89
+ const [summary, setSummary] = useState(null)
90
+ const [timeline, setTimeline] = useState([])
91
+ const [loading, setLoading] = useState(true)
92
+ const [selected, setSelected] = useState(null) // modal
93
+
94
+ useEffect(() => {
95
+ api.get('/api/assessments/summary').then(d => {
96
+ setSummary(d.summary)
97
+ setTimeline(d.timeline.map(t => ({
98
+ ...t,
99
+ score: +(t.fused_score * 100).toFixed(1),
100
+ })))
101
+ }).catch(console.error).finally(() => setLoading(false))
102
+ }, [])
103
+
104
+ const greeting = (() => {
105
+ const h = new Date().getHours()
106
+ if (h < 12) return 'Good morning'
107
+ if (h < 18) return 'Good afternoon'
108
+ return 'Good evening'
109
+ })()
110
+
111
+ if (loading) return <div className="page-loader"><div className="spinner" /></div>
112
+
113
+ const empty = !summary || !summary.total_assessments
114
+
115
+ // Distribution data for PieChart
116
+ const distData = summary?.label_distribution
117
+ ? Object.entries(summary.label_distribution).map(([name, value]) => ({ name, value }))
118
+ : []
119
+
120
+ // Trend
121
+ let trend = null
122
+ if (timeline.length >= 2) {
123
+ const diff = timeline[timeline.length-1].fused_score - timeline[timeline.length-2].fused_score
124
+ trend = diff > 0.01 ? { label: '▲ Rising', cls: 'trend--up' }
125
+ : diff < -0.01 ? { label: '▼ Falling', cls: 'trend--down' }
126
+ : { label: '→ Stable', cls: 'trend--flat' }
127
+ }
128
+
129
+ const stats = [
130
+ { icon: '📋', label: 'Total Assessments', value: summary?.total_assessments ?? '—' },
131
+ { icon: '🎯', label: 'Latest Level', value: summary?.latest_label ?? '—', color: levelColor(summary?.latest_label) },
132
+ { icon: '📊', label: 'Average Score', value: summary?.avg_score ? (summary.avg_score*100).toFixed(1)+'%' : '—' },
133
+ { icon: '↕', label: 'Trend', value: trend?.label ?? '—', cls: trend?.cls },
134
+ ]
135
+
136
+ const recent = [...timeline].reverse().slice(0, 6)
137
+
138
+ return (
139
+ <div className="page">
140
+ {/* Header */}
141
+ <div className="page-header">
142
+ <div>
143
+ <h2 className="page-title">{greeting}, {user?.username} 👋</h2>
144
+ <p className="page-sub">Here's your stress overview</p>
145
+ </div>
146
+ <button className="btn-primary" onClick={() => navigate('/app/assess')}>
147
+ + New Assessment
148
+ </button>
149
+ </div>
150
+
151
+ {empty ? (
152
+ <div className="dash-layout">
153
+ <div className="dash-main">
154
+ <div className="empty-dashboard">
155
+ <div className="empty-icon">🫁</div>
156
+ <h3>No assessments yet</h3>
157
+ <p>Take your first stress assessment to see your dashboard.</p>
158
+ <button className="btn-primary" onClick={() => navigate('/app/assess')}>Start Assessment →</button>
159
+ </div>
160
+ </div>
161
+ <div className="dash-side"><ActivityPanel /></div>
162
+ </div>
163
+ ) : (
164
+ <div className="dash-layout">
165
+ <div className="dash-main">
166
+ {/* Stat cards */}
167
+ <div className="stat-grid">
168
+ {stats.map((s,i) => (
169
+ <div key={i} className="stat-card">
170
+ <div className="stat-icon">{s.icon}</div>
171
+ <div className="stat-value" style={s.color ? {color: s.color} : {}}>
172
+ <span className={s.cls || ''}>{s.value}</span>
173
+ </div>
174
+ <div className="stat-label">{s.label}</div>
175
+ </div>
176
+ ))}
177
+ </div>
178
+
179
+ {/* Timeline chart */}
180
+ <div className="card">
181
+ <h3 className="card-title">Stress Score Timeline</h3>
182
+ <ResponsiveContainer width="100%" height={230}>
183
+ <AreaChart data={timeline} margin={{ top: 10, right: 10, left: -10, bottom: 0 }}>
184
+ <defs>
185
+ <linearGradient id="scoreGrad" x1="0" y1="0" x2="0" y2="1">
186
+ <stop offset="5%" stopColor="#5b9cf6" stopOpacity={0.35} />
187
+ <stop offset="95%" stopColor="#5b9cf6" stopOpacity={0} />
188
+ </linearGradient>
189
+ </defs>
190
+ <CartesianGrid strokeDasharray="3 3" stroke="#1a2840" />
191
+ <XAxis dataKey="date" stroke="#445566" tick={{ fontSize: 10, fill: '#64748b' }} tickLine={false} />
192
+ <YAxis domain={[0,100]} stroke="#445566" tick={{ fontSize: 10, fill: '#64748b' }} tickLine={false}
193
+ tickFormatter={v => v + '%'} />
194
+ <Tooltip
195
+ contentStyle={{ background: '#0d1420', border: '1px solid #1a2840', borderRadius: 10, fontSize: 12 }}
196
+ labelStyle={{ color: '#94a3b8' }}
197
+ formatter={(v, n, p) => [`${v}% — ${p.payload.fused_label}`, 'Score']}
198
+ />
199
+ <Area type="monotone" dataKey="score" stroke="#5b9cf6" strokeWidth={2}
200
+ fill="url(#scoreGrad)" dot={{ fill: '#5b9cf6', r: 3, strokeWidth: 0 }} activeDot={{ r: 5 }} />
201
+ </AreaChart>
202
+ </ResponsiveContainer>
203
+ </div>
204
+
205
+ <div className="two-col">
206
+ {/* Distribution donut */}
207
+ <div className="card">
208
+ <h3 className="card-title">Level Distribution</h3>
209
+ <ResponsiveContainer width="100%" height={220}>
210
+ <PieChart>
211
+ <Pie data={distData} cx="50%" cy="45%" innerRadius={55} outerRadius={80}
212
+ dataKey="value" paddingAngle={3}>
213
+ {distData.map((d,i) => <Cell key={i} fill={levelColor(d.name)} />)}
214
+ </Pie>
215
+ <Tooltip contentStyle={{ background: '#0d1420', border: '1px solid #1a2840', borderRadius: 10, fontSize: 12 }} />
216
+ <Legend iconType="circle" iconSize={8}
217
+ formatter={(v) => <span style={{ color: '#94a3b8', fontSize: 12 }}>{v}</span>} />
218
+ </PieChart>
219
+ </ResponsiveContainer>
220
+ </div>
221
+
222
+ {/* Recent */}
223
+ <div className="card">
224
+ <h3 className="card-title">Recent Assessments</h3>
225
+ <div className="recent-list">
226
+ {recent.map(r => (
227
+ <div key={r.id} className="recent-item" onClick={() => setSelected(r.id)}>
228
+ <div className="recent-left">
229
+ <span className="level-dot" style={{ background: levelColor(r.fused_label) }} />
230
+ <div>
231
+ <div className="recent-label" style={{ color: levelColor(r.fused_label) }}>
232
+ {stressIcon(r.fused_label)} {r.fused_label}
233
+ </div>
234
+ <div className="recent-date">{r.date}</div>
235
+ </div>
236
+ </div>
237
+ <div className="recent-score">{(r.fused_score * 100).toFixed(0)}%</div>
238
+ </div>
239
+ ))}
240
+ {!recent.length && <p className="empty-text">No assessments yet.</p>}
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </div>
245
+ <div className="dash-side"><ActivityPanel /></div>
246
+ </div>
247
+ )}
248
+
249
+ {/* Detail modal */}
250
+ {selected && <DetailModal id={selected} onClose={() => setSelected(null)} />}
251
+ </div>
252
+ )
253
+ }
254
+
255
+ function DetailModal({ id, onClose }) {
256
+ const [data, setData] = useState(null)
257
+
258
+ useEffect(() => {
259
+ api.get(`/api/assessments/${id}`).then(d => setData(d.assessment)).catch(console.error)
260
+ }, [id])
261
+
262
+ if (!data) return (
263
+ <div className="modal-overlay" onClick={onClose}>
264
+ <div className="modal-box" onClick={e => e.stopPropagation()}>
265
+ <div className="spinner" style={{ margin: '40px auto' }} />
266
+ </div>
267
+ </div>
268
+ )
269
+
270
+ return (
271
+ <div className="modal-overlay" onClick={onClose}>
272
+ <div className="modal-box" onClick={e => e.stopPropagation()}>
273
+ <button className="modal-close" onClick={onClose}>✕</button>
274
+ <h3 className="modal-title">Assessment Detail</h3>
275
+ <AssessmentDetail a={data} />
276
+ </div>
277
+ </div>
278
+ )
279
+ }
280
+
281
+ export function AssessmentDetail({ a }) {
282
+ const ADVICE = {
283
+ Minimal: 'Great job! Keep up your healthy routines.',
284
+ Mild: 'Mild stress detected. A short walk or 5-minute breathing exercise can help.',
285
+ Moderate: 'Moderate stress. Schedule a break and reduce screen time.',
286
+ Severe: 'High stress. Prioritise rest and reach out to someone you trust.',
287
+ Critical: 'Critical stress indicators. Please speak with a mental health professional — you are not alone.',
288
+ }
289
+ return (
290
+ <>
291
+ <div className="detail-grid">
292
+ {[
293
+ ['Date', formatDate(a.created_at)],
294
+ ['Fused Level', <span style={{color: levelColor(a.fused_label)}}>{stressIcon(a.fused_label)} {a.fused_label}</span>],
295
+ ['Fused Score', a.fused_score != null ? (a.fused_score*100).toFixed(1)+'%' : '—'],
296
+ ['Psychometric', a.psycho_label ? `${a.psycho_label} (${(a.psycho_score*100).toFixed(1)}%)` : '—'],
297
+ ['Text Sentiment', a.text_label ? `${a.text_label} (${(a.text_score*100).toFixed(1)}%)` : '—'],
298
+ ['Modality', a.modality_used],
299
+ ].map(([k,v],i) => (
300
+ <div key={i} className="detail-item">
301
+ <div className="detail-key">{k}</div>
302
+ <div className="detail-val">{v}</div>
303
+ </div>
304
+ ))}
305
+ </div>
306
+ {a.text_note && (
307
+ <div className="detail-note">
308
+ <div className="detail-note-label">📝 Note</div>
309
+ <p>{a.text_note}</p>
310
+ </div>
311
+ )}
312
+ <div className="advice-box" style={{ borderLeftColor: levelColor(a.fused_label) }}>
313
+ {ADVICE[a.fused_label] || ''}
314
+ </div>
315
+ </>
316
+ )
317
+ }
frontend/src/pages/GratitudePage.jsx ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect } from 'react'
2
+ import { api } from '../api/client'
3
+
4
+ const MOODS = [
5
+ { emoji: '😊', label: 'Happy' },
6
+ { emoji: '😌', label: 'Calm' },
7
+ { emoji: '🙏', label: 'Grateful' },
8
+ { emoji: '💪', label: 'Strong' },
9
+ { emoji: '😔', label: 'Low' },
10
+ { emoji: '😤', label: 'Stressed' },
11
+ ]
12
+
13
+ function formatDate(iso) {
14
+ return new Date(iso).toLocaleDateString('en-US', {
15
+ day: 'numeric', month: 'short', year: 'numeric',
16
+ hour: '2-digit', minute: '2-digit',
17
+ })
18
+ }
19
+
20
+ export default function GratitudePage() {
21
+ const [tab, setTab] = useState('write') // 'write' | 'history'
22
+ const [items, setItems] = useState(['', '', ''])
23
+ const [content, setContent] = useState('')
24
+ const [mood, setMood] = useState('')
25
+ const [saving, setSaving] = useState(false)
26
+ const [flash, setFlash] = useState('')
27
+ const [entries, setEntries] = useState([])
28
+ const [page, setPage] = useState(1)
29
+ const [meta, setMeta] = useState({ total: 0, pages: 1, has_next: false, has_prev: false })
30
+ const [loading, setLoading] = useState(false)
31
+ const [expanded, setExpanded] = useState(null)
32
+
33
+ // Load history when tab switches or page changes
34
+ useEffect(() => {
35
+ if (tab !== 'history') return
36
+ setLoading(true)
37
+ api.get(`/api/gratitude?page=${page}`)
38
+ .then(d => {
39
+ setEntries(d.entries)
40
+ setMeta({ total: d.total, pages: d.pages, has_next: d.has_next, has_prev: d.has_prev })
41
+ })
42
+ .catch(console.error)
43
+ .finally(() => setLoading(false))
44
+ }, [tab, page])
45
+
46
+ function handleItemChange(i, val) {
47
+ setItems(prev => prev.map((v, idx) => idx === i ? val : v))
48
+ }
49
+
50
+ async function handleSave() {
51
+ const filledItems = items.filter(s => s.trim())
52
+ if (!filledItems.length && !content.trim()) {
53
+ setFlash('error:Please write at least one gratitude item or a note.')
54
+ return
55
+ }
56
+ setSaving(true)
57
+ setFlash('')
58
+ try {
59
+ await api.post('/api/gratitude', {
60
+ content: content.trim(),
61
+ mood: mood,
62
+ items: filledItems,
63
+ })
64
+ setItems(['', '', ''])
65
+ setContent('')
66
+ setMood('')
67
+ setFlash('ok:Entry saved! 🌟')
68
+ setTimeout(() => setFlash(''), 3000)
69
+ } catch (err) {
70
+ setFlash('error:' + (err.message || 'Failed to save'))
71
+ } finally {
72
+ setSaving(false)
73
+ }
74
+ }
75
+
76
+ async function handleDelete(id) {
77
+ try {
78
+ await api.del(`/api/gratitude/${id}`)
79
+ setEntries(prev => prev.filter(e => e.id !== id))
80
+ setMeta(m => ({ ...m, total: m.total - 1 }))
81
+ } catch (err) {
82
+ console.error(err)
83
+ }
84
+ }
85
+
86
+ const flashType = flash.startsWith('ok:') ? 'ok' : flash.startsWith('error:') ? 'error' : ''
87
+ const flashMsg = flash.replace(/^(ok|error):/, '')
88
+
89
+ return (
90
+ <div className="page gratitude-page">
91
+ <div className="page-header">
92
+ <div>
93
+ <h2 className="page-title">✍️ Gratitude Journal</h2>
94
+ <p className="page-sub">Cultivate positivity — one entry at a time</p>
95
+ </div>
96
+ <div className="tab-toggle">
97
+ <button className={`tab-btn ${tab === 'write' ? 'tab-btn--active' : ''}`} onClick={() => setTab('write')}>
98
+ ✏️ Write
99
+ </button>
100
+ <button className={`tab-btn ${tab === 'history' ? 'tab-btn--active' : ''}`} onClick={() => { setTab('history'); setPage(1) }}>
101
+ 📖 My Entries {meta.total > 0 && <span className="tab-count">{meta.total}</span>}
102
+ </button>
103
+ </div>
104
+ </div>
105
+
106
+ {/* ── Write tab ─────────────────────────────── */}
107
+ {tab === 'write' && (
108
+ <div className="gratitude-write">
109
+ <div className="card gratitude-card">
110
+ <h3 className="card-title">🌟 Today I am grateful for…</h3>
111
+ <div className="gratitude-items">
112
+ {items.map((val, i) => (
113
+ <div key={i} className="gratitude-item-row">
114
+ <span className="gratitude-num">{i + 1}.</span>
115
+ <input
116
+ className="form-input gratitude-input"
117
+ type="text"
118
+ placeholder={[
119
+ 'Something that made you smile today',
120
+ 'A person who helped or inspired you',
121
+ 'A simple pleasure you enjoyed',
122
+ ][i]}
123
+ value={val}
124
+ onChange={e => handleItemChange(i, e.target.value)}
125
+ maxLength={300}
126
+ />
127
+ </div>
128
+ ))}
129
+ </div>
130
+
131
+ <div className="gratitude-mood-row">
132
+ <label className="form-label">How are you feeling right now?</label>
133
+ <div className="mood-grid">
134
+ {MOODS.map(m => (
135
+ <button
136
+ key={m.label}
137
+ type="button"
138
+ className={`mood-btn ${mood === m.label ? 'mood-btn--active' : ''}`}
139
+ onClick={() => setMood(prev => prev === m.label ? '' : m.label)}
140
+ >
141
+ <span className="mood-emoji">{m.emoji}</span>
142
+ <span className="mood-label">{m.label}</span>
143
+ </button>
144
+ ))}
145
+ </div>
146
+ </div>
147
+
148
+ <div className="form-group" style={{ marginTop: 16 }}>
149
+ <label className="form-label">Additional thoughts <span className="form-hint">(optional)</span></label>
150
+ <textarea
151
+ className="form-textarea"
152
+ rows={4}
153
+ maxLength={2000}
154
+ placeholder="Any reflections, wins, or moments you want to remember from today…"
155
+ value={content}
156
+ onChange={e => setContent(e.target.value)}
157
+ />
158
+ <div className="char-count">{content.length} / 2000</div>
159
+ </div>
160
+
161
+ {flashMsg && (
162
+ <p className={flashType === 'ok' ? 'form-success' : 'form-error'}>{flashMsg}</p>
163
+ )}
164
+
165
+ <div className="gratitude-actions">
166
+ <button className="btn-primary" onClick={handleSave} disabled={saving}>
167
+ {saving ? 'Saving…' : '💾 Save Entry'}
168
+ </button>
169
+ <button className="btn-outline" onClick={() => { setItems(['','','']); setContent(''); setMood('') }}>
170
+ Clear
171
+ </button>
172
+ </div>
173
+ </div>
174
+
175
+ <div className="card gratitude-tips">
176
+ <h3 className="card-title">💡 Tips for gratitude journaling</h3>
177
+ <ul className="tips-list">
178
+ <li>Be specific — "my friend called to check in" beats "good friends"</li>
179
+ <li>Include small things — a warm drink, sunlight, a quiet moment</li>
180
+ <li>Write daily for at least 21 days to build the habit</li>
181
+ <li>Re-read old entries on tough days to remind yourself of the good</li>
182
+ </ul>
183
+ </div>
184
+ </div>
185
+ )}
186
+
187
+ {/* ── History tab ───────────────────────────── */}
188
+ {tab === 'history' && (
189
+ <div className="gratitude-history">
190
+ {loading && <div className="page-loader"><div className="spinner" /></div>}
191
+ {!loading && entries.length === 0 && (
192
+ <div className="empty-state">
193
+ <div className="empty-icon">📖</div>
194
+ <h3>No entries yet</h3>
195
+ <p>Your saved gratitude entries will appear here.</p>
196
+ <button className="btn-primary" onClick={() => setTab('write')}>Write your first entry →</button>
197
+ </div>
198
+ )}
199
+ {!loading && entries.length > 0 && (
200
+ <>
201
+ <div className="gentry-grid">
202
+ {entries.map(e => (
203
+ <div key={e.id} className="gentry-card card">
204
+ <div className="gentry-header">
205
+ <div className="gentry-date">{formatDate(e.created_at)}</div>
206
+ {e.mood && <span className="gentry-mood">{MOODS.find(m => m.label === e.mood)?.emoji} {e.mood}</span>}
207
+ <button className="gentry-delete" onClick={() => handleDelete(e.id)} title="Delete entry">🗑</button>
208
+ </div>
209
+
210
+ {e.items && e.items.length > 0 && (
211
+ <ol className="gentry-items">
212
+ {e.items.map((item, i) => <li key={i}>{item}</li>)}
213
+ </ol>
214
+ )}
215
+
216
+ {e.content && (
217
+ <>
218
+ <p className={`gentry-content ${expanded === e.id ? '' : 'gentry-content--clamp'}`}>
219
+ {e.content}
220
+ </p>
221
+ {e.content.length > 120 && (
222
+ <button className="gentry-expand" onClick={() => setExpanded(prev => prev === e.id ? null : e.id)}>
223
+ {expanded === e.id ? 'Show less ↑' : 'Read more ↓'}
224
+ </button>
225
+ )}
226
+ </>
227
+ )}
228
+ </div>
229
+ ))}
230
+ </div>
231
+
232
+ {(meta.has_prev || meta.has_next) && (
233
+ <div className="pagination">
234
+ <button className="btn-outline" disabled={!meta.has_prev} onClick={() => setPage(p => p - 1)}>
235
+ ← Prev
236
+ </button>
237
+ <span className="page-info">Page {page} of {meta.pages}</span>
238
+ <button className="btn-outline" disabled={!meta.has_next} onClick={() => setPage(p => p + 1)}>
239
+ Next →
240
+ </button>
241
+ </div>
242
+ )}
243
+ </>
244
+ )}
245
+ </div>
246
+ )}
247
+ </div>
248
+ )
249
+ }
frontend/src/pages/HistoryPage.jsx ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react'
2
+ import { api } from '../api/client'
3
+ import { levelColor, levelBg, stressIcon, formatDate } from '../utils'
4
+ import { AssessmentDetail } from './DashboardPage'
5
+
6
+ export default function HistoryPage() {
7
+ const [items, setItems] = useState([])
8
+ const [page, setPage] = useState(1)
9
+ const [pages, setPages] = useState(1)
10
+ const [total, setTotal] = useState(0)
11
+ const [loading, setLoading] = useState(true)
12
+ const [selected, setSelected] = useState(null)
13
+
14
+ useEffect(() => { load(page) }, [page])
15
+
16
+ function load(p) {
17
+ setLoading(true)
18
+ api.get(`/api/assessments?page=${p}&per_page=12`)
19
+ .then(d => {
20
+ setItems(d.assessments)
21
+ setPages(d.pages)
22
+ setTotal(d.total)
23
+ })
24
+ .catch(console.error)
25
+ .finally(() => setLoading(false))
26
+ }
27
+
28
+ return (
29
+ <div className="page">
30
+ <div className="page-header">
31
+ <div>
32
+ <h2 className="page-title">Assessment History</h2>
33
+ <p className="page-sub">{total} total assessments</p>
34
+ </div>
35
+ </div>
36
+
37
+ {loading ? (
38
+ <div className="page-loader"><div className="spinner" /></div>
39
+ ) : !items.length ? (
40
+ <div className="empty-dashboard">
41
+ <div className="empty-icon">📋</div>
42
+ <h3>No assessments yet</h3>
43
+ <p>Take your first assessment to build your history.</p>
44
+ <a href="/app/assess" className="btn-primary">Start Assessment →</a>
45
+ </div>
46
+ ) : (
47
+ <>
48
+ <div className="history-grid">
49
+ {items.map(a => (
50
+ <div key={a.id} className="history-card" onClick={() => setSelected(a)}
51
+ style={{ '--level-color': levelColor(a.fused_label), '--level-bg': levelBg(a.fused_label) }}>
52
+ <div className="hc-top">
53
+ <span className="hc-badge" style={{
54
+ color: levelColor(a.fused_label),
55
+ background: levelBg(a.fused_label),
56
+ }}>
57
+ {stressIcon(a.fused_label)} {a.fused_label}
58
+ </span>
59
+ <span className="hc-score">{a.fused_score != null ? (a.fused_score*100).toFixed(0)+'%' : '—'}</span>
60
+ </div>
61
+ <div className="hc-bars">
62
+ <div className="hc-bar-wrap">
63
+ <span className="hc-bar-label">Overall</span>
64
+ <div className="hc-bar-track">
65
+ <div className="hc-bar-fill"
66
+ style={{ width: `${(a.fused_score||0)*100}%`, background: levelColor(a.fused_label) }} />
67
+ </div>
68
+ </div>
69
+ {a.psycho_score != null && (
70
+ <div className="hc-bar-wrap">
71
+ <span className="hc-bar-label">Psychometric</span>
72
+ <div className="hc-bar-track">
73
+ <div className="hc-bar-fill"
74
+ style={{ width: `${(a.psycho_score||0)*100}%`, background: '#5b9cf6' }} />
75
+ </div>
76
+ </div>
77
+ )}
78
+ {a.text_score != null && (
79
+ <div className="hc-bar-wrap">
80
+ <span className="hc-bar-label">Text</span>
81
+ <div className="hc-bar-track">
82
+ <div className="hc-bar-fill"
83
+ style={{ width: `${(a.text_score||0)*100}%`, background: '#a78bfa' }} />
84
+ </div>
85
+ </div>
86
+ )}
87
+ </div>
88
+ <div className="hc-footer">
89
+ <span className="hc-modality">{a.modality_used}</span>
90
+ <span className="hc-date">{formatDate(a.created_at)}</span>
91
+ </div>
92
+ </div>
93
+ ))}
94
+ </div>
95
+
96
+ {/* Pagination */}
97
+ {pages > 1 && (
98
+ <div className="pagination">
99
+ <button className="page-btn" onClick={() => setPage(p => Math.max(1, p-1))} disabled={page===1}>‹</button>
100
+ {Array.from({length: pages}, (_, i) => i+1).map(p => (
101
+ <button key={p} className={`page-btn ${p===page ? 'page-btn--active' : ''}`} onClick={() => setPage(p)}>{p}</button>
102
+ ))}
103
+ <button className="page-btn" onClick={() => setPage(p => Math.min(pages, p+1))} disabled={page===pages}>›</button>
104
+ </div>
105
+ )}
106
+ </>
107
+ )}
108
+
109
+ {/* Modal */}
110
+ {selected && (
111
+ <div className="modal-overlay" onClick={() => setSelected(null)}>
112
+ <div className="modal-box" onClick={e => e.stopPropagation()}>
113
+ <button className="modal-close" onClick={() => setSelected(null)}>✕</button>
114
+ <h3 className="modal-title">Assessment Detail</h3>
115
+ <AssessmentDetail a={selected} />
116
+ </div>
117
+ </div>
118
+ )}
119
+ </div>
120
+ )
121
+ }
frontend/src/pages/LandingPage.jsx ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useRef } from 'react'
2
+ import { Link } from 'react-router-dom'
3
+
4
+ const FEATURES = [
5
+ {
6
+ icon: '📋',
7
+ title: 'Psychometric Analysis',
8
+ desc: 'Track 12 lifestyle cues — sleep, work hours, screen time, caffeine, and more — through intuitive sliders calibrated to your daily routine.',
9
+ color: '#5b9cf6',
10
+ },
11
+ {
12
+ icon: '🧠',
13
+ title: 'NLP Text Sentiment',
14
+ desc: 'Write freely in your journal. Our fine-tuned RoBERTa model reads between the lines to detect stress, anxiety, and emotional patterns.',
15
+ color: '#a78bfa',
16
+ },
17
+ {
18
+ icon: '⚡',
19
+ title: 'Fusion Intelligence',
20
+ desc: 'A stacking ensemble of LightGBM, CatBoost, and XGBoost fuses both signals into one precise stress score — updated every session.',
21
+ color: '#2dd4a5',
22
+ },
23
+ {
24
+ icon: '📊',
25
+ title: 'Live Dashboard',
26
+ desc: 'Area charts, pie distributions, and an animated SVG gauge surface your stress trends over time so you can act before burnout hits.',
27
+ color: '#fbbf24',
28
+ },
29
+ ]
30
+
31
+ const STEPS = [
32
+ { n: '01', title: 'Create your account', desc: 'Sign up in seconds — no credit card, no noise.' },
33
+ { n: '02', title: 'Log your day', desc: 'Adjust sliders and write a short note about how you feel.' },
34
+ { n: '03', title: 'Get your score', desc: 'Receive an instant stress level with personalised advice and history charts.' },
35
+ ]
36
+
37
+ const LEVELS = [
38
+ { label: 'Minimal', color: '#2dd4a5', bg: 'rgba(45,212,165,.15)', range: '0 – 20%', desc: 'Feeling balanced and grounded.' },
39
+ { label: 'Mild', color: '#86efac', bg: 'rgba(134,239,172,.15)', range: '20 – 40%', desc: 'Minor tension — easily managed.' },
40
+ { label: 'Moderate', color: '#fbbf24', bg: 'rgba(251,191,36,.15)', range: '40 – 60%', desc: 'Noticeable stress — worth watching.' },
41
+ { label: 'Severe', color: '#fb923c', bg: 'rgba(251,146,60,.15)', range: '60 – 80%', desc: 'High pressure — take action today.' },
42
+ { label: 'Critical', color: '#f87171', bg: 'rgba(248,113,113,.15)', range: '80 – 100%', desc: 'Seek support. You matter.' },
43
+ ]
44
+
45
+ // ── Animated counter ──────────────────────────────────────────────────────────
46
+ function Counter({ to, suffix = '' }) {
47
+ const ref = useRef(null)
48
+ useEffect(() => {
49
+ let start = 0
50
+ const step = Math.ceil(to / 60)
51
+ const id = setInterval(() => {
52
+ start += step
53
+ if (start >= to) { start = to; clearInterval(id) }
54
+ if (ref.current) ref.current.textContent = start.toLocaleString() + suffix
55
+ }, 20)
56
+ return () => clearInterval(id)
57
+ }, [to, suffix])
58
+ return <span ref={ref}>0{suffix}</span>
59
+ }
60
+
61
+ export default function LandingPage() {
62
+ return (
63
+ <div className="lp">
64
+
65
+ {/* ── Nav ─────────────────────────────────────────────────────────── */}
66
+ <nav className="lp-nav">
67
+ <div className="lp-nav-inner">
68
+ <div className="lp-logo">
69
+ <img src="/logo.svg" alt="BREATHE" className="lp-logo-img" />
70
+ </div>
71
+ <div className="lp-nav-links">
72
+ <a href="#features" className="lp-nav-link">Features</a>
73
+ <a href="#how" className="lp-nav-link">How it works</a>
74
+ <a href="#levels" className="lp-nav-link">Stress levels</a>
75
+ <Link to="/app/dashboard" className="lp-nav-link">Dashboard</Link>
76
+ </div>
77
+ <div className="lp-nav-cta">
78
+ <Link to="/auth" className="lp-btn-ghost">Log in</Link>
79
+ <Link to="/auth?tab=signup" className="lp-btn-solid">Sign up free</Link>
80
+ </div>
81
+ </div>
82
+ </nav>
83
+
84
+ {/* ── Hero ────────────────────────────────────────────────────────── */}
85
+ <section className="lp-hero">
86
+ {/* Breathing rings */}
87
+ <div className="lp-rings" aria-hidden>
88
+ <div className="lp-ring lp-ring-1" />
89
+ <div className="lp-ring lp-ring-2" />
90
+ <div className="lp-ring lp-ring-3" />
91
+ <div className="lp-ring lp-ring-4" />
92
+ <div className="lp-ring lp-ring-5" />
93
+ </div>
94
+
95
+ <div className="lp-hero-content">
96
+ <div className="lp-hero-badge">✦ Powered by RoBERTa + LightGBM ensemble</div>
97
+ <h1 className="lp-hero-h1">
98
+ Know your stress<br />
99
+ <span className="lp-gradient-text">before it knows you</span>
100
+ </h1>
101
+ <p className="lp-hero-sub">
102
+ BREATHE fuses psychometric lifestyle data and free-text journaling through a
103
+ state-of-the-art ML pipeline — giving you a precise, actionable stress score every day.
104
+ </p>
105
+ <div className="lp-hero-btns">
106
+ <Link to="/auth?tab=signup" className="lp-btn-hero-primary">
107
+ Get started free <span className="lp-btn-arrow">→</span>
108
+ </Link>
109
+ <a href="#how" className="lp-btn-hero-ghost">See how it works</a>
110
+ </div>
111
+ </div>
112
+ </section>
113
+
114
+ {/* ── Stats bar ───────────────────────────────────────────────────── */}
115
+ <div className="lp-stats">
116
+ <div className="lp-stat">
117
+ <div className="lp-stat-num"><Counter to={5} suffix=" levels" /></div>
118
+ <div className="lp-stat-lbl">Stress classification</div>
119
+ </div>
120
+ <div className="lp-stat-div" />
121
+ <div className="lp-stat">
122
+ <div className="lp-stat-num"><Counter to={12} suffix="+" /></div>
123
+ <div className="lp-stat-lbl">Psychometric cues tracked</div>
124
+ </div>
125
+ <div className="lp-stat-div" />
126
+ <div className="lp-stat">
127
+ <div className="lp-stat-num"><Counter to={2} suffix=" models" /></div>
128
+ <div className="lp-stat-lbl">Fused ML signals</div>
129
+ </div>
130
+ <div className="lp-stat-div" />
131
+ <div className="lp-stat">
132
+ <div className="lp-stat-num"><Counter to={100} suffix="% private" /></div>
133
+ <div className="lp-stat-lbl">Your data, your device</div>
134
+ </div>
135
+ </div>
136
+
137
+ {/* ── Features ────────────────────────────────────────────────────── */}
138
+ <section className="lp-section" id="features">
139
+ <div className="lp-section-label">Features</div>
140
+ <h2 className="lp-section-h2">Everything you need to<br />understand your mental load</h2>
141
+ <div className="lp-features">
142
+ {FEATURES.map(f => (
143
+ <div key={f.title} className="lp-feat-card" style={{ '--fc': f.color }}>
144
+ <div className="lp-feat-icon" style={{ background: f.color + '20', color: f.color }}>{f.icon}</div>
145
+ <h3 className="lp-feat-title">{f.title}</h3>
146
+ <p className="lp-feat-desc">{f.desc}</p>
147
+ </div>
148
+ ))}
149
+ </div>
150
+ </section>
151
+
152
+ {/* ── How it works ────────────────────────────────────────────────── */}
153
+ <section className="lp-section lp-section--alt" id="how">
154
+ <div className="lp-section-label">Process</div>
155
+ <h2 className="lp-section-h2">Three steps to clarity</h2>
156
+ <div className="lp-steps">
157
+ {STEPS.map((s, i) => (
158
+ <div key={s.n} className="lp-step">
159
+ <div className="lp-step-n">{s.n}</div>
160
+ {i < STEPS.length - 1 && <div className="lp-step-line" aria-hidden />}
161
+ <div className="lp-step-body">
162
+ <h3 className="lp-step-title">{s.title}</h3>
163
+ <p className="lp-step-desc">{s.desc}</p>
164
+ </div>
165
+ </div>
166
+ ))}
167
+ </div>
168
+ </section>
169
+
170
+ {/* ── Stress levels ───────────────────────────────────────────────── */}
171
+ <section className="lp-section" id="levels">
172
+ <div className="lp-section-label">Classification</div>
173
+ <h2 className="lp-section-h2">Five precise stress levels</h2>
174
+ <p className="lp-section-sub">Every assessment maps to one of five evidence-informed tiers — each with tailored advice.</p>
175
+ <div className="lp-levels">
176
+ {LEVELS.map(l => (
177
+ <div key={l.label} className="lp-level-card" style={{ '--lc': l.color, '--lb': l.bg }}>
178
+ <div className="lp-level-top">
179
+ <span className="lp-level-badge" style={{ color: l.color, background: l.bg }}>{l.label}</span>
180
+ <span className="lp-level-range">{l.range}</span>
181
+ </div>
182
+ <p className="lp-level-desc">{l.desc}</p>
183
+ <div className="lp-level-bar-track">
184
+ <div className="lp-level-bar-fill" style={{ background: l.color }} />
185
+ </div>
186
+ </div>
187
+ ))}
188
+ </div>
189
+ </section>
190
+
191
+ {/* ── CTA ─────────────────────────────────────────────────────────── */}
192
+ <section className="lp-cta">
193
+ <div className="lp-cta-glow" aria-hidden />
194
+ <h2 className="lp-cta-h2">Start breathing easier today</h2>
195
+ <p className="lp-cta-sub">Free forever. No app to download. Runs in your browser.</p>
196
+ <Link to="/auth?tab=signup" className="lp-btn-hero-primary lp-btn--xl">
197
+ Create your account <span className="lp-btn-arrow">→</span>
198
+ </Link>
199
+ </section>
200
+
201
+ {/* ── Footer ────────────��─────────────────────────────────────────── */}
202
+ <footer className="lp-footer">
203
+ <div className="lp-footer-logo">
204
+ <img src="/logo.svg" alt="BREATHE" className="lp-footer-logo-img" />
205
+ </div>
206
+ <p className="lp-footer-copy">© {new Date().getFullYear()} BREATHE. MIT License.</p>
207
+ <div className="lp-footer-links">
208
+ <Link to="/auth" className="lp-footer-link">Log in</Link>
209
+ <Link to="/auth?tab=signup" className="lp-footer-link">Sign up</Link>
210
+ <a href="#features" className="lp-footer-link">Features</a>
211
+ </div>
212
+ </footer>
213
+
214
+ </div>
215
+ )
216
+ }
frontend/src/pages/ProfilePage.jsx ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect, useRef } from 'react'
2
+ import { useAuth } from '../context/AuthContext'
3
+ import { api } from '../api/client'
4
+
5
+ const GENDERS = [
6
+ 'male', 'female', 'non-binary', 'prefer not to say', 'other',
7
+ ]
8
+
9
+ const WORKING_STATUSES = [
10
+ 'employed full-time',
11
+ 'employed part-time',
12
+ 'self-employed',
13
+ 'student',
14
+ 'unemployed',
15
+ 'homemaker',
16
+ 'retired',
17
+ 'prefer not to say',
18
+ ]
19
+
20
+ export default function ProfilePage() {
21
+ const { user, setUser } = useAuth()
22
+ const fileRef = useRef(null)
23
+
24
+ const [form, setForm] = useState({
25
+ avatar: '',
26
+ gender: '',
27
+ working_status: '',
28
+ dob: '',
29
+ bio: '',
30
+ is_anonymous: false,
31
+ })
32
+
33
+ const [saving, setSaving] = useState(false)
34
+ const [success, setSuccess] = useState('')
35
+ const [error, setError] = useState('')
36
+ const [avatarPreview, setAvatarPreview] = useState('')
37
+
38
+ // Load current profile on mount
39
+ useEffect(() => {
40
+ api.get('/api/profile').then(d => {
41
+ const p = d.profile
42
+ setForm({
43
+ avatar: p.avatar || '',
44
+ gender: p.gender || '',
45
+ working_status: p.working_status || '',
46
+ dob: p.dob || '',
47
+ bio: p.bio || '',
48
+ is_anonymous: p.is_anonymous || false,
49
+ })
50
+ setAvatarPreview(p.avatar || '')
51
+ }).catch(() => {})
52
+ }, [])
53
+
54
+ function handleField(e) {
55
+ const { name, value, type, checked } = e.target
56
+ setForm(f => ({ ...f, [name]: type === 'checkbox' ? checked : value }))
57
+ }
58
+
59
+ function handleAvatarChange(e) {
60
+ const file = e.target.files[0]
61
+ if (!file) return
62
+ if (file.size > 2 * 1024 * 1024) {
63
+ setError('Image must be smaller than 2 MB')
64
+ return
65
+ }
66
+ const reader = new FileReader()
67
+ reader.onload = ev => {
68
+ setAvatarPreview(ev.target.result)
69
+ setForm(f => ({ ...f, avatar: ev.target.result }))
70
+ }
71
+ reader.readAsDataURL(file)
72
+ }
73
+
74
+ function removeAvatar() {
75
+ setAvatarPreview('')
76
+ setForm(f => ({ ...f, avatar: '' }))
77
+ if (fileRef.current) fileRef.current.value = ''
78
+ }
79
+
80
+ async function handleSave(e) {
81
+ e.preventDefault()
82
+ setError('')
83
+ setSuccess('')
84
+ setSaving(true)
85
+ try {
86
+ // Upload avatar separately if changed
87
+ await api.post('/api/profile/avatar', { avatar: form.avatar })
88
+
89
+ // Update other fields
90
+ const res = await api.put('/api/profile', {
91
+ bio: form.bio,
92
+ gender: form.gender,
93
+ working_status: form.working_status,
94
+ dob: form.dob,
95
+ is_anonymous: form.is_anonymous,
96
+ })
97
+ if (setUser) setUser(res.profile)
98
+ setSuccess('Profile saved!')
99
+ setTimeout(() => setSuccess(''), 3000)
100
+ } catch (err) {
101
+ setError(err.message || 'Failed to save profile')
102
+ } finally {
103
+ setSaving(false)
104
+ }
105
+ }
106
+
107
+ const initials = (user?.display_name || user?.username || 'U').slice(0, 2).toUpperCase()
108
+
109
+ return (
110
+ <div className="profile-page">
111
+ <div className="profile-header-bar">
112
+ <h1 className="page-title">My Profile</h1>
113
+ <p className="page-sub">Manage your personal information and privacy settings.</p>
114
+ </div>
115
+
116
+ <form className="profile-form" onSubmit={handleSave}>
117
+
118
+ {/* ── Avatar ──────────────────────────────── */}
119
+ <section className="profile-section">
120
+ <h2 className="section-title">Profile Photo</h2>
121
+ <div className="avatar-upload-row">
122
+ <div className="avatar-large" onClick={() => fileRef.current?.click()}>
123
+ {avatarPreview
124
+ ? <img src={avatarPreview} alt="avatar" className="avatar-img" />
125
+ : <span className="avatar-initials">{initials}</span>
126
+ }
127
+ <div className="avatar-overlay">📷</div>
128
+ </div>
129
+ <div className="avatar-actions">
130
+ <button type="button" className="btn-outline" onClick={() => fileRef.current?.click()}>
131
+ Upload Photo
132
+ </button>
133
+ {avatarPreview && (
134
+ <button type="button" className="btn-ghost-danger" onClick={removeAvatar}>
135
+ Remove
136
+ </button>
137
+ )}
138
+ <p className="avatar-hint">JPG, PNG, GIF or WebP · max 2 MB</p>
139
+ </div>
140
+ <input
141
+ ref={fileRef}
142
+ type="file"
143
+ accept="image/*"
144
+ style={{ display: 'none' }}
145
+ onChange={handleAvatarChange}
146
+ />
147
+ </div>
148
+ </section>
149
+
150
+ {/* ── About you ───────────────────────────── */}
151
+ <section className="profile-section">
152
+ <h2 className="section-title">About You</h2>
153
+
154
+ <div className="profile-grid">
155
+ <div className="form-group">
156
+ <label className="form-label">Gender</label>
157
+ <select name="gender" className="form-select" value={form.gender} onChange={handleField}>
158
+ <option value="">Prefer not to say / skip</option>
159
+ {GENDERS.map(g => (
160
+ <option key={g} value={g}>{g.charAt(0).toUpperCase() + g.slice(1)}</option>
161
+ ))}
162
+ </select>
163
+ </div>
164
+
165
+ <div className="form-group">
166
+ <label className="form-label">Working Status</label>
167
+ <select name="working_status" className="form-select" value={form.working_status} onChange={handleField}>
168
+ <option value="">Select status</option>
169
+ {WORKING_STATUSES.map(s => (
170
+ <option key={s} value={s}>{s.charAt(0).toUpperCase() + s.slice(1)}</option>
171
+ ))}
172
+ </select>
173
+ </div>
174
+
175
+ <div className="form-group">
176
+ <label className="form-label">Date of Birth</label>
177
+ <input
178
+ type="date"
179
+ name="dob"
180
+ className="form-input"
181
+ value={form.dob}
182
+ max={new Date().toISOString().split('T')[0]}
183
+ onChange={handleField}
184
+ />
185
+ </div>
186
+ </div>
187
+ </section>
188
+
189
+ {/* ── Bio ─────────────────────────────────── */}
190
+ <section className="profile-section">
191
+ <h2 className="section-title">Short Bio</h2>
192
+ <div className="form-group">
193
+ <label className="form-label">Tell us a little about yourself <span className="form-hint">(optional)</span></label>
194
+ <textarea
195
+ name="bio"
196
+ className="form-textarea"
197
+ rows={4}
198
+ maxLength={500}
199
+ placeholder="e.g. Software engineer, hobby runner, cat parent..."
200
+ value={form.bio}
201
+ onChange={handleField}
202
+ />
203
+ <div className="char-count">{form.bio.length} / 500</div>
204
+ </div>
205
+ </section>
206
+
207
+ {/* ── Privacy ─────────────────────────────── */}
208
+ <section className="profile-section profile-privacy">
209
+ <h2 className="section-title">Privacy</h2>
210
+ <div className="privacy-card">
211
+ <div className="privacy-icon">🕵️</div>
212
+ <div className="privacy-text">
213
+ <strong>Stay Anonymous</strong>
214
+ <p>
215
+ When enabled, your name is replaced with <em>"Anonymous"</em> in shared views and exports.
216
+ Your data is never deleted — only your identity is hidden.
217
+ </p>
218
+ </div>
219
+ <label className="toggle-switch">
220
+ <input
221
+ type="checkbox"
222
+ name="is_anonymous"
223
+ checked={form.is_anonymous}
224
+ onChange={handleField}
225
+ />
226
+ <span className="toggle-track">
227
+ <span className="toggle-thumb" />
228
+ </span>
229
+ </label>
230
+ </div>
231
+ {form.is_anonymous && (
232
+ <p className="anon-notice">
233
+ 🔒 Anonymous mode is <strong>on</strong> — your display name will appear as "Anonymous" to others.
234
+ </p>
235
+ )}
236
+ </section>
237
+
238
+ {/* ── Actions ─────────────────────────────── */}
239
+ {error && <p className="form-error">{error}</p>}
240
+ {success && <p className="form-success">{success}</p>}
241
+
242
+ <div className="profile-actions">
243
+ <button type="submit" className="btn-primary" disabled={saving}>
244
+ {saving ? 'Saving…' : 'Save Profile'}
245
+ </button>
246
+ </div>
247
+
248
+ </form>
249
+ </div>
250
+ )
251
+ }
frontend/src/pages/TodoPage.jsx ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect } from 'react'
2
+
3
+ const STORAGE_KEY = 'breathe_todos'
4
+
5
+ function loadTodos() {
6
+ try {
7
+ return JSON.parse(localStorage.getItem(STORAGE_KEY)) || []
8
+ } catch {
9
+ return []
10
+ }
11
+ }
12
+
13
+ function saveTodos(todos) {
14
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(todos))
15
+ }
16
+
17
+ function genId() {
18
+ return Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
19
+ }
20
+
21
+ const PRIORITIES = [
22
+ { value: 'high', label: '🔴 High' },
23
+ { value: 'medium', label: '🟡 Medium' },
24
+ { value: 'low', label: '🟢 Low' },
25
+ ]
26
+
27
+ export default function TodoPage() {
28
+ const [todos, setTodos] = useState(loadTodos)
29
+ const [input, setInput] = useState('')
30
+ const [priority, setPriority] = useState('medium')
31
+ const [filter, setFilter] = useState('all') // all | active | done
32
+
33
+ // Persist to localStorage whenever todos change
34
+ useEffect(() => {
35
+ saveTodos(todos)
36
+ }, [todos])
37
+
38
+ function addTodo() {
39
+ const text = input.trim()
40
+ if (!text) return
41
+ setTodos(prev => [
42
+ { id: genId(), text, priority, done: false, createdAt: new Date().toISOString() },
43
+ ...prev,
44
+ ])
45
+ setInput('')
46
+ }
47
+
48
+ function toggle(id) {
49
+ setTodos(prev => prev.map(t => t.id === id ? { ...t, done: !t.done } : t))
50
+ }
51
+
52
+ function deleteTodo(id) {
53
+ setTodos(prev => prev.filter(t => t.id !== id))
54
+ }
55
+
56
+ function clearDone() {
57
+ setTodos(prev => prev.filter(t => !t.done))
58
+ }
59
+
60
+ const visible = todos.filter(t => {
61
+ if (filter === 'active') return !t.done
62
+ if (filter === 'done') return t.done
63
+ return true
64
+ })
65
+
66
+ const doneCount = todos.filter(t => t.done).length
67
+ const activeCount = todos.filter(t => !t.done).length
68
+
69
+ const priColor = { high: '#ef4444', medium: '#fbbf24', low: '#22c55e' }
70
+
71
+ return (
72
+ <div className="page todo-page">
73
+ <div className="page-header">
74
+ <div>
75
+ <h2 className="page-title">✅ Daily To-Do</h2>
76
+ <p className="page-sub">Clear your mental load, one task at a time</p>
77
+ </div>
78
+ </div>
79
+
80
+ {/* Local-storage notice */}
81
+ <div className="local-storage-notice">
82
+ <span className="lsn-icon">💾</span>
83
+ <div>
84
+ <strong>Saved in your browser only</strong>
85
+ <p>Tasks are stored locally on this device and are never sent to our servers. Clearing your browser data will remove them.</p>
86
+ </div>
87
+ </div>
88
+
89
+ {/* Add task */}
90
+ <div className="card todo-add-card">
91
+ <div className="todo-add-row">
92
+ <input
93
+ className="form-input todo-input"
94
+ type="text"
95
+ placeholder="Add a new task…"
96
+ value={input}
97
+ onChange={e => setInput(e.target.value)}
98
+ onKeyDown={e => e.key === 'Enter' && addTodo()}
99
+ maxLength={200}
100
+ />
101
+ <div className="todo-priority-select">
102
+ {PRIORITIES.map(p => (
103
+ <button
104
+ key={p.value}
105
+ type="button"
106
+ className={`priority-pill ${priority === p.value ? 'priority-pill--active' : ''}`}
107
+ style={priority === p.value ? { borderColor: priColor[p.value], background: priColor[p.value] + '22', color: priColor[p.value] } : {}}
108
+ onClick={() => setPriority(p.value)}
109
+ >
110
+ {p.label}
111
+ </button>
112
+ ))}
113
+ </div>
114
+ <button className="btn-primary todo-add-btn" onClick={addTodo} disabled={!input.trim()}>
115
+ + Add
116
+ </button>
117
+ </div>
118
+ </div>
119
+
120
+ {/* Stats + filter */}
121
+ <div className="todo-meta-row">
122
+ <div className="todo-stats">
123
+ <span className="todo-stat">{activeCount} remaining</span>
124
+ <span className="todo-stat-sep">·</span>
125
+ <span className="todo-stat">{doneCount} done</span>
126
+ </div>
127
+ <div className="todo-filters">
128
+ {['all', 'active', 'done'].map(f => (
129
+ <button
130
+ key={f}
131
+ className={`filter-pill ${filter === f ? 'filter-pill--active' : ''}`}
132
+ onClick={() => setFilter(f)}
133
+ >
134
+ {f.charAt(0).toUpperCase() + f.slice(1)}
135
+ </button>
136
+ ))}
137
+ </div>
138
+ {doneCount > 0 && (
139
+ <button className="btn-ghost-danger" onClick={clearDone}>Clear done</button>
140
+ )}
141
+ </div>
142
+
143
+ {/* Task list */}
144
+ {visible.length === 0 && (
145
+ <div className="empty-state">
146
+ <div className="empty-icon">🎉</div>
147
+ <h3>{filter === 'done' ? 'No completed tasks' : 'Nothing here yet'}</h3>
148
+ <p>{filter === 'done' ? 'Complete a task to see it here.' : 'Add your first task above to get started.'}</p>
149
+ </div>
150
+ )}
151
+
152
+ <div className="todo-list">
153
+ {visible.map(t => (
154
+ <div key={t.id} className={`todo-item ${t.done ? 'todo-item--done' : ''}`}>
155
+ <button
156
+ className="todo-check"
157
+ style={t.done ? { borderColor: '#22c55e', background: '#22c55e' } : {}}
158
+ onClick={() => toggle(t.id)}
159
+ aria-label="Toggle complete"
160
+ >
161
+ {t.done && <span className="check-tick">✓</span>}
162
+ </button>
163
+ <div className="todo-text-col">
164
+ <span className="todo-text">{t.text}</span>
165
+ <span className="todo-created">
166
+ Added {new Date(t.createdAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}
167
+ </span>
168
+ </div>
169
+ <span
170
+ className="todo-pri-dot"
171
+ style={{ background: priColor[t.priority] }}
172
+ title={t.priority + ' priority'}
173
+ />
174
+ <button className="todo-delete" onClick={() => deleteTodo(t.id)} aria-label="Delete">🗑</button>
175
+ </div>
176
+ ))}
177
+ </div>
178
+ </div>
179
+ )
180
+ }
frontend/src/utils.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export const LEVEL_COLORS = {
2
+ Minimal: '#2dd4a5',
3
+ Mild: '#86efac',
4
+ Moderate: '#fbbf24',
5
+ Severe: '#fb923c',
6
+ Critical: '#f87171',
7
+ }
8
+
9
+ export const LEVEL_BG = {
10
+ Minimal: 'rgba(45,212,165,.15)',
11
+ Mild: 'rgba(134,239,172,.15)',
12
+ Moderate: 'rgba(251,191,36,.15)',
13
+ Severe: 'rgba(251,146,60,.15)',
14
+ Critical: 'rgba(248,113,113,.15)',
15
+ }
16
+
17
+ export const STRESS_ICONS = {
18
+ Minimal: '🟢',
19
+ Mild: '🟡',
20
+ Moderate: '🟠',
21
+ Severe: '🔴',
22
+ Critical: '🚨',
23
+ }
24
+
25
+ export const ADVICE = {
26
+ Minimal: 'Great job! Your stress levels are minimal. Keep up your healthy routines and sleep schedule.',
27
+ Mild: 'Mild stress detected. Consider a short walk or 5-minute breathing exercise today.',
28
+ Moderate: 'Moderate stress detected. Try scheduling a proper break, reduce screen time and stay hydrated.',
29
+ Severe: 'High stress detected. Please prioritise rest, reach out to someone you trust, and consider reducing workload.',
30
+ Critical: 'Critical stress indicators found. We strongly recommend speaking with a mental health professional. You are not alone.',
31
+ }
32
+
33
+ export const levelColor = l => LEVEL_COLORS[l] || '#5b9cf6'
34
+ export const levelBg = l => LEVEL_BG[l] || 'rgba(91,156,246,.15)'
35
+ export const stressIcon = l => STRESS_ICONS[l] || '⚪'
36
+
37
+ export function formatDate(iso) {
38
+ if (!iso) return '—'
39
+ return new Date(iso).toLocaleString(undefined, {
40
+ year: 'numeric', month: 'short', day: 'numeric',
41
+ hour: '2-digit', minute: '2-digit',
42
+ })
43
+ }
frontend/static/css/main.css ADDED
@@ -0,0 +1,565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ═══════════════════════════════════════════════
2
+ BREATHE — Main Stylesheet
3
+ ═══════════════════════════════════════════════ */
4
+
5
+ :root {
6
+ --bg: #0e1117;
7
+ --surface: #161b27;
8
+ --surface2: #1e2535;
9
+ --border: #2a3348;
10
+ --accent: #4f8ef7;
11
+ --accent2: #7c5cfc;
12
+ --text: #e2e8f0;
13
+ --text-muted: #7a8aa0;
14
+ --success: #4ade80;
15
+ --warning: #fbbf24;
16
+ --danger: #f87171;
17
+
18
+ /* Stress level colours */
19
+ --minimal: #4ade80;
20
+ --mild: #86efac;
21
+ --moderate: #fbbf24;
22
+ --severe: #fb923c;
23
+ --critical: #f87171;
24
+
25
+ --radius: 14px;
26
+ --radius-sm: 8px;
27
+ --shadow: 0 4px 24px rgba(0,0,0,.4);
28
+ --transition: 0.2s ease;
29
+ }
30
+
31
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
32
+
33
+ html { scroll-behavior: smooth; }
34
+
35
+ body {
36
+ font-family: 'Inter', sans-serif;
37
+ background: var(--bg);
38
+ color: var(--text);
39
+ font-size: 15px;
40
+ line-height: 1.6;
41
+ min-height: 100vh;
42
+ }
43
+
44
+ /* ── Utilities ───────────────────────────────── */
45
+ .hidden { display: none !important; }
46
+ .mt-sm { margin-top: 12px; }
47
+ .full-width { width: 100%; }
48
+
49
+ /* ── Screens ─────────────────────────────────── */
50
+ .screen { display: none; }
51
+ .screen.active { display: block; }
52
+
53
+ /* ══════════════════════════════════════════════
54
+ AUTH
55
+ ══════════════════════════════════════════════ */
56
+ .auth-bg {
57
+ min-height: 100vh;
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ background:
62
+ radial-gradient(ellipse at 20% 30%, rgba(79,142,247,.15) 0%, transparent 60%),
63
+ radial-gradient(ellipse at 80% 70%, rgba(124,92,252,.15) 0%, transparent 60%),
64
+ var(--bg);
65
+ }
66
+
67
+ .auth-card {
68
+ background: var(--surface);
69
+ border: 1px solid var(--border);
70
+ border-radius: var(--radius);
71
+ padding: 40px 36px;
72
+ width: 100%;
73
+ max-width: 420px;
74
+ box-shadow: var(--shadow);
75
+ }
76
+
77
+ .brand {
78
+ text-align: center;
79
+ margin-bottom: 28px;
80
+ }
81
+ .brand-icon { font-size: 2.8rem; display: block; margin-bottom: 6px; }
82
+ .brand-name { font-size: 2rem; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
83
+ .brand-tagline { color: var(--text-muted); font-size: .85rem; margin-top: 4px; }
84
+
85
+ /* Tabs */
86
+ .tab-bar {
87
+ display: flex;
88
+ background: var(--bg);
89
+ border-radius: var(--radius-sm);
90
+ padding: 4px;
91
+ margin-bottom: 24px;
92
+ }
93
+ .tab {
94
+ flex: 1;
95
+ padding: 8px;
96
+ border: none;
97
+ border-radius: 6px;
98
+ background: transparent;
99
+ color: var(--text-muted);
100
+ font-size: .9rem;
101
+ font-weight: 500;
102
+ cursor: pointer;
103
+ transition: var(--transition);
104
+ }
105
+ .tab.active {
106
+ background: var(--surface2);
107
+ color: var(--text);
108
+ box-shadow: 0 2px 8px rgba(0,0,0,.3);
109
+ }
110
+
111
+ /* Auth forms */
112
+ .auth-form { display: none; }
113
+ .auth-form.active { display: block; }
114
+
115
+ .field { margin-bottom: 16px; }
116
+ .field label {
117
+ display: block;
118
+ font-size: .82rem;
119
+ font-weight: 500;
120
+ color: var(--text-muted);
121
+ margin-bottom: 6px;
122
+ letter-spacing: .03em;
123
+ text-transform: uppercase;
124
+ }
125
+ .field label small { text-transform: none; font-weight: 400; }
126
+
127
+ input[type="text"],
128
+ input[type="email"],
129
+ input[type="password"],
130
+ input[type="number"],
131
+ select,
132
+ textarea {
133
+ width: 100%;
134
+ padding: 10px 14px;
135
+ background: var(--bg);
136
+ border: 1px solid var(--border);
137
+ border-radius: var(--radius-sm);
138
+ color: var(--text);
139
+ font-size: .92rem;
140
+ font-family: inherit;
141
+ outline: none;
142
+ transition: border-color var(--transition);
143
+ }
144
+ input:focus, select:focus, textarea:focus {
145
+ border-color: var(--accent);
146
+ }
147
+ select option { background: var(--surface); }
148
+ textarea { resize: vertical; }
149
+
150
+ .form-error {
151
+ background: rgba(248,113,113,.12);
152
+ border: 1px solid rgba(248,113,113,.4);
153
+ border-radius: var(--radius-sm);
154
+ color: var(--danger);
155
+ padding: 10px 14px;
156
+ font-size: .88rem;
157
+ margin-bottom: 14px;
158
+ }
159
+
160
+ /* Buttons */
161
+ .btn-primary {
162
+ padding: 11px 22px;
163
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
164
+ border: none;
165
+ border-radius: var(--radius-sm);
166
+ color: #fff;
167
+ font-size: .95rem;
168
+ font-weight: 600;
169
+ cursor: pointer;
170
+ transition: opacity var(--transition), transform var(--transition);
171
+ }
172
+ .btn-primary:hover { opacity: .9; transform: translateY(-1px); }
173
+ .btn-primary:active { opacity: 1; transform: none; }
174
+
175
+ .btn-secondary {
176
+ padding: 10px 20px;
177
+ background: transparent;
178
+ border: 1px solid var(--accent);
179
+ border-radius: var(--radius-sm);
180
+ color: var(--accent);
181
+ font-size: .9rem;
182
+ font-weight: 500;
183
+ cursor: pointer;
184
+ transition: var(--transition);
185
+ display: inline-block;
186
+ }
187
+ .btn-secondary:hover { background: rgba(79,142,247,.1); }
188
+
189
+ .btn-ghost {
190
+ background: transparent;
191
+ border: 1px solid var(--border);
192
+ border-radius: var(--radius-sm);
193
+ color: var(--text-muted);
194
+ cursor: pointer;
195
+ transition: var(--transition);
196
+ }
197
+ .btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
198
+ .btn-ghost.small { padding: 6px 12px; font-size: .82rem; }
199
+
200
+ /* ══════════════════════════════════════════════
201
+ APP LAYOUT
202
+ ══════════════════════════════════════════════ */
203
+ #app-screen { display: flex; min-height: 100vh; }
204
+
205
+ /* Sidebar */
206
+ .sidebar {
207
+ width: 230px;
208
+ background: var(--surface);
209
+ border-right: 1px solid var(--border);
210
+ display: flex;
211
+ flex-direction: column;
212
+ padding: 20px 0;
213
+ position: sticky;
214
+ top: 0;
215
+ height: 100vh;
216
+ flex-shrink: 0;
217
+ }
218
+
219
+ .sidebar-brand {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 10px;
223
+ padding: 0 20px 20px;
224
+ border-bottom: 1px solid var(--border);
225
+ margin-bottom: 16px;
226
+ }
227
+ .brand-icon { font-size: 1.5rem; }
228
+ .brand-name-sm { font-size: 1.1rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
229
+
230
+ .sidebar-nav { flex: 1; padding: 0 12px; }
231
+ .nav-item {
232
+ display: flex;
233
+ align-items: center;
234
+ gap: 10px;
235
+ width: 100%;
236
+ padding: 10px 12px;
237
+ border: none;
238
+ border-radius: var(--radius-sm);
239
+ background: transparent;
240
+ color: var(--text-muted);
241
+ font-size: .9rem;
242
+ font-weight: 500;
243
+ cursor: pointer;
244
+ margin-bottom: 4px;
245
+ transition: var(--transition);
246
+ text-align: left;
247
+ }
248
+ .nav-item:hover { background: var(--surface2); color: var(--text); }
249
+ .nav-item.active { background: var(--surface2); color: var(--accent); }
250
+ .nav-icon { font-size: 1rem; }
251
+
252
+ .sidebar-footer {
253
+ padding: 16px 20px 0;
254
+ border-top: 1px solid var(--border);
255
+ display: flex;
256
+ flex-direction: column;
257
+ gap: 10px;
258
+ }
259
+ .user-info {
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 8px;
263
+ }
264
+ .user-avatar { font-size: 1.2rem; }
265
+ .user-name { font-size: .88rem; font-weight: 500; color: var(--text); }
266
+
267
+ /* Main content */
268
+ .main-content {
269
+ flex: 1;
270
+ padding: 32px 36px;
271
+ overflow-y: auto;
272
+ max-width: 1100px;
273
+ }
274
+
275
+ .view { display: none; }
276
+ .view.active { display: block; }
277
+
278
+ /* Page header */
279
+ .page-header { margin-bottom: 28px; }
280
+ .page-header h2 {
281
+ font-size: 1.6rem;
282
+ font-weight: 700;
283
+ background: linear-gradient(90deg, var(--text), var(--text-muted));
284
+ -webkit-background-clip: text;
285
+ -webkit-text-fill-color: transparent;
286
+ }
287
+ .page-sub { color: var(--text-muted); margin-top: 4px; font-size: .9rem; }
288
+
289
+ /* ══════════════════════════════════════════════
290
+ CARDS
291
+ ══════════════════════════════════════════════ */
292
+ .card {
293
+ background: var(--surface);
294
+ border: 1px solid var(--border);
295
+ border-radius: var(--radius);
296
+ padding: 24px;
297
+ margin-bottom: 20px;
298
+ box-shadow: var(--shadow);
299
+ }
300
+ .card h3 {
301
+ font-size: 1rem;
302
+ font-weight: 600;
303
+ color: var(--text-muted);
304
+ margin-bottom: 16px;
305
+ text-transform: uppercase;
306
+ letter-spacing: .06em;
307
+ font-size: .8rem;
308
+ }
309
+
310
+ /* Stats row */
311
+ .stats-row {
312
+ display: grid;
313
+ grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
314
+ gap: 16px;
315
+ margin-bottom: 20px;
316
+ }
317
+ .stat-card {
318
+ background: var(--surface);
319
+ border: 1px solid var(--border);
320
+ border-radius: var(--radius);
321
+ padding: 20px 22px;
322
+ transition: var(--transition);
323
+ }
324
+ .stat-card:hover { border-color: var(--accent); }
325
+ .stat-value {
326
+ font-size: 1.8rem;
327
+ font-weight: 700;
328
+ color: var(--accent);
329
+ line-height: 1;
330
+ margin-bottom: 6px;
331
+ }
332
+ .stat-label {
333
+ font-size: .78rem;
334
+ color: var(--text-muted);
335
+ text-transform: uppercase;
336
+ letter-spacing: .05em;
337
+ }
338
+
339
+ /* Charts */
340
+ .chart-card { }
341
+ .chart-wrap { position: relative; height: 250px; }
342
+ .donut-wrap { max-width: 300px; height: 280px; margin: 0 auto; }
343
+
344
+ /* ══════════════════════════════════════════════
345
+ ASSESSMENT FORM
346
+ ══════════════════════════════════════════════ */
347
+ .section-card { margin-bottom: 20px; }
348
+
349
+ .section-title {
350
+ display: flex;
351
+ align-items: center;
352
+ gap: 10px;
353
+ margin-bottom: 6px;
354
+ }
355
+ .section-title h3 {
356
+ font-size: 1rem;
357
+ font-weight: 600;
358
+ color: var(--text);
359
+ text-transform: none;
360
+ letter-spacing: 0;
361
+ margin: 0;
362
+ }
363
+ .section-icon { font-size: 1.2rem; }
364
+ .section-badge {
365
+ font-size: .72rem;
366
+ padding: 2px 8px;
367
+ border-radius: 20px;
368
+ font-weight: 500;
369
+ }
370
+ .section-badge.optional {
371
+ background: rgba(122,138,160,.15);
372
+ color: var(--text-muted);
373
+ border: 1px solid rgba(122,138,160,.3);
374
+ }
375
+ .section-desc { color: var(--text-muted); font-size: .86rem; margin-bottom: 18px; }
376
+
377
+ .form-grid {
378
+ display: grid;
379
+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
380
+ gap: 14px;
381
+ }
382
+
383
+ /* ══════════════════════════════════════════════
384
+ RESULT CARD
385
+ ══════════════════════════════════════════════ */
386
+ .result-card { }
387
+
388
+ .result-gauge-wrap {
389
+ display: flex;
390
+ justify-content: center;
391
+ margin: 12px 0 20px;
392
+ }
393
+ .gauge-circle {
394
+ position: relative;
395
+ width: 160px;
396
+ height: 160px;
397
+ }
398
+ .gauge-circle svg {
399
+ width: 100%;
400
+ height: 100%;
401
+ transform: rotate(-90deg);
402
+ }
403
+ .gauge-bg { fill: none; stroke: var(--surface2); stroke-width: 12; }
404
+ .gauge-arc {
405
+ fill: none;
406
+ stroke: var(--accent);
407
+ stroke-width: 12;
408
+ stroke-linecap: round;
409
+ transition: stroke-dasharray 1s ease, stroke 0.5s ease;
410
+ }
411
+ .gauge-center {
412
+ position: absolute;
413
+ inset: 0;
414
+ display: flex;
415
+ flex-direction: column;
416
+ align-items: center;
417
+ justify-content: center;
418
+ }
419
+ .gauge-score { font-size: 1.8rem; font-weight: 700; color: var(--text); }
420
+ .gauge-label { font-size: .78rem; color: var(--text-muted); }
421
+
422
+ .result-details { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
423
+ .result-item {
424
+ display: flex;
425
+ justify-content: space-between;
426
+ align-items: center;
427
+ padding: 10px 14px;
428
+ background: var(--surface2);
429
+ border-radius: var(--radius-sm);
430
+ }
431
+ .result-key { font-size: .85rem; color: var(--text-muted); }
432
+ .result-val { font-size: .9rem; font-weight: 600; }
433
+
434
+ .result-advice {
435
+ padding: 14px 16px;
436
+ border-radius: var(--radius-sm);
437
+ font-size: .9rem;
438
+ line-height: 1.6;
439
+ margin-top: 8px;
440
+ border-left: 4px solid var(--accent);
441
+ background: rgba(79,142,247,.07);
442
+ color: var(--text);
443
+ }
444
+
445
+ /* Stress level colour helpers */
446
+ .level-minimal { color: var(--minimal); }
447
+ .level-mild { color: var(--mild); }
448
+ .level-moderate { color: var(--warning); }
449
+ .level-severe { color: var(--severe); }
450
+ .level-critical { color: var(--critical); }
451
+
452
+ /* ══════════════════════════════════════════════
453
+ ASSESSMENT LIST / HISTORY
454
+ ══════════════════════════════════════════════ */
455
+ .assessment-list.full { max-height: none; }
456
+ .empty-state { color: var(--text-muted); text-align: center; padding: 32px 0; font-size: .92rem; }
457
+
458
+ .assessment-item {
459
+ display: flex;
460
+ align-items: center;
461
+ gap: 16px;
462
+ padding: 14px 16px;
463
+ background: var(--surface2);
464
+ border-radius: var(--radius-sm);
465
+ margin-bottom: 10px;
466
+ cursor: pointer;
467
+ border: 1px solid transparent;
468
+ transition: var(--transition);
469
+ }
470
+ .assessment-item:hover { border-color: var(--accent); }
471
+
472
+ .assess-badge {
473
+ min-width: 90px;
474
+ text-align: center;
475
+ padding: 4px 12px;
476
+ border-radius: 20px;
477
+ font-size: .78rem;
478
+ font-weight: 600;
479
+ }
480
+ .assess-date { font-size: .82rem; color: var(--text-muted); flex: 1; }
481
+ .assess-score {
482
+ font-size: .88rem;
483
+ font-weight: 600;
484
+ color: var(--text-muted);
485
+ }
486
+ .assess-modality {
487
+ font-size: .75rem;
488
+ color: var(--text-muted);
489
+ background: var(--bg);
490
+ padding: 2px 8px;
491
+ border-radius: 10px;
492
+ }
493
+
494
+ .level-bg-minimal { background: rgba(74,222,128,.15); color: var(--minimal); }
495
+ .level-bg-mild { background: rgba(134,239,172,.15); color: var(--mild); }
496
+ .level-bg-moderate { background: rgba(251,191,36,.15); color: var(--warning); }
497
+ .level-bg-severe { background: rgba(251,146,60,.15); color: var(--severe); }
498
+ .level-bg-critical { background: rgba(248,113,113,.15); color: var(--critical); }
499
+
500
+ /* ── Pagination ──────────────────────────────── */
501
+ .pagination {
502
+ display: flex;
503
+ justify-content: center;
504
+ gap: 8px;
505
+ margin-top: 16px;
506
+ }
507
+ .page-btn {
508
+ padding: 6px 14px;
509
+ border: 1px solid var(--border);
510
+ border-radius: var(--radius-sm);
511
+ background: var(--surface);
512
+ color: var(--text-muted);
513
+ cursor: pointer;
514
+ font-size: .85rem;
515
+ transition: var(--transition);
516
+ }
517
+ .page-btn:hover, .page-btn.active {
518
+ border-color: var(--accent);
519
+ color: var(--accent);
520
+ }
521
+
522
+ /* ══════════════════════════════════════════════
523
+ MODAL
524
+ ══════════════════════════════════════════════ */
525
+ .modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
526
+ .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
527
+ .modal-box {
528
+ position: relative;
529
+ background: var(--surface);
530
+ border: 1px solid var(--border);
531
+ border-radius: var(--radius);
532
+ padding: 28px 32px;
533
+ width: 90%;
534
+ max-width: 540px;
535
+ max-height: 80vh;
536
+ overflow-y: auto;
537
+ box-shadow: var(--shadow);
538
+ z-index: 1;
539
+ }
540
+ .modal-box h3 { font-size: 1.1rem; margin-bottom: 16px; }
541
+ .modal-close {
542
+ position: absolute;
543
+ top: 14px;
544
+ right: 16px;
545
+ background: none;
546
+ border: none;
547
+ color: var(--text-muted);
548
+ font-size: 1.1rem;
549
+ cursor: pointer;
550
+ }
551
+
552
+ .modal-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
553
+ .modal-kv-item { background: var(--surface2); padding: 10px 14px; border-radius: var(--radius-sm); }
554
+ .modal-kv-key { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing:.04em; }
555
+ .modal-kv-val { font-size: .95rem; font-weight: 600; margin-top: 2px; }
556
+
557
+ /* ══════════════════════════════════════════════
558
+ RESPONSIVE
559
+ ══════════════════════════════════════════════ */
560
+ @media (max-width: 768px) {
561
+ .sidebar { display: none; }
562
+ .main-content { padding: 20px 16px; }
563
+ .stats-row { grid-template-columns: repeat(2, 1fr); }
564
+ .form-grid { grid-template-columns: 1fr; }
565
+ }
frontend/static/js/app.js ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ═══════════════════════════════════════════════
2
+ BREATHE — Front-end Application
3
+ ═══════════════════════════════════════════════ */
4
+
5
+ const API = ""; // same-origin; change to http://localhost:5000 if running separately
6
+
7
+ const ADVICE = {
8
+ Minimal: "Great job! Your stress levels are minimal. Keep up your healthy routines and sleep schedule.",
9
+ Mild: "Your stress is mild. Consider a short walk or 5-minute breathing exercise today.",
10
+ Moderate: "Moderate stress detected. Try to schedule a proper break, reduce screen time and stay hydrated.",
11
+ Severe: "High stress detected. Please prioritise rest, reach out to someone you trust, and consider reducing workload.",
12
+ Critical: "Critical stress indicators found. We strongly recommend speaking with a mental health professional. You are not alone.",
13
+ };
14
+
15
+ const LEVEL_COLOURS = {
16
+ Minimal: "#4ade80",
17
+ Mild: "#86efac",
18
+ Moderate: "#fbbf24",
19
+ Severe: "#fb923c",
20
+ Critical: "#f87171",
21
+ };
22
+
23
+ /* ─── Helpers ─────────────────────────────────────────────── */
24
+ const $ = (s, el = document) => el.querySelector(s);
25
+ const $$ = (s, el = document) => el.querySelectorAll(s);
26
+
27
+ function setClass(el, cls, on) {
28
+ el && (on ? el.classList.add(cls) : el.classList.remove(cls));
29
+ }
30
+
31
+ function formatDate(iso) {
32
+ const d = new Date(iso);
33
+ return d.toLocaleString(undefined, {
34
+ year: "numeric", month: "short", day: "numeric",
35
+ hour: "2-digit", minute: "2-digit",
36
+ });
37
+ }
38
+
39
+ async function apiFetch(path, options = {}) {
40
+ const res = await fetch(API + path, {
41
+ credentials: "include",
42
+ headers: { "Content-Type": "application/json", ...(options.headers || {}) },
43
+ ...options,
44
+ });
45
+ const json = await res.json().catch(() => ({}));
46
+ if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
47
+ return json;
48
+ }
49
+
50
+ /* ─── App State ───────────────────────────────────────────── */
51
+ const state = {
52
+ user: null,
53
+ timelineChart: null,
54
+ distChart: null,
55
+ historyPage: 1,
56
+ };
57
+
58
+ /* ═══════════════════════════════════════════════
59
+ AUTH
60
+ ═══════════════════════════════════════════════ */
61
+
62
+ function showAuth() { setClass($("#auth-screen"), "active", true); setClass($("#app-screen"), "active", false); }
63
+ function showApp() { setClass($("#auth-screen"), "active", false); setClass($("#app-screen"), "active", true); }
64
+
65
+ // Tab switching
66
+ $$(".tab").forEach(btn => {
67
+ btn.addEventListener("click", () => {
68
+ $$(".tab").forEach(t => t.classList.remove("active"));
69
+ btn.classList.add("active");
70
+ $$(".auth-form").forEach(f => f.classList.remove("active"));
71
+ $(`#${btn.dataset.tab}-form`).classList.add("active");
72
+ });
73
+ });
74
+
75
+ // Login
76
+ $("#login-form").addEventListener("submit", async e => {
77
+ e.preventDefault();
78
+ const errEl = $("#login-error");
79
+ errEl.classList.add("hidden");
80
+ try {
81
+ const data = await apiFetch("/api/auth/login", {
82
+ method: "POST",
83
+ body: JSON.stringify({
84
+ email: $("#login-identity").value,
85
+ username: $("#login-identity").value,
86
+ password: $("#login-password").value,
87
+ }),
88
+ });
89
+ state.user = data.user;
90
+ onLogin();
91
+ } catch (err) {
92
+ errEl.textContent = err.message;
93
+ errEl.classList.remove("hidden");
94
+ }
95
+ });
96
+
97
+ // Signup
98
+ $("#signup-form").addEventListener("submit", async e => {
99
+ e.preventDefault();
100
+ const errEl = $("#signup-error");
101
+ errEl.classList.add("hidden");
102
+ try {
103
+ const data = await apiFetch("/api/auth/signup", {
104
+ method: "POST",
105
+ body: JSON.stringify({
106
+ username: $("#signup-username").value,
107
+ email: $("#signup-email").value,
108
+ password: $("#signup-password").value,
109
+ }),
110
+ });
111
+ state.user = data.user;
112
+ onLogin();
113
+ } catch (err) {
114
+ errEl.textContent = err.message;
115
+ errEl.classList.remove("hidden");
116
+ }
117
+ });
118
+
119
+ // Logout
120
+ $("#logout-btn").addEventListener("click", async () => {
121
+ await apiFetch("/api/auth/logout", { method: "POST" }).catch(() => {});
122
+ state.user = null;
123
+ showAuth();
124
+ });
125
+
126
+ async function onLogin() {
127
+ showApp();
128
+ $("#sidebar-username").textContent = state.user.username;
129
+ $("#dash-greeting").textContent = `Welcome back, ${state.user.username}!`;
130
+ await loadDashboard();
131
+ goToView("dashboard");
132
+ }
133
+
134
+ /* ─── Check existing session on load ─────────────── */
135
+ (async () => {
136
+ try {
137
+ const data = await apiFetch("/api/auth/me");
138
+ state.user = data.user;
139
+ onLogin();
140
+ } catch {
141
+ showAuth();
142
+ }
143
+ })();
144
+
145
+ /* ═══════════════════════════════════════════════
146
+ NAVIGATION
147
+ ═══════════════════════════════════════════════ */
148
+
149
+ function goToView(name) {
150
+ $$(".view").forEach(v => v.classList.remove("active"));
151
+ $(`#view-${name}`).classList.add("active");
152
+ $$(".nav-item").forEach(b => {
153
+ b.classList.toggle("active", b.dataset.view === name);
154
+ });
155
+ if (name === "history") loadHistory(1);
156
+ if (name === "dashboard") loadDashboard();
157
+ }
158
+
159
+ $$(".nav-item").forEach(btn => {
160
+ btn.addEventListener("click", () => goToView(btn.dataset.view));
161
+ });
162
+
163
+ /* ═══════════════════════════════════════════════
164
+ DASHBOARD
165
+ ═══════════════════════════════════════════════ */
166
+
167
+ async function loadDashboard() {
168
+ try {
169
+ const data = await apiFetch("/api/assessments/summary");
170
+ const s = data.summary;
171
+ const tl = data.timeline;
172
+
173
+ if (!s || !Object.keys(s).length) {
174
+ // No data yet
175
+ return;
176
+ }
177
+
178
+ // Stats
179
+ $("#stat-total .stat-value").textContent = s.total_assessments;
180
+ $("#stat-latest .stat-value").textContent = stressIcon(s.latest_label) + " " + (s.latest_label || "—");
181
+ $("#stat-latest .stat-value").style.fontSize = "1.2rem";
182
+ $("#stat-avg .stat-value").textContent = s.avg_score ? (s.avg_score * 100).toFixed(1) + "%" : "—";
183
+
184
+ // Trend
185
+ if (tl.length >= 2) {
186
+ const diff = tl[tl.length-1].fused_score - tl[tl.length-2].fused_score;
187
+ const el = $("#stat-trend .stat-value");
188
+ el.textContent = diff > 0.01 ? "▲ Up" : diff < -0.01 ? "▼ Down" : "→ Stable";
189
+ el.style.color = diff > 0.01 ? "var(--danger)" : diff < -0.01 ? "var(--success)" : "var(--text-muted)";
190
+ el.style.fontSize = "1rem";
191
+ }
192
+
193
+ // Timeline chart
194
+ buildTimelineChart(tl);
195
+
196
+ // Distribution chart
197
+ buildDistChart(s.label_distribution);
198
+
199
+ // Recent list (last 5)
200
+ const recent = [...tl].reverse().slice(0, 5);
201
+ const listEl = $("#recent-list");
202
+ listEl.innerHTML = recent.length
203
+ ? recent.map(r => assessmentItemHTML(r)).join("")
204
+ : `<p class="empty-state">No assessments yet.</p>`;
205
+ listEl.querySelectorAll(".assessment-item").forEach(el => {
206
+ el.addEventListener("click", () => openDetailModal(el.dataset.id));
207
+ });
208
+ } catch (err) {
209
+ console.error("Dashboard load error:", err);
210
+ }
211
+ }
212
+
213
+ function buildTimelineChart(tl) {
214
+ const ctx = $("#timeline-chart").getContext("2d");
215
+ if (state.timelineChart) state.timelineChart.destroy();
216
+
217
+ state.timelineChart = new Chart(ctx, {
218
+ type: "line",
219
+ data: {
220
+ labels: tl.map(r => r.date),
221
+ datasets: [{
222
+ label: "Stress Score",
223
+ data: tl.map(r => +(r.fused_score * 100).toFixed(1)),
224
+ borderColor: "#4f8ef7",
225
+ backgroundColor: "rgba(79,142,247,.08)",
226
+ fill: true,
227
+ tension: 0.4,
228
+ pointRadius: 4,
229
+ pointBackgroundColor: tl.map(r => LEVEL_COLOURS[r.fused_label] || "#4f8ef7"),
230
+ }],
231
+ },
232
+ options: {
233
+ responsive: true,
234
+ maintainAspectRatio: false,
235
+ plugins: { legend: { display: false } },
236
+ scales: {
237
+ x: {
238
+ ticks: { color: "#7a8aa0", maxTicksLimit: 8 },
239
+ grid: { color: "#2a3348" },
240
+ },
241
+ y: {
242
+ min: 0,
243
+ max: 100,
244
+ ticks: { color: "#7a8aa0", callback: v => v + "%" },
245
+ grid: { color: "#2a3348" },
246
+ },
247
+ },
248
+ },
249
+ });
250
+ }
251
+
252
+ function buildDistChart(dist) {
253
+ const ctx = $("#distribution-chart").getContext("2d");
254
+ if (state.distChart) state.distChart.destroy();
255
+
256
+ const labels = Object.keys(dist);
257
+ const values = Object.values(dist);
258
+ const colours = labels.map(l => LEVEL_COLOURS[l] || "#4f8ef7");
259
+
260
+ state.distChart = new Chart(ctx, {
261
+ type: "doughnut",
262
+ data: {
263
+ labels,
264
+ datasets: [{ data: values, backgroundColor: colours, borderWidth: 2, borderColor: "#161b27" }],
265
+ },
266
+ options: {
267
+ responsive: true,
268
+ maintainAspectRatio: false,
269
+ plugins: {
270
+ legend: { labels: { color: "#e2e8f0", font: { size: 12 } } },
271
+ },
272
+ cutout: "60%",
273
+ },
274
+ });
275
+ }
276
+
277
+ /* ═══════════════════════════════════════════════
278
+ NEW ASSESSMENT
279
+ ═══════════════════════════════════════════════ */
280
+
281
+ $("#assess-form").addEventListener("submit", async e => {
282
+ e.preventDefault();
283
+ const btn = $("#assess-submit");
284
+ const errEl = $("#assess-error");
285
+ errEl.classList.add("hidden");
286
+ btn.disabled = true;
287
+ btn.textContent = "Analysing…";
288
+
289
+ try {
290
+ // Build psychometric payload
291
+ const psycho = {};
292
+ const numFields = [
293
+ "Sleep_Duration","Sleep_Quality","Work_Hours","Physical_Activity",
294
+ "Screen_Time","Travel_Time","Social_Interactions","Caffeine_Intake",
295
+ "Alcohol_Intake","Blood_Pressure","Cholesterol_Level","Blood_Sugar_Level",
296
+ ];
297
+ const catFields = ["Gender","Occupation","Smoking_Status","Diet_Quality"];
298
+
299
+ let hasPsycho = false;
300
+ numFields.forEach(f => {
301
+ const el = $(`[name="${f}"]`, $("#assess-form"));
302
+ if (el && el.value !== "") { psycho[f] = parseFloat(el.value); hasPsycho = true; }
303
+ });
304
+ catFields.forEach(f => {
305
+ const el = $(`[name="${f}"]`, $("#assess-form"));
306
+ if (el && el.value !== "") { psycho[f] = el.value; hasPsycho = true; }
307
+ });
308
+
309
+ const textNote = $("#text-note").value.trim();
310
+
311
+ if (!hasPsycho && !textNote) {
312
+ throw new Error("Please fill in at least one section.");
313
+ }
314
+
315
+ const body = {
316
+ psychometric: hasPsycho ? psycho : null,
317
+ text_note: textNote || null,
318
+ };
319
+
320
+ const data = await apiFetch("/api/assessments", {
321
+ method: "POST",
322
+ body: JSON.stringify(body),
323
+ });
324
+
325
+ showResult(data.prediction, data.assessment);
326
+ } catch (err) {
327
+ errEl.textContent = err.message;
328
+ errEl.classList.remove("hidden");
329
+ } finally {
330
+ btn.disabled = false;
331
+ btn.textContent = "Analyse My Stress →";
332
+ }
333
+ });
334
+
335
+ function showResult(pred, assessment) {
336
+ const panel = $("#result-panel");
337
+ panel.classList.remove("hidden");
338
+ panel.scrollIntoView({ behavior: "smooth", block: "start" });
339
+
340
+ const score = pred.fused_score;
341
+ const label = pred.fused_label;
342
+ const colour = LEVEL_COLOURS[label] || "#4f8ef7";
343
+ const perc = (score * 100).toFixed(1);
344
+
345
+ // Gauge
346
+ const circumference = 2 * Math.PI * 50; // r=50
347
+ const filled = (score * circumference).toFixed(1);
348
+ const arc = $("#gauge-arc");
349
+ arc.style.strokeDasharray = `${filled} ${circumference}`;
350
+ arc.style.stroke = colour;
351
+
352
+ $("#gauge-score").textContent = perc + "%";
353
+ $("#gauge-label").textContent = label;
354
+ $("#gauge-label").style.color = colour;
355
+
356
+ // Details
357
+ $("#res-psycho-val").textContent = pred.psycho_label
358
+ ? `${pred.psycho_label} (${(pred.psycho_score * 100).toFixed(1)}%)`
359
+ : "—";
360
+ $("#res-text-val").textContent = pred.text_label
361
+ ? `${pred.text_label} (${(pred.text_score * 100).toFixed(1)}%)`
362
+ : "—";
363
+ $("#res-modality").textContent = pred.modality_used || "—";
364
+ $("#res-time").textContent = assessment ? formatDate(assessment.created_at) : new Date().toLocaleString();
365
+
366
+ // Advice
367
+ $("#result-advice").textContent = ADVICE[label] || "";
368
+ }
369
+
370
+ /* ═══════════════════════════════════════════════
371
+ HISTORY
372
+ ═══════════════════════════════════════════════ */
373
+
374
+ async function loadHistory(page = 1) {
375
+ state.historyPage = page;
376
+ const listEl = $("#history-list");
377
+ const pagEl = $("#history-pagination");
378
+ listEl.innerHTML = `<p class="empty-state">Loading…</p>`;
379
+ pagEl.innerHTML = "";
380
+
381
+ try {
382
+ const data = await apiFetch(`/api/assessments?page=${page}&per_page=15`);
383
+ if (!data.assessments.length) {
384
+ listEl.innerHTML = `<p class="empty-state">No assessments yet. Take your first one!</p>`;
385
+ return;
386
+ }
387
+
388
+ listEl.innerHTML = data.assessments.map(a => assessmentItemHTML({
389
+ id: a.id,
390
+ date: formatDate(a.created_at),
391
+ fused_score: a.fused_score,
392
+ fused_label: a.fused_label,
393
+ modality: a.modality_used,
394
+ })).join("");
395
+
396
+ listEl.querySelectorAll(".assessment-item").forEach(el => {
397
+ el.addEventListener("click", () => openDetailModal(el.dataset.id));
398
+ });
399
+
400
+ // Pagination
401
+ if (data.pages > 1) {
402
+ for (let p = 1; p <= data.pages; p++) {
403
+ const btn = document.createElement("button");
404
+ btn.className = `page-btn${p === page ? " active" : ""}`;
405
+ btn.textContent = p;
406
+ btn.addEventListener("click", () => loadHistory(p));
407
+ pagEl.appendChild(btn);
408
+ }
409
+ }
410
+ } catch (err) {
411
+ listEl.innerHTML = `<p class="empty-state" style="color:var(--danger)">${err.message}</p>`;
412
+ }
413
+ }
414
+
415
+ function assessmentItemHTML({ id, date, fused_score, fused_label, modality }) {
416
+ const levelKey = (fused_label || "").toLowerCase();
417
+ const scoreStr = fused_score != null ? (fused_score * 100).toFixed(1) + "%" : "—";
418
+ return `
419
+ <div class="assessment-item" data-id="${id}">
420
+ <span class="assess-badge level-bg-${levelKey}">${stressIcon(fused_label)} ${fused_label || "—"}</span>
421
+ <span class="assess-date">${date || ""}</span>
422
+ <span class="assess-score">${scoreStr}</span>
423
+ ${modality ? `<span class="assess-modality">${modality}</span>` : ""}
424
+ </div>`;
425
+ }
426
+
427
+ function stressIcon(label) {
428
+ const icons = { Minimal: "🟢", Mild: "🟡", Moderate: "🟠", Severe: "🔴", Critical: "🚨" };
429
+ return icons[label] || "⚪";
430
+ }
431
+
432
+ /* ═══════════════════════════════════════════════
433
+ DETAIL MODAL
434
+ ═══════════════════════════════════════════════ */
435
+
436
+ async function openDetailModal(id) {
437
+ const modal = $("#detail-modal");
438
+ const bodyEl = $("#modal-body");
439
+ bodyEl.innerHTML = "<p style='color:var(--text-muted)'>Loading…</p>";
440
+ modal.classList.remove("hidden");
441
+
442
+ try {
443
+ const data = await apiFetch(`/api/assessments/${id}`);
444
+ const a = data.assessment;
445
+
446
+ const psycho = a.psychometric_data
447
+ ? Object.entries(a.psychometric_data)
448
+ .map(([k,v]) => `<div class="modal-kv-item"><div class="modal-kv-key">${k.replace(/_/g," ")}</div><div class="modal-kv-val">${v}</div></div>`)
449
+ .join("")
450
+ : "<p style='color:var(--text-muted);font-size:.85rem'>Not provided</p>";
451
+
452
+ bodyEl.innerHTML = `
453
+ <div class="result-item" style="margin-bottom:8px">
454
+ <span class="result-key">Fused Stress Level</span>
455
+ <span class="result-val level-${(a.fused_label||"").toLowerCase()}">${stressIcon(a.fused_label)} ${a.fused_label} (${a.fused_score != null ? (a.fused_score*100).toFixed(1)+"%" : "—"})</span>
456
+ </div>
457
+ <div class="result-item" style="margin-bottom:8px">
458
+ <span class="result-key">Psychometric</span>
459
+ <span class="result-val">${a.psycho_label || "—"}${a.psycho_score != null ? " (" + (a.psycho_score*100).toFixed(1)+"%)" : ""}</span>
460
+ </div>
461
+ <div class="result-item" style="margin-bottom:8px">
462
+ <span class="result-key">Text Sentiment</span>
463
+ <span class="result-val">${a.text_label || "—"}${a.text_score != null ? " (" + (a.text_score*100).toFixed(1)+"%)" : ""}</span>
464
+ </div>
465
+ <div class="result-item" style="margin-bottom:16px">
466
+ <span class="result-key">Date &amp; Time</span>
467
+ <span class="result-val">${formatDate(a.created_at)}</span>
468
+ </div>
469
+
470
+ ${a.text_note ? `
471
+ <h4 style="color:var(--text-muted);font-size:.78rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px">Text Note</h4>
472
+ <div style="background:var(--surface2);padding:12px 14px;border-radius:8px;font-size:.9rem;margin-bottom:16px;line-height:1.6">${escapeHtml(a.text_note)}</div>
473
+ ` : ""}
474
+
475
+ <h4 style="color:var(--text-muted);font-size:.78rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px">Psychometric Data</h4>
476
+ <div class="modal-kv">${psycho}</div>
477
+
478
+ <div style="margin-top:14px;padding:12px 14px;border-radius:8px;border-left:4px solid var(--accent);background:rgba(79,142,247,.07);font-size:.88rem;line-height:1.6">
479
+ ${ADVICE[a.fused_label] || ""}
480
+ </div>
481
+ `;
482
+ } catch (err) {
483
+ bodyEl.innerHTML = `<p style="color:var(--danger)">${err.message}</p>`;
484
+ }
485
+ }
486
+
487
+ function closeModal() { $("#detail-modal").classList.add("hidden"); }
488
+
489
+ function escapeHtml(str) {
490
+ return str.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
491
+ }
492
+
493
+ /* ── Expose globals used by inline onclick handlers ── */
494
+ const app = { goToView, closeModal };
frontend/templates/index.html ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>BREATHE — Stress Intelligence Platform</title>
7
+ <link rel="stylesheet" href="/static/css/main.css" />
8
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
10
+ </head>
11
+ <body>
12
+
13
+ <!-- ══════════════════════════ AUTH SCREENS ══════════════════════════ -->
14
+ <div id="auth-screen" class="screen active">
15
+ <div class="auth-bg">
16
+ <div class="auth-card">
17
+ <div class="brand">
18
+ <span class="brand-icon">🫁</span>
19
+ <h1 class="brand-name">BREATHE</h1>
20
+ <p class="brand-tagline">Stress Intelligence Platform</p>
21
+ </div>
22
+
23
+ <!-- Tab bar -->
24
+ <div class="tab-bar">
25
+ <button class="tab active" data-tab="login">Log In</button>
26
+ <button class="tab" data-tab="signup">Sign Up</button>
27
+ </div>
28
+
29
+ <!-- Login form -->
30
+ <form id="login-form" class="auth-form active">
31
+ <div class="field">
32
+ <label>Email or Username</label>
33
+ <input type="text" id="login-identity" autocomplete="username" placeholder="you@example.com" required />
34
+ </div>
35
+ <div class="field">
36
+ <label>Password</label>
37
+ <input type="password" id="login-password" autocomplete="current-password" placeholder="••••••••" required />
38
+ </div>
39
+ <div id="login-error" class="form-error hidden"></div>
40
+ <button type="submit" class="btn-primary full-width">Log In</button>
41
+ </form>
42
+
43
+ <!-- Signup form -->
44
+ <form id="signup-form" class="auth-form">
45
+ <div class="field">
46
+ <label>Username</label>
47
+ <input type="text" id="signup-username" autocomplete="username" placeholder="breatheuser" required />
48
+ </div>
49
+ <div class="field">
50
+ <label>Email</label>
51
+ <input type="email" id="signup-email" autocomplete="email" placeholder="you@example.com" required />
52
+ </div>
53
+ <div class="field">
54
+ <label>Password <small>(min 8 chars)</small></label>
55
+ <input type="password" id="signup-password" autocomplete="new-password" placeholder="••••••••" required />
56
+ </div>
57
+ <div id="signup-error" class="form-error hidden"></div>
58
+ <button type="submit" class="btn-primary full-width">Create Account</button>
59
+ </form>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <!-- ══════════════════════════ MAIN APP ══════════════════════════════ -->
65
+ <div id="app-screen" class="screen">
66
+
67
+ <!-- Sidebar -->
68
+ <aside class="sidebar">
69
+ <div class="sidebar-brand">
70
+ <span class="brand-icon">🫁</span>
71
+ <span class="brand-name-sm">BREATHE</span>
72
+ </div>
73
+ <nav class="sidebar-nav">
74
+ <button class="nav-item active" data-view="dashboard">
75
+ <span class="nav-icon">📊</span> Dashboard
76
+ </button>
77
+ <button class="nav-item" data-view="assess">
78
+ <span class="nav-icon">🧠</span> New Assessment
79
+ </button>
80
+ <button class="nav-item" data-view="history">
81
+ <span class="nav-icon">📋</span> History
82
+ </button>
83
+ </nav>
84
+ <div class="sidebar-footer">
85
+ <div class="user-info">
86
+ <span class="user-avatar">👤</span>
87
+ <span id="sidebar-username" class="user-name">User</span>
88
+ </div>
89
+ <button id="logout-btn" class="btn-ghost small">Log out</button>
90
+ </div>
91
+ </aside>
92
+
93
+ <!-- Main content area -->
94
+ <main class="main-content">
95
+
96
+ <!-- ── DASHBOARD VIEW ───────────────────────────────────────────── -->
97
+ <div id="view-dashboard" class="view active">
98
+ <div class="page-header">
99
+ <h2>Your Stress Dashboard</h2>
100
+ <p class="page-sub" id="dash-greeting">Welcome back!</p>
101
+ </div>
102
+
103
+ <div class="stats-row">
104
+ <div class="stat-card" id="stat-total">
105
+ <div class="stat-value">—</div>
106
+ <div class="stat-label">Total Assessments</div>
107
+ </div>
108
+ <div class="stat-card" id="stat-latest">
109
+ <div class="stat-value">—</div>
110
+ <div class="stat-label">Latest Stress Level</div>
111
+ </div>
112
+ <div class="stat-card" id="stat-avg">
113
+ <div class="stat-value">—</div>
114
+ <div class="stat-label">Average Score</div>
115
+ </div>
116
+ <div class="stat-card" id="stat-trend">
117
+ <div class="stat-value">—</div>
118
+ <div class="stat-label">Trend</div>
119
+ </div>
120
+ </div>
121
+
122
+ <!-- Timeline chart -->
123
+ <div class="card chart-card">
124
+ <h3>Stress Score Timeline</h3>
125
+ <div class="chart-wrap">
126
+ <canvas id="timeline-chart"></canvas>
127
+ </div>
128
+ </div>
129
+
130
+ <!-- Distribution -->
131
+ <div class="card chart-card">
132
+ <h3>Stress Level Distribution</h3>
133
+ <div class="chart-wrap donut-wrap">
134
+ <canvas id="distribution-chart"></canvas>
135
+ </div>
136
+ </div>
137
+
138
+ <!-- Recent assessments -->
139
+ <div class="card">
140
+ <h3>Recent Assessments</h3>
141
+ <div id="recent-list" class="assessment-list">
142
+ <p class="empty-state">No assessments yet. Take your first one!</p>
143
+ </div>
144
+ </div>
145
+ </div>
146
+
147
+ <!-- ── ASSESSMENT VIEW ──────────────────────────────────────────── -->
148
+ <div id="view-assess" class="view">
149
+ <div class="page-header">
150
+ <h2>New Assessment</h2>
151
+ <p class="page-sub">Fill in any combination of sections below</p>
152
+ </div>
153
+
154
+ <form id="assess-form">
155
+
156
+ <!-- Psychometric Section -->
157
+ <div class="card section-card">
158
+ <div class="section-title">
159
+ <span class="section-icon">📋</span>
160
+ <h3>Psychometric Cues</h3>
161
+ <span class="section-badge optional">Optional</span>
162
+ </div>
163
+ <p class="section-desc">Rate your lifestyle habits over the past week.</p>
164
+
165
+ <div class="form-grid">
166
+ <div class="field">
167
+ <label>Sleep Duration (hrs/day)</label>
168
+ <input type="number" name="Sleep_Duration" min="0" max="24" step="0.5" placeholder="7" />
169
+ </div>
170
+ <div class="field">
171
+ <label>Sleep Quality (1–5)</label>
172
+ <input type="number" name="Sleep_Quality" min="1" max="5" step="1" placeholder="3" />
173
+ </div>
174
+ <div class="field">
175
+ <label>Work Hours (hrs/day)</label>
176
+ <input type="number" name="Work_Hours" min="0" max="24" step="0.5" placeholder="8" />
177
+ </div>
178
+ <div class="field">
179
+ <label>Physical Activity (hrs/day)</label>
180
+ <input type="number" name="Physical_Activity" min="0" max="12" step="0.5" placeholder="1" />
181
+ </div>
182
+ <div class="field">
183
+ <label>Screen Time (hrs/day)</label>
184
+ <input type="number" name="Screen_Time" min="0" max="24" step="0.5" placeholder="4" />
185
+ </div>
186
+ <div class="field">
187
+ <label>Travel Time (hrs/day)</label>
188
+ <input type="number" name="Travel_Time" min="0" max="10" step="0.5" placeholder="1" />
189
+ </div>
190
+ <div class="field">
191
+ <label>Social Interactions (count/day)</label>
192
+ <input type="number" name="Social_Interactions" min="0" max="50" step="1" placeholder="5" />
193
+ </div>
194
+ <div class="field">
195
+ <label>Caffeine Intake (cups/day)</label>
196
+ <input type="number" name="Caffeine_Intake" min="0" max="20" step="1" placeholder="2" />
197
+ </div>
198
+ <div class="field">
199
+ <label>Alcohol Intake (units/week)</label>
200
+ <input type="number" name="Alcohol_Intake" min="0" max="50" step="1" placeholder="1" />
201
+ </div>
202
+ <div class="field">
203
+ <label>Blood Pressure (mmHg)</label>
204
+ <input type="number" name="Blood_Pressure" min="60" max="200" step="1" placeholder="120" />
205
+ </div>
206
+ <div class="field">
207
+ <label>Cholesterol Level (mg/dL)</label>
208
+ <input type="number" name="Cholesterol_Level" min="50" max="400" step="1" placeholder="190" />
209
+ </div>
210
+ <div class="field">
211
+ <label>Blood Sugar Level (mg/dL)</label>
212
+ <input type="number" name="Blood_Sugar_Level" min="50" max="400" step="1" placeholder="90" />
213
+ </div>
214
+ </div>
215
+
216
+ <!-- Categorical fields -->
217
+ <div class="form-grid mt-sm">
218
+ <div class="field">
219
+ <label>Gender</label>
220
+ <select name="Gender">
221
+ <option value="">-- select --</option>
222
+ <option value="Male">Male</option>
223
+ <option value="Female">Female</option>
224
+ <option value="Other">Other</option>
225
+ </select>
226
+ </div>
227
+ <div class="field">
228
+ <label>Occupation</label>
229
+ <select name="Occupation">
230
+ <option value="">-- select --</option>
231
+ <option value="Student">Student</option>
232
+ <option value="Working Professional">Working Professional</option>
233
+ <option value="Homemaker">Homemaker</option>
234
+ <option value="Retired">Retired</option>
235
+ <option value="Unemployed">Unemployed</option>
236
+ </select>
237
+ </div>
238
+ <div class="field">
239
+ <label>Smoking Status</label>
240
+ <select name="Smoking_Status">
241
+ <option value="">-- select --</option>
242
+ <option value="Non-Smoker">Non-Smoker</option>
243
+ <option value="Occasional">Occasional</option>
244
+ <option value="Regular">Regular</option>
245
+ </select>
246
+ </div>
247
+ <div class="field">
248
+ <label>Diet Quality</label>
249
+ <select name="Diet_Quality">
250
+ <option value="">-- select --</option>
251
+ <option value="Poor">Poor</option>
252
+ <option value="Average">Average</option>
253
+ <option value="Good">Good</option>
254
+ <option value="Excellent">Excellent</option>
255
+ </select>
256
+ </div>
257
+ </div>
258
+ </div>
259
+
260
+ <!-- Text Note Section -->
261
+ <div class="card section-card">
262
+ <div class="section-title">
263
+ <span class="section-icon">📝</span>
264
+ <h3>Text Note</h3>
265
+ <span class="section-badge optional">Optional</span>
266
+ </div>
267
+ <p class="section-desc">Write freely about how you're feeling. Our NLP model will analyse the sentiment.</p>
268
+ <textarea
269
+ id="text-note"
270
+ name="text_note"
271
+ rows="5"
272
+ placeholder="Today I felt... I've been experiencing... my mind keeps going to..."
273
+ ></textarea>
274
+ </div>
275
+
276
+ <div id="assess-error" class="form-error hidden"></div>
277
+ <button type="submit" class="btn-primary" id="assess-submit">Analyse My Stress →</button>
278
+ </form>
279
+
280
+ <!-- Result panel (shown after submit) -->
281
+ <div id="result-panel" class="card result-card hidden">
282
+ <h3>Your Stress Analysis</h3>
283
+ <div class="result-gauge-wrap">
284
+ <div id="result-gauge" class="result-gauge">
285
+ <div class="gauge-circle">
286
+ <svg viewBox="0 0 120 120">
287
+ <circle class="gauge-bg" cx="60" cy="60" r="50"/>
288
+ <circle id="gauge-arc" class="gauge-arc" cx="60" cy="60" r="50"
289
+ stroke-dasharray="0 314"/>
290
+ </svg>
291
+ <div class="gauge-center">
292
+ <div id="gauge-score" class="gauge-score">—</div>
293
+ <div id="gauge-label" class="gauge-label">—</div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+ </div>
298
+ <div class="result-details">
299
+ <div class="result-item" id="res-psycho">
300
+ <span class="result-key">Psychometric</span>
301
+ <span class="result-val" id="res-psycho-val">—</span>
302
+ </div>
303
+ <div class="result-item" id="res-text">
304
+ <span class="result-key">Text Sentiment</span>
305
+ <span class="result-val" id="res-text-val">—</span>
306
+ </div>
307
+ <div class="result-item">
308
+ <span class="result-key">Modality Used</span>
309
+ <span class="result-val" id="res-modality">—</span>
310
+ </div>
311
+ <div class="result-item">
312
+ <span class="result-key">Assessed At</span>
313
+ <span class="result-val" id="res-time">—</span>
314
+ </div>
315
+ </div>
316
+ <div id="result-advice" class="result-advice"></div>
317
+ <button class="btn-secondary mt-sm" onclick="app.goToView('dashboard')">View Dashboard →</button>
318
+ </div>
319
+ </div>
320
+
321
+ <!-- ── HISTORY VIEW ─────────────────────────────────────────────── -->
322
+ <div id="view-history" class="view">
323
+ <div class="page-header">
324
+ <h2>Assessment History</h2>
325
+ <p class="page-sub">All your past stress analyses</p>
326
+ </div>
327
+ <div id="history-list" class="assessment-list full">
328
+ <p class="empty-state">Loading…</p>
329
+ </div>
330
+ <div id="history-pagination" class="pagination"></div>
331
+ </div>
332
+
333
+ </main>
334
+ </div>
335
+
336
+ <!-- Modal for detail view -->
337
+ <div id="detail-modal" class="modal hidden">
338
+ <div class="modal-backdrop" onclick="app.closeModal()"></div>
339
+ <div class="modal-box">
340
+ <button class="modal-close" onclick="app.closeModal()">✕</button>
341
+ <h3>Assessment Detail</h3>
342
+ <div id="modal-body"></div>
343
+ </div>
344
+ </div>
345
+
346
+ <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
347
+ <script src="/static/js/app.js"></script>
348
+ </body>
349
+ </html>
frontend/vite.config.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ server: {
7
+ port: 5173,
8
+ proxy: {
9
+ '/api': {
10
+ target: 'http://localhost:5000',
11
+ changeOrigin: true,
12
+ secure: false,
13
+ },
14
+ },
15
+ },
16
+ build: {
17
+ outDir: 'dist',
18
+ emptyOutDir: true,
19
+ },
20
+ })
notebooks/fusion/fusion-nb (1).ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/psychometric/psychometric notebook.ipynb ADDED
The diff for this file is too large to render. See raw diff