VISION RECYCLING - BENCH TV COUNTER SYSTEM
==========================================
Two parts:
  backend/  - the central website + database (PHP + MySQL). Goes on your web host.
  station/  - the bench screen. Copy onto each bench PC (2 or more).

1. INSTALL THE BACKEND (once)
  a) Upload the whole "backend" folder to your web host, e.g. to  public_html/bench
     -> it will then be at  https://yourdomain.co.uk/bench
  b) Database tables are created/updated automatically on the first visit - no import needed.
     (backend/schema.sql is there if you ever want to import it by hand in phpMyAdmin.)
  c) backend/config.php is already filled in with your database details (localhost:3306).
     Change it only if your host gives a different database host.
  d) Make sure the folder backend/uploads can be written to by PHP (permissions 755 or 775).
     Snapshots are saved there.
  e) Open https://yourdomain.co.uk/bench/admin/  and log in:
        username: admin     password: ChangeMe123
     Go to Settings and change the password straight away.
  f) Staff page: add every member of staff (name, username, PIN of 4-8 digits).
  g) Stations page: nothing to add. Each bench PC appears here by itself the first time it
     connects. You can rename, disable or remove them here.
  h) Settings page: target per shift (default 375), shift hours (default 8, used for
     "on track"), and the red line per hour (default 50).

2. SET UP EACH BENCH PC
  a) Copy the "station" folder to the PC (e.g. C:\VisionBench) and double-click start.bat.
     Chrome or Edge opens the bench screen. Allow the camera when asked.
  b) Click "Admin", enter PIN 1234. The normal setup / live view opens.
  c) Settings > Station: the server address is already filled in. Type a name for this PC
     (e.g. Bench 1, Bench 2) and press "Save & test". It should say Connected as "Bench 1".
     If not, it shows the exact reason (e.g. HTTP 404, cannot reach server).
  d) Set the camera, zoom and bench zone as before, then press "Back to staff screen".

3. DAILY USE (staff)
  - Log in with username + PIN. The screen shows one big number: TVs counted since login.
  - A green bar "TV added to bench" flashes on every count. There is no live picture.
  - On each clock hour the finished hour's figure appears on the right (login 07:00 ->
    first figure at 08:00, second at 09:00...). Red = under 50 that hour, green = 50+.
    The big number turns green when on track for the shift target, red if the last hour
    was under 50.
  - "Not counted" = something sat on the bench 15 s+ and left without being counted.
  - Log out at the end of the shift (Log out button, top right).
  - If the internet drops, counting carries on. Events are kept on the PC and sent when the
    connection is back (status top right shows "Offline - N waiting to send").
    Staff who have logged in on that PC before can still log in while offline.

4. THE DASHBOARD (https://yourdomain.co.uk/bench/admin/)
  - Pick dates, a person and/or a station. "Today" and "This week" buttons.
  - Per person totals vs target, per hour grid (red/green, blue = hour in progress),
    per day, per week, per station, latest snapshots.
  - Export CSV downloads every event for the chosen filter.

NOTES
  - No duplicates: the counting engine and its one-count-per-bench-session rule are unchanged.
  - The admin PIN on the stations is 1234 (in app.js, line 4: const PIN = '1234').
  - Requirements: PHP 7.4 or newer (tested on 8.4) with PDO MySQL; MySQL 5.7+/8 or MariaDB 10.3+.
  - API for reference: backend/api/index.php?action=ping|login|logout|events, protected by a built-in shared secret (config.php SHARED_SECRET must match station/station.js).

CCTV PAGE
  Admin website > CCTV shows a small live picture from every bench PC (updates every
  1.5 s, about 40 KB per picture), with who is logged in and today's count. Grey = that
  PC has sent nothing for 10 s. Click a picture to enlarge. Only logged-in admins can see
  it; pictures are not saved - only the latest one per bench is kept.
  To stop a PC sending: on that PC, Admin (PIN 1234) > Settings > Station, untick
  "Send live view to dashboard".
