# ArchiTools — Complete Roadmap

> Step-by-step implementation plan. Every task from `app_modules_overview.xlsx` is tracked here.
> Modules are implemented in dependency order, tested by the AI, then submitted for user approval.

---

## Workflow

1. AI picks the next task from this file (top to bottom)
2. AI implements it, runs `npx next build` (zero errors required)
3. AI commits and pushes to `main` (Portainer auto-deploys)
4. AI notifies you: "Module X / Task Y is ready for review"
5. You test on `http://10.10.10.166:3000` and approve or request changes
6. AI moves to the next task

---

## AI Model Recommendations

| Tag          | Claude     | OpenAI        | Google           | Best For                                                               |
| ------------ | ---------- | ------------- | ---------------- | ---------------------------------------------------------------------- |
| `[HEAVY]`    | Opus 4.6   | GPT-5.3-Codex | Gemini 3 Pro     | Complex multi-file features, business logic, architecture, new modules |
| `[STANDARD]` | Sonnet 4.6 | GPT-5.2       | Gemini 3 Flash   | Refactoring, moderate features, UI work, tests, documentation          |
| `[LIGHT]`    | Haiku 4.5  | GPT-4o-mini   | Gemini 2.5 Flash | Quick fixes, small edits, config changes, build debugging              |

**Default recommendation: Sonnet 4.6** — it matches Opus-class performance at Sonnet pricing ($3/$15 per M tokens). Use Opus only for tasks marked `[HEAVY]`. Use Haiku for tasks marked `[LIGHT]`.

---

## Current Module Status (after Phase 3 completion)

| #   | Module             | Version | Status    | Remaining Gaps                                      | Future Enhancements                               |
| --- | ------------------ | ------- | --------- | --------------------------------------------------- | ------------------------------------------------- |
| 1   | Registratura       | 0.5.0   | HARDENING | —                                                   | Workflow automation, OCR, print/PDF export        |
| 2   | Email Signature    | 0.1.0   | COMPLETE  | US/SDT addresses may need update                    | AD sync, branding packs, promo banners            |
| 3   | Word XML           | 0.1.0   | COMPLETE  | —                                                   | Schema validator, visual mapper                   |
| 4   | Digital Signatures | 0.1.0   | COMPLETE  | —                                                   | Permission layers, document insertion             |
| 5   | Password Vault     | 0.4.0   | COMPLETE  | —                                                   | Hardware key, rotation reminders, Passbolt        |
| 6   | IT Inventory       | 0.2.0   | COMPLETE  | —                                                   | Network scan import                               |
| 7   | Address Book       | 0.1.1   | COMPLETE  | —                                                   | Email sync, deduplication                         |
| 8   | Prompt Generator   | 0.2.0   | HARDENING | Bug fixes, new idea TBD                             | Prompt scoring, more image templates              |
| 9   | Word Templates     | 0.1.0   | COMPLETE  | No clause library; no Word generation               | Diff compare, document generator                  |
| 10  | Tag Manager        | 0.2.0   | HARDENING | Logic/workflow fix, ERP API exposure needed         | Smart suggestions                                 |
| 11  | Mini Utilities     | 0.3.0   | COMPLETE  | —                                                   | More converters, more tools TBD                   |
| 12  | Dashboard          | 0.1.0   | COMPLETE  | —                                                   | Custom dashboards per role                        |
| 13  | AI Chat            | 0.2.0   | COMPLETE  | Needs API key env vars for real AI                  | Streaming, model selector, conversation templates |
| 14  | Hot Desk           | 0.1.1   | COMPLETE  | —                                                   | —                                                 |
| 15  | ParcelSync         | 0.5.0   | COMPLETE  | Needs real-world UAT testing at scale               | Map visualization, batch enrichment, export tools |
| 16  | Visual Copilot     | 0.1.0   | SEPARATE  | Dev in separate repo (git.beletage.ro/gitadmin/vim) | AI image analysis, merge into ArchiTools later    |

**Phases 1–3 COMPLETE (all 42 tasks).** Phase 7B (ParcelSync) COMPLETE. Phase 4B (Pre-Launch Hardening) IN PROGRESS.

---

## PHASE 1 — Module Gap Fixes (close all xlsx gaps)

> Fix existing modules to match the xlsx spec. Ordered by impact and dependency.

### 1.01 ✅ `[LIGHT]` Verify Email Signature Logo Files (2026-02-18)

**What:** Check if `/public/logos/logo-us-dark.svg`, `logo-us-light.svg`, `logo-sdt-dark.svg`, `logo-sdt-light.svg` exist. If not, create placeholder SVGs or obtain real logos from the user.
**Files:** `public/logos/`
**Why first:** Broken images are the most visible bug.
**User action needed:** Provide actual logo files for Urban Switch and Studii de Teren if placeholders won't do.
**Status:** All logo files exist with valid SVG content. No action needed.

---

### 1.02 ✅ `[STANDARD]` Email Signature — Address Toggle for US/SDT (2026-02-18)

**What:** Urban Switch and Studii de Teren are hardcoded to Str. Unirii address. Add address toggle (like Beletage has) if these companies use different addresses.
**Files:** `src/modules/email-signature/components/signature-configurator.tsx`, `src/modules/email-signature/services/company-branding.ts`
**User action needed:** Confirm addresses for Urban Switch and Studii de Teren.
**Status:** Address toggle UI added for US and SDT companies. Currently configured with Str. Unirii address for both. User can update addresses in company-branding.ts when confirmed.

---

### 1.03 ✅ `[STANDARD]` Prompt Generator — Architecture Visualization Templates (2026-02-18)

**What:** Add 6+ new builtin templates per xlsx spec:

1. Architectural rendering prompt (basic massing to detailed)
2. Sketch → professional render prompt
3. Visualization refinement prompt (photorealism fine-tuning)
4. Technical compliance checking prompt
5. Legal/formal review prompt (extend existing)
6. Contract text cleanup prompt
7. GIS / survey interpretation prompt
8. BIM coordination prompt
9. Report rewriting prompt
10. Structured technical Q&A prompt

**Files to modify:** `src/modules/prompt-generator/services/builtin-templates.ts`
**Files to create:** Additional template definitions (can be in same file or split)
**Status:** 10 new templates added (total 14): arch-render-massing, sketch-to-render, photorealism-refinement, tech-compliance, legal-formal-review, contract-cleanup, gis-survey-interpretation, bim-coordination, report-rewrite, structured-qa.

---

### 1.04 ✅ `[STANDARD]` Tag Manager — US/SDT Project Seeds + Mandatory Categories (2026-02-18)

**What:**

1. Add Urban Switch and Studii de Teren project numbering to seed data (US-001, SDT-001 format)
2. Enforce mandatory 1st category (project) and 2nd category (phase) when creating tags — show validation error if missing
3. Import the full tag structure from `legacy/manicprojects/current manic time Tags.txt` in proper 1st→5th category hierarchy

**Files to modify:**

- `src/modules/tag-manager/services/seed-data.ts` — Add US/SDT projects
- `src/modules/tag-manager/components/tag-create-form.tsx` — Add mandatory validation

**Status:** US (10 projects, US-001→US-010, color #345476) and SDT (10 projects, SDT-001→SDT-010, color #0182A1) seed data added. Mandatory validation enforces project code + company scope for project tags. Validation errors shown inline. Legacy ManicTime import already covered all Beletage projects + phases + activities + doc types.

---

### ✅ 1.05 `[STANDARD]` Mini Utilities — Add Missing Tools

**What:** Add the 5 missing tools from xlsx:

1. **U-value → R-value converter** (R = 1/U, with material thickness input)
2. **AI artifact cleaner** (strip markdown formatting, fix encoding, remove prompt artifacts from pasted text)
3. **MDLPA date locale validator** (validate Romanian administrative dates against legal calendar)
4. **PDF reducer** (compress PDF via Stirling PDF API at http://10.10.10.166:8087, or client-side canvas compression for images)
5. **Quick OCR** (paste image → extract text; use Tesseract.js client-side or Stirling PDF OCR endpoint)

**Files to modify:** `src/modules/mini-utilities/components/mini-utilities-module.tsx`
**Dependencies:** `tesseract.js` (for OCR), possibly Stirling PDF API calls

**Status:** ✅ Done. All 5 tools implemented: U→R calculator (with Rsi/Rse/λ), AI artifact cleaner (markdown strip + encoding fix + typography normalise), MDLPA iframe embed, PDF reducer via Stirling PDF API with level selector, OCR via ocr.z.ai iframe. Build passes, pushed to main.

---

### ✅ 1.06 `[STANDARD]` Digital Signatures — File Upload + Tag Editing

**What:**

1. Add drag-and-drop / file picker for uploading signature/stamp images (convert to base64 on upload, like Registratura attachments)
2. Add tag input field to the asset form (tags field exists in type but form doesn't render it)

**Files to modify:**

- `src/modules/digital-signatures/components/` — asset form component

**Status:** ✅ Done. Drag-and-drop/click file picker cu preview base64 în `AssetForm` și `AddVersionForm`. Tags chip input (Enter/virgulă pentru adăugare, Backspace/X pentru ștergere). Build ok, pushat.

---

### ✅ 1.07 `[LIGHT]` Password Vault — Company Scope + Strength Meter

**What:**

1. Add `company` field to credential type and form (scope passwords to a company)
2. Add password strength indicator (visual bar: weak/medium/strong based on length + character diversity)
3. Rename `encryptedPassword` → `password` in the type (it's not encrypted, the name is misleading)

**Files to modify:**

- `src/modules/password-vault/types.ts`
- `src/modules/password-vault/components/` — form and list components

**Status:** ✅ Done. Renamed `encryptedPassword` → `password` in type. Added `company: CompanyId` field. Form now has company selector (Beletage/Urban Switch/Studii/Grup). Password strength meter with 4 levels (slabă/medie/puternică/foarte puternică) based on length + character diversity (upper/lower/digit/symbol). Meter updates live. Build ok, pushat.

### ✅ 1.08 `[LIGHT]` IT Inventory — Link assignedTo to Address Book

**What:** Change `assignedTo` from free text to an autocomplete that links to Address Book contacts (same pattern as Registratura sender/recipient).
**Files to modify:**

- `src/modules/it-inventory/components/` — equipment form
- `src/modules/it-inventory/types.ts` — Add `assignedToContactId?: string`

**Status:** ✅ Done. Added `assignedToContactId?: string` field to InventoryItem type. Form now shows autocomplete dropdown filtering Address Book contacts (searches by name or company). Up to 5 suggestions shown. Clicking a contact pre-fills both display name and contact ID. Placeholder "Caută după nume..." guides users. Build ok, pushed.

---

### ✅ 1.09 `[STANDARD]` Address Book — vCard Export + Registratura Reverse Lookup

**What:**

1. Add "Export vCard" button per contact (generate `.vcf` file download)
2. Add a section showing Registratura entries where this contact appears as sender or recipient

**Files to modify:**

- `src/modules/address-book/components/` — contact card/detail view
  **Files to create:**
- `src/modules/address-book/services/vcard-export.ts`

**Status:** ✅ Done. Created `vcard-export.ts` generating vCard 3.0 (.vcf) with name, org, title, phones, emails, address, website, notes, contact persons. Added Download icon button on card hover. Added detail dialog (FileText icon) showing full contact info + scrollable table of all Registratura entries where this contact appears as sender or recipient (uses `allEntries` to bypass filters). Build ok, pushed.

### ✅ 1.10 `[STANDARD]` Word Templates — Placeholder Auto-Detection

**What:** When a template file URL points to a `.docx`, parse it client-side to extract `{{placeholder}}` patterns and auto-populate the `placeholders[]` field. Use JSZip (already installed) to read the docx XML.
**Files to modify:**

- `src/modules/word-templates/components/` — template form
  **Files to create:**
- `src/modules/word-templates/services/placeholder-parser.ts`

**Status:** ✅ Done. `placeholder-parser.ts` uses JSZip to read all `word/*.xml` files from the .docx ZIP, searches for `{{...}}` patterns in both raw XML and stripped text (handles Word’s split-run encoding). Form now has: “Alege fișier .docx” button (local file picker, most reliable — no CORS) and a Wand icon on the URL field for URL-based detection (may fail on CORS). Parsing spinner shown during detection. Detected placeholders auto-populate the field. Build ok, pushed.

### ✅ 1.11 `[STANDARD]` Dashboard — Activity Feed + KPI Panels

**What:**

1. Add an activity feed showing recent actions across modules (last 20 creates/updates/deletes from localStorage timestamps)
2. Add KPI cards: entries this week, deadlines this week, overdue count, contacts added this month
3. Wire the `DashboardWidget` type that already exists in `types.ts`

**Files to modify:** `src/modules/dashboard/components/` or `src/app/(modules)/page.tsx`

**Status:** ✅ Done. Created `src/modules/dashboard/hooks/use-dashboard-data.ts` — scans all `architools:*` localStorage keys directly, extracts entities with timestamps, builds activity feed (last 20, sorted by `updatedAt`) and KPI counters. Updated `src/app/page.tsx`: KPI grid (6 cards: registratura this week, open dosare, deadlines this week, overdue in red, new contacts this month, active IT equipment), activity feed with module icon + label + action + relative time (Romanian locale). Build ok, pushed.

---

### ✅ 1.12 `[LIGHT]` Registratura — Increase Linked-Entry Selector Limit

**What:** Added search/filter input (by number, subject, sender) to the linked-entry selector. Removed `.slice(0, 20)` cap. Also improved chip labels to show truncated subject.
**Commit:** `cd4b0de`
**Status:** Done ✅

---

### ✅ 1.13 `[LIGHT]` Word XML — Remove POT/CUT Auto-Calculation

**What:** Removed `computeMetrics` entirely from `XmlGeneratorConfig`, `generateCategoryXml`, `generateAllCategories`, `downloadZipAll`, `useXmlConfig`, `XmlSettings`, and `WordXmlModule`. Fields kept; auto-injection removed.
**Commit:** `eaca24a`
**Status:** Done ✅

---

## PHASE 2 — New Module: Hot Desk Management ✅

> Module 14 from xlsx. Entirely new.

### 2.01 ✅ `[HEAVY]` Hot Desk Module — Full Implementation (2026-02-26)

**What:** Build Module 14 from scratch per xlsx spec.
**Status:** ✅ Done. Full implementation: 4 desks, week-ahead calendar, reserve/cancel, room layout with window (left) + door (right) landmarks, history. Registered in modules/navigation/flags.

---

## PHASE 3 — Replanificare Detaliată (Ideation & Requirements)

> Fază adăugată pentru rafinarea cerințelor, UX și logicii de business înainte de implementarea tehnică.

### 3.01 ✅ `[UI/UX]` Header & Navigare Globală (2026-02-27)

**Cerințe noi:**

- **Logo-uri:** Mărirea dimensiunii logo-urilor în header.
- **Mini-joc Logo:** Click pe logo-uri le animează (spin/bounce/ping), combo secret BTG→US→SDT declanșează confetti.
- **Navigare:** Click pe titlul aplicației redirecționează către Dashboard.
- **Theme Toggle:** Slider animat sun/moon cu gradient zi/noapte, stele, nori.
- **Dark mode logos:** Variante corecte light/dark pe baza temei, cu fallback montat.

**Status:** ✅ Done. Sidebar redesigned: logos in centered row (flex-1, theme-aware, dual-render light+dark), "ArchiTools" text below, animated theme toggle (Sun/Moon lucide icons, gradient background, stars/clouds).

### 3.02 ✅ `[BUSINESS]` Registratura — Integrare și UX (2026-02-27)

**Cerințe noi:**

- **Tipuri de documente (Bidirecțional):** Câmpul de tip document comunică cu Tag Manager. Dacă se introduce un tip nou, se salvează automat ca etichetă nouă sub o categorie fixă "Registratura" (pentru a acoperi și apeluri telefonice, video-uri, nu doar documente fizice).
- **Expeditor/Destinatar (Bidirecțional):** Autocomplete legat de Address Book. Dacă un contact nu există, se creează automat (minim Nume) și apare un popup rapid pentru a adăuga opțional Telefon/Email.
- **Status Simplificat:** Eliminarea statusului "Deschis". Înlocuire cu un simplu checkbox "Închis" (implicit totul e deschis).
- **Termen Limită Intern:** Clarificarea funcției (ex: termen pentru a răspunde la o intrare). Adăugare tooltip/info box explicativ pentru a maximiza eficiența echipei.
- **Pregătire Integrare ERP (Responsabil):** Adăugarea unui câmp "Responsabil" (Assignee) pentru a aloca sarcini interne, gândit arhitectural pentru a putea fi expus/sincronizat ușor printr-un API/Webhook viitor către un sistem ERP extern.
- **Legături între intrări/ieșiri (Thread-uri & Branches):** Posibilitatea de a lega o ieșire de o intrare specifică (ex: "Răspuns la adresa nr. X"), creând un "fir" (thread) vizual al conversației instituționale. Trebuie să suporte și "branching" (ex: o intrare generează mai multe ieșiri conexe către instituții diferite). UI-ul trebuie să rămână extrem de simplu și intuitiv (ex: vizualizare tip arbore simplificat sau listă indentată în detaliile documentului).

**Status:** ✅ Done. All 6 sub-features implemented:

1. **Dynamic doc types** — Select + inline "Tip nou" input. New types auto-created as Tag Manager tags (category: document-type). Added "Apel telefonic" and "Videoconferință" as defaults.
2. **Bidirectional Address Book** — Autocomplete shows "Creează contact" button when no match. QuickContactDialog popup creates contact in Address Book with minimal data (Name required, Phone/Email optional).
3. **Simplified status** — Replaced Status dropdown with Switch toggle "Închis/Deschis". Default is open.
4. **Internal deadline tooltip** — Added Info tooltip explaining "Termen limită intern" vs legal deadlines. Also added tooltips on "Închis" and "Responsabil" fields.
5. **Responsabil (Assignee)** — New field with contact autocomplete + quick-create. ERP-ready with separate assigneeContactId. Shown in registry table as "Resp." column.
6. **Threads & Branching** — `threadParentId` field links entries as reply-to. Thread search with direction badges. ThreadView component shows parent, current entry, siblings (branches), and child replies as indented tree. Thread icon in table. Click to navigate between threaded entries.

### 3.03 ✅ `[BUSINESS]` Registratura — Termene Legale (Flux Nou) (99fbddd)

**Implementat:**

- ✅ **Declanșare Termen:** Câmpuri `recipientRegNumber` + `recipientRegDate` pe RegistryEntry — termenul legal curge de la data înregistrării la destinatar
- ✅ **Sistem de Alerte:** Alert banners (amber/red) în Dashboard + tab Termene legale pentru ieșiri fără date destinatar și documente expirând
- ✅ **Categorii Termene:** CU deja pe prima categorie; adăugat `prelungire-cu` (15 zile calendaristice, acord tacit aplicabil)
- ✅ **Acord Tacit:** Deja implementat în Phase 2 — funcționează automat
- ✅ **Istoric Modificări (Audit Log):** `DeadlineAuditEntry` interface, audit log pe fiecare `TrackedDeadline` (created/resolved), expandabil pe deadline card
- ✅ **Valabilitate Documente:** `expiryDate` + `expiryAlertDays` cu countdown live color-coded (red=expirat, amber=aproape)
- ✅ **Pregătire Web Scraping:** Câmpuri `externalStatusUrl` + `externalTrackingId` pe RegistryEntry
- ✅ **Dashboard Stats:** 6 carduri (adăugat "Lipsă nr. dest." + "Expiră curând")

**Neimplementat (necesită integrare complexă):**

- ⏳ **Generare Raport/Declarație:** Necesită integrare cross-module Registratura ↔ Word Templates

### 3.03b ✅ `[STANDARD]` Registratura — NAS Network Path Attachments (2026-02-28)

**Implementat:**

- ✅ **NAS config** (`src/config/nas-paths.ts`): 4 drive mappings (A:\=Arhiva, O:\=Organizare, P:\=Proiecte, T:\=Transfer)
- ✅ **Hostname + IP fallback**: toate funcțiile au variante `...ByIp()` — `toUncPathByIp()`, `toFileUrlByIp()` — pentru când DNS nu rezolvă `newamun`
- ✅ **Link NAS button** în secțiunea atașamente: input inline cu validare, preview cale scurtă
- ✅ **Visual distinct**: border albastru, HardDrive icon, badge cu numele share-ului (Proiecte/Arhiva/etc.)
- ✅ **Click deschide Explorer** via `file:///` URL, buton "IP" fallback pe hover
- ✅ **Copy path** button pe hover
- ✅ **Drive letter → UNC** normalization automată (P:\ → \\newamun\Proiecte)
- ✅ **`shareLabelFor()`** helper returns human-readable share name

### 3.03c ✅ `[STANDARD]` Registratura — Detail Sheet + Column Manager (2026-02-28)

**Implementat:**

- ✅ **Entry Detail Sheet**: panou lateral (Sheet) cu vizualizare completă a înregistrării — status badges, date, părți, thread-uri, atașamente cu preview inline, termene legale, etichete, note
- ✅ **Attachment Preview**: imagini afișate inline, fișiere cu download, NAS paths cu UNC complet + IP fallback
- ✅ **Column Visibility Manager**: dropdown cu checkbox-uri pentru 10 coloane, persistat în localStorage
- ✅ **Default columns**: Nr., Data, Dir., Subiect, Exped., Dest., Status (7/10 vizibile implicit)
- ✅ **Tooltip naming convention**: fiecare header de coloană are tooltip cu explicație completă în română
- ✅ **Table UX cleanup**: click pe rând deschide detail sheet, acțiuni reduse la View + Edit, Close/Delete mutate în sheet
- ✅ **Row click navigation**: cursor-pointer pe rânduri, Eye icon + Pencil icon în acțiuni

### 3.03d ✅ `[STANDARD]` Registratura — QuickLook Attachment Preview + Bug Fixes (2026-02-28)

**Implementat:**

- ✅ **QuickLook-style preview modal** (`attachment-preview.tsx`, ~480 lines): fullscreen dark overlay cu animații
- ✅ **Image preview**: zoom with scroll wheel + buttons (25%–500%), pan/drag when zoomed, reset cu tasta 0
- ✅ **PDF preview**: native browser PDF viewer via blob URL iframe (scroll, zoom, print built-in)
- ✅ **Multi-file navigation**: săgeți stânga/dreapta (keyboard + butoane), thumbnail strip în josul ecranului
- ✅ **Actions**: download, print, close (Esc)
- ✅ **NAS link fix**: `file:///` URLs blocked by browsers — replaced with copy-to-clipboard + "Copiat!" feedback
- ✅ **NAS card overflow fix**: disabled horizontal scroll on Radix ScrollArea viewport, redesigned card to single-row compact
- ✅ **Password Vault filter reset**: category/search reset to "all" after add/edit

### 3.04 ✅ `[ARCHITECTURE]` Autentificare & Identitate (2026-02-27)

**Cerințe noi:**

- **Devansare Prioritate Authentik:** Integrarea cu Authentik (legat la Domain Controller/Active Directory).
- **Sincronizare Useri:** Sistemul poate citi lista de utilizatori din Authentik/AD.

**Status:** ✅ Done. NextAuth v4 + Authentik OIDC fully configured. Group→role mapping (admin/manager/user) and group→company mapping. Header user menu with login/logout. Env vars hardcoded in docker-compose.yml (Portainer CE limitation). See also Phase 6 below.

### 3.05 `[BUSINESS]` Email Signature — Automatizare și Branding ✅ DONE (b433857)

**Implementat:**

- ✅ **Precompletare din cont (AD):** Buton "Din cont" completează automat numele și compania din sesiunea Authentik
- ✅ **Slider Dimensiune Logo:** Control 50%–200% în secțiunea Stil & Aranjare, aplicat în HTML-ul generat
- ✅ **Bannere Promoționale:** Secțiune configurabilă cu URL imagine, URL link, text alternativ, dimensiuni; previzualizare live; salvabil în preseturile existente
- ✅ **Elemente Grafice US/SDT:** Iconițe decorative distincte — liniuță (Urban Switch) și punct (Studii de Teren) — înlocuiesc slash-urile generice Beletage

### 3.06 `[BUSINESS]` Template Library (Fostul Word Templates) ✅ DONE (5992fc8)

**Implementat:**

- ✅ **Redenumire:** "Șabloane Word" → "Bibliotecă Șabloane" (Template Library) în config, navigație, i18n
- ✅ **Multi-format:** Suport Word (.docx), Excel (.xlsx), PDF, DWG, Archicad (.tpl/.pln) cu auto-detecție tip din extensie
- ✅ **Versionare Automată:** Buton "Revizie Nouă" — arhivează versiunea curentă în istoric, incrementează automat semver (1.0 → 1.1)
- ✅ **Istoric Versiuni:** Dialog cu toate versiunile anterioare, fiecare cu link descărcare și note revizie
- ✅ **Clarificare UX:** Toggle "Link extern" / "Încarcă fișier", placeholder-e detectate automat și silențios doar pentru .docx, secțiune ascunsă pentru alte formate
- ✅ **Backward compatible:** Entități vechi fără fileType/versionHistory primesc defaults automat

### 3.07 ✅ `[BUSINESS]` Digital Signatures — Simplificare și Suport TIFF (2026-02-28)

**Cerințe noi:**

- **Simplificare Formular:** Eliminarea câmpurilor inutile pentru fluxul actual: "inițiale", "data expirare", "statut legal" și "note utilizare".
- **Suport Nativ TIFF:** Permiterea încărcării fișierelor `.tiff` (formatul principal folosit pentru semnături/ștampile). _Notă tehnică: Deoarece browserele nu randează nativ TIFF, se va implementa o conversie client-side (ex: via `tiff.js` sau un canvas) doar pentru preview-ul vizual, dar sistemul va stoca și va folosi fișierul TIFF original._
- **Organizare pe Subcategorii:** Adăugarea posibilității de a grupa semnăturile/ștampilele pe subcategorii clare (ex: "Colaboratori firma X", "Experți tehnici", "Verificatori de proiect").
- **Opțiuni de Descărcare Avansate:**
  - Descărcare fișier original (`.tiff` / `.png`).
  - Generare și descărcare document Word (`.docx`) gol care conține imaginea inserată automat.
  - Generare și descărcare document PDF gol care conține imaginea inserată automat.

**Status:** ✅ Done. Removed `initials` type, `expirationDate`, `legalStatus`, `usageNotes` fields. Added `subcategory` field with creatable input (6 defaults: Colaboratori, Experți tehnici, Verificatori de proiect, Proiectanți, Diriginți de șantier, Responsabili tehnici). TIFF upload via `utif2` client-side decode → PNG preview, original TIFF stored in `originalFileData`. Download dropdown on each card: Original, Word (.docx via `docx` lib), PDF (.pdf via `jsPDF`). Assets grouped by subcategory in list view with subcategory filter.

### 3.08 ✅ `[BUSINESS]` IT Inventory — Simplificare și Status Nou (2026-02-28)

**Cerințe noi:**

- **Eliminare Câmpuri Inutile:** Se vor șterge câmpurile "Atribuit către" (assignedTo), "Data achiziție", "Cost achiziție" și "Expirare garanție".
- **Tipuri Dinamice (Bidirecțional):** Câmpul "Tip echipament" (ex: Laptop, Monitor) trebuie să permită adăugarea interactivă de noi tipuri direct din formular (similar cu logica de la Registratură/Tag Manager).
- **Status Nou "Închiriat":** Adăugarea statusului "Închiriat" în lista de statusuri.
- **Atenționare Vizuală (Animație):** Când un echipament are statusul "Închiriat", badge-ul/rândul respectiv trebuie să aibă o animație subtilă (ex: un puls de culoare, un glow) pentru a "sări în ochi" în tabelul principal.
- **Vizualizare Rack (Server Rack 42U):**
  - Adăugarea unei vizualizări grafice (schematice) a unui rack de servere standard de 42U.
  - În formularul de echipament, dacă tipul este compatibil (ex: Server, Switch, UPS, Patch Panel), se vor adăuga două câmpuri noi: "Poziție Rack (U)" (ex: 12) și "Dimensiune (U)" (ex: 1U, 2U).
  - Echipamentele care au aceste date completate vor fi randate automat în vizualizarea grafică a rack-ului.
  - La hover pe un echipament din rack, va apărea un tooltip cu detaliile de bază (Nume, IP, Status).

**Status:** ✅ Done. Rewrote types.ts: dynamic `InventoryItemType` (string-based) with `DEFAULT_EQUIPMENT_TYPES` (added server/switch/ups/patch-panel), `RACK_MOUNTABLE_TYPES` set, new "rented" status with `STATUS_LABELS` export. Removed deprecated fields (assignedTo, purchaseDate, purchaseCost, warrantyExpiry). Added `rackPosition`/`rackSize` fields. New `server-rack.tsx` — 42U rack visualization with color-coded status slots and tooltips. Rewrote module component: tabbed UI (Inventar + Rack 42U), 5 stat cards with purple pulse animation for rented count, inline custom type creation, conditional rack position fields for mountable types.

### 3.09 ✅ `[BUSINESS]` Address Book — Tipuri Dinamice (2026-02-27)

**Cerințe noi:**

- **Tip Contact Dinamic:** Câmpul "Tip" devine "creatable select" (dropdown + text input) cu salvare automată.

**Status:** ✅ Done. `CreatableTypeSelect` component (input + "+" button), `DEFAULT_TYPE_LABELS` + dynamic types from existing contacts, `ContactType` allows `| string` for custom types.

### 3.10 ✅ `[UI/UX]` Hot Desk — Orientare Vizuală (2026-02-27)

**Cerințe noi:**

- **Punct de Reper (Fereastră):** Fereastră pe stânga, ușă pe dreapta.

**Status:** ✅ Done. Window on left wall (sky-blue, "Fereastră"), door on right wall (amber, "Ușă").

### 3.11 ✅ `[BUSINESS]` Password Vault — Câmpuri Noi + Rework v0.3.0 (2026-02-28)

**Cerințe noi:**

- **Câmp Email:** Adăugarea unui câmp distinct pentru "Email", separat de "Username".
- **Link Clickabil:** URL afișat ca link clickabil (tab nou) din lista de parole.
- **Redenumire:** "Seif Parole" → "Parole Uzuale"
- **Categorii noi:** WiFi, Portale Primării, Avize Online, PIN Semnătură, Software, Echipament HW (înlocuiesc server/database/api)
- **Iconițe categorie:** lucide-react icons per categorie (Globe, Mail, Wifi, Building2, etc.)
- **WiFi QR Code:** QR generat real pe canvas (`qrcode` lib) — scanabil direct, cu butoane Copiază imaginea / Descarcă PNG
- **Form context-aware:** PIN vs Parolă, ascunde email/URL/generator pentru WiFi/PIN
- **Stat cards dinamice:** top 3 categorii după nr. intrări
- **Eliminat banner criptare**

**Status:** ✅ Done. v0.3.0.

### 3.12 `[BUSINESS]` Mini Utilities — Extindere și Fix-uri ✅ DONE (989a990)

**Implementat:**

- ✅ **Transformare Numere în Litere:** Convertor complet RO — lei/bani, variante compact și cu spații, suport până la 1 miliard
- ✅ **Convertor Suprafețe (Bidirecțional):** 5 câmpuri editabile (mp, ari, ha, km², sq ft), orice câmp actualizează restul
- ✅ **Convertor U ↔ R (Bidirecțional):** Toggle U→R / R→U, calcul cu Rsi/Rse/lambda
- ✅ **Fix MDLPA:** Iframe înlocuit cu 3 carduri link extern (portal, tutoriale, regulament)
- ✅ **PDF Reducer:** Drag & drop, 2 nivele (Echilibrat/Maximă), linkuri Deblocare PDF + PDF/A pe Stirling PDF
- ✅ **Extractor Paletă Culori:** Upload imagine → canvas downscale → top 8 culori ca swatches hex clickabile
- ⏭️ **DWG to DXF:** Amânat — necesită serviciu backend (ODA File Converter sau similar)

### 3.13 ✅ `[BUSINESS]` Tag Manager — Sincronizare ManicTime (11b35c7)

**Implementat:**

- ✅ **Sincronizare Bidirecțională:** Parser service (`manictime-service.ts`) parsează/serializează Tags.txt; API route `/api/manictime` cu GET (citire + plan sync) + POST (pull/push/both); UI panel cu buton verificare, import, export, sincronizare completă
- ✅ **Versionare Fișier (Backup):** Backup automat `Tags_backup_YYYYMMDD_HHMMSS.txt` la fiecare scriere (push/both)
- ✅ **Validare Ierarhie:** Verificare cod proiect, asociere companie, detectare duplicate; avertizări afișate în UI
- ✅ **Docker config:** `MANICTIME_TAGS_PATH` env var, volume mount `/mnt/manictime`; necesită configurare SMB pe host

**Infrastructură necesară (pe server):**

- Montare SMB share: `//time/tags → /mnt/manictime` pe host-ul Ubuntu (cifs-utils)

### 3.14 `[ARCHITECTURE]` Storage & Securitate ✅

**Cerințe noi:**

- **Migrare Storage (Prioritate):** ✅ PostgreSQL via Prisma — realizat anterior (DatabaseStorageAdapter).
- **Criptare Parole:** ✅ AES-256-GCM server-side encryption. Dedicated `/api/vault` route, `src/core/crypto/` service, ENCRYPTION_SECRET env var. Legacy plaintext auto-detected at decrypt. PATCH migration endpoint.
- **Integrare Passbolt (Wishlist):** Studierea posibilității de a lega Password Vault-ul din ArchiTools direct de instanța voastră de Passbolt (via API), pentru a avea un singur "source of truth" securizat pentru parole.

### 3.15 `[BUSINESS]` AI Tools — Extindere și Integrare ✅

**Implementat (commit d34c722):**

- **Prompt Generator v0.2.0:**
  - Search bar cu căutare în name/description/tags/category labels
  - Filtru target type (text/image) cu dropdown + toggle rapid "Imagine"
  - 4 template-uri noi imagine (18 total): Midjourney Exterior, SD Interior Design, Midjourney Infographic, SD Material Texture
- **AI Chat v0.2.0 — Real API Integration:**
  - `/api/ai-chat` route: multi-provider (OpenAI gpt-4o-mini, Anthropic claude-sonnet-4-20250514, Ollama llama3.2, demo)
  - System prompt default în română pt context arhitectură (Legea 50/1991, norme P118, DTAC/PT)
  - `use-chat.ts`: `sendMessage()` cu fetch real, `sending` state, `providerConfig` la mount, `updateSession()`
  - UI: provider badge (Wifi/WifiOff + label), Bot icon pe mesaje assistant, spinner la generare, config banner cu detalii tech
- **AI Chat + Tag Manager:**
  - Project selector dropdown în chat header via `useTags('project')`
  - `ChatSession.projectTagId` + `projectName` — context injectat în system prompt
  - Project name afișat în sidebar sesiuni
- **Docker:** env vars AI_PROVIDER, AI_API_KEY, AI_MODEL, AI_BASE_URL, AI_MAX_TOKENS

**Neimplementat (wishlist):**

- Node-based Canvas (infinite canvas) — necesită bibliotecă React Flow, complexitate mare
- Nod Interpretare 3D — necesită Three.js, model ML, out of scope curent

---

## PHASE 4 — Quality & Testing

> Foundation work: tests, CI, docs, data safety.

### 4.01 `[STANDARD]` Install Testing Framework (Vitest)

**What:** Install and configure Vitest with React Testing Library.

```bash
npm install -D vitest @testing-library/react @testing-library/jest-dom jsdom @vitest/coverage-v8
```

**Files to create:** `vitest.config.ts`, `src/test-setup.ts`
**Files to modify:** `package.json` (add test scripts)

---

### 4.02 `[STANDARD]` Unit Tests — Critical Services

**What:** Write tests for the most critical business logic:

1. `working-days.test.ts` — Orthodox Easter 2024-2030, addWorkingDays, backward deadlines
2. `deadline-service.test.ts` — Due date computation, tacit approval, chain resolution
3. `registry-service.test.ts` — Number generation, overdue calculation
4. `local-storage.test.ts` — CRUD, namespace isolation
5. `feature-flags.test.ts` — Defaults, env overrides

**Coverage target:** 90%+ for services.

---

### 4.03 `[STANDARD]` Data Export/Import for All Modules

**What:** Create a shared utility for backing up localStorage data:

1. Per-module JSON export (download file)
2. Per-module JSON import (upload + merge)
3. Full backup: export ALL modules as single JSON
4. Add export/import buttons to each module's main view

**Files to create:** `src/shared/hooks/use-data-export.ts`, `src/shared/components/common/data-export-button.tsx`

---

### 4.04 `[LIGHT]` Update Stale Documentation

**What:** Update docs to reflect current state:

- `docs/architecture/SYSTEM-ARCHITECTURE.md` — Change modules from "Planned" to "Implemented"
- `docs/DATA-MODEL.md` — Add TrackedDeadline, Hot Desk schemas
- `docs/REPO-STRUCTURE.md` — Add new files

---

### 4.05 `[LIGHT]` Wire External Tool URLs to Env Vars

**What:** `src/config/external-tools.ts` has hardcoded IPs. Wire to `process.env.NEXT_PUBLIC_*_URL` with fallback.

---

## PHASE 5 — AI Chat Enhancements

> Remaining AI Chat features not covered by task 3.15.

### 5.01 `[STANDARD]` AI Chat — Response Streaming

**What:** Add streaming via ReadableStream for real-time token display (currently waits for full response).
**Note:** Basic multi-provider API integration already done in 3.15 (`/api/ai-chat`).
**Remaining:**

- ReadableStream SSE response
- Model selector dropdown in UI
- Token usage display
- Provider switching without restart

---

### 5.02 `[STANDARD]` AI Chat — Domain-Specific System Prompts

**What:** Architecture office-focused conversation modes:

- Romanian construction law assistant
- Architectural visualization prompt crafter
- Technical specification writer
- Urban planning regulation lookup
- Document drafting assistant
- Normative compliance checker

---

### 5.03 `[LIGHT]` Enable AI Chat Feature Flag

**What:** Set `module.ai-chat` enabled in `flags.ts` + production `.env`.

---

## PHASE 6 — Authentication (Authentik SSO) ✅

> Real users, real permissions. Core auth done, access control pending.

### 6.01 ✅ `[HEAVY]` Authentik OIDC Integration (2026-02-27)

**What:** Replace stub user with real Authentik SSO.
**Status:** ✅ Done. NextAuth v4 + Authentik OIDC provider configured. Group→role mapping (authentik groups → admin/manager/user). Group→company mapping (beletage/urban-switch/studii-de-teren). Cookie-based session. `useAuth()` returns real user. Header shows user name/email + logout. Sign in with Authentik page works.

Env vars (hardcoded in docker-compose.yml for Portainer CE):

- `NEXTAUTH_URL=https://tools.beletage.ro`
- `NEXTAUTH_SECRET`, `AUTHENTIK_CLIENT_ID`, `AUTHENTIK_CLIENT_SECRET`, `AUTHENTIK_ISSUER`

---

### 6.02 `[STANDARD]` Module-Level Access Control

**What:** Implement `canAccessModule()` with role-based rules. FeatureGate checks flag + permission.
**Depends on:** 6.01 ✅

---

### 6.03 `[STANDARD]` Data Visibility Enforcement

**What:** Filter storage results by `visibility` and `createdBy` fields (already stored on every entity, never enforced).
**Depends on:** 6.01 ✅

---

### 6.04 `[LIGHT]` Audit Logging

**What:** Log create/update/delete actions with user ID + timestamp. Console initially, later storage/N8N.
**Depends on:** 6.01 ✅

---

## PHASE 7 — Storage Migration (localStorage → Database) — PARTIALLY DONE

> Multi-user shared data. PostgreSQL + Prisma + MinIO client configured.

### 7.01 ✅ `[HEAVY]` PostgreSQL + Prisma Setup (2026-02-27)

**What:** PostgreSQL + Prisma ORM setup.
**Status:** ✅ Done. Prisma v6.19.2 with PostgreSQL on 10.10.10.166:5432. `KeyValueStore` model. `npx prisma generate` in Dockerfile. `@prisma/client` in dependencies.

---

### 7.02 ✅ `[HEAVY]` API Storage Adapter (2026-02-27)

**What:** `DatabaseStorageAdapter` implementing `StorageService` via `/api/storage` route + Prisma.
**Status:** ✅ Done. Set `NEXT_PUBLIC_STORAGE_ADAPTER=database` to activate. All 14 modules instantly get DB persistence.

---

### 7.03 `[STANDARD]` Data Migration Tool

**What:** One-time export from localStorage → import to PostgreSQL. Preserve IDs and timestamps.
**Depends on:** 7.02 ✅

---

### 7.04 ✅ `[HEAVY]` MinIO File Storage (2026-02-27)

**What:** MinIO client configured and tested.
**Status:** ✅ Done. MinIO client installed (`minio` npm package). Connected to 10.10.10.166:9002 (API) / 9003 (UI). Bucket `tools` exists. File upload adapter not yet wired to StorageService (MinioAdapter pending).

---

## PHASE 7B — ParcelSync / eTerra Module (NEW — 2026-03)

> GIS integration with Romania's national eTerra/ANCPI cadastral system.

### 7B.01 ✅ `[HEAVY]` ParcelSync Core — eTerra Client + Layer Sync (2026-03)

**What:** eTerra API client with form-post auth, JSESSIONID cookie jar, session caching, paginated layer fetching. 23-layer catalog. Background sync with progress polling. PostGIS storage with GisFeature model.
**Status:** ✅ Done. `eterra-client.ts` (~1000 lines), `sync-service.ts`, `eterra-layers.ts`, `session-store.ts`. Pagination with `maxRecordCount=1000` + page size fallbacks (500, 200). Default timeout 120s. Background sync via server singleton.

---

### 7B.02 ✅ `[HEAVY]` ParcelSync — Enrichment Pipeline (2026-03)

**What:** Per-parcel enrichment via eTerra `/api/immovable/list`. Extracts NR_CAD, NR_CF, PROPRIETARI, SUPRAFATA, INTRAVILAN, CATEGORIE_FOLOSINTA, HAS_BUILDING, etc.
**Status:** ✅ Done. `enrich-service.ts` with `FeatureEnrichment` type. JSONB storage in `enrichment` column.

---

### 7B.03 ✅ `[STANDARD]` ParcelSync — Owner Search (2026-03)

**What:** Search by owner name. DB-first (ILIKE on enrichment JSON PROPRIETARI) with eTerra API fallback.
**Status:** ✅ Done. `/api/eterra/search-owner`, `searchImmovableByOwnerName()` in client. Mode toggle in Search tab UI.

---

### 7B.04 ✅ `[STANDARD]` ParcelSync — Per-UAT Analytics Dashboard (2026-03)

**What:** Visual dashboard per UAT with KPIs, area stats, intravilan/extravilan donut, land use bars, top owners, fun facts. CSS-only (no chart libraries).
**Status:** ✅ Done. `/api/eterra/uat-dashboard` with SQL aggregates. `uat-dashboard.tsx` component. Dashboard button on each UAT card in DB tab.

---

### 7B.05 ✅ `[STANDARD]` ParcelSync — Health Check + Maintenance Detection (2026-03)

**What:** Ping eTerra every 3min, detect maintenance by keywords in HTML, block login when down, show amber "Mentenanță" state.
**Status:** ✅ Done. `eterra-health.ts` singleton, `/api/eterra/health` endpoint, session route blocks login, UI shows amber pill with message extraction.

**Bugs found & fixed during ParcelSync development:**

- Timeout 40s too low for geometry pages → increased to 120s
- `arr[0]` access fails TS strict even after length check → assign to const
- `?? ""` on `{}` typed field produces `{}` → use `typeof` check
- Prisma `$queryRaw` result needs explicit cast + guard

---

## PHASE 4B — Pre-Launch Hardening (2026-03 — OFFICE TESTING)

> Final fixes and polish before rolling out to the office for daily use.
> Official testing start: **2026-03-09**. All critical items must be resolved.

### 4B.01 ✅ `[LIGHT]` Address Book — Type Dropdown Alphabetical Sort (2026-03-08)

**What:** Type dropdown (filter + creation form) always sorted alphabetically by Romanian label, including newly created custom types.
**Files:** `src/modules/address-book/components/address-book-module.tsx`
**Status:** ✅ Done. `allTypes` memo sorted with `localeCompare('ro')`. `CreatableTypeSelect` entries merged and sorted.

---

### 4B.02 ✅ `[LIGHT]` Hot Desk — Window/Door Proportions (2026-03-08)

**What:** Room layout: window ~half current height, door ~double current height. Window indicator dots reduced from 6 to 3.
**Files:** `src/modules/hot-desk/components/desk-room-layout.tsx`
**Status:** ✅ Done. Window: `top-[35%] bottom-[35%]` (was `top-4 bottom-4`). Door: `h-16` (was `h-8`).

---

### 4B.03 ✅ `[STANDARD]` Mini Utilities — TVA Calculator (2026-03-08)

**What:** Quick VAT calculator with 19% Romanian rate. Two modes: "Adaugă TVA" (add to net) and "Extrage TVA" (extract from gross). Copy buttons, formatted RON output.
**Files:** `src/modules/mini-utilities/components/mini-utilities-module.tsx`
**Status:** ✅ Done. New `TvaCalculator` component with mode toggle, RON formatting, copy-to-clipboard.

---

### 4B.04 `[STANDARD]` Registratura — Legal Deadline Workflow Fixes

**What:** Fix gaps in the legal deadline tracking logic:

- Chain deadline workflow (resolving one → prompt to add next in sequence)
- Backward deadline edge cases (e.g., AC extension 45 working days BEFORE expiry)
- Tacit approval auto-detection when overdue + applicable type
- UI polish for deadline dashboard (filters, sorting, edge states)
  **Files:** `src/modules/registratura/services/deadline-service.ts`, `components/deadline-dashboard.tsx`, `components/deadline-add-dialog.tsx`
  **Status:** TODO

---

### 4B.05 `[STANDARD]` Tag Manager — Logic/Workflow Fix + ERP API

**What:**

- Fix tag assignment and filtering logic/workflow issues
- Expose tags via API for external ERP integration (read-only endpoint for tag list + project assignments)
- Verify ManicTime bidirectional sync still works
  **Files:** `src/modules/tag-manager/`, `src/app/api/` (new tags API route)
  **Status:** TODO

---

### 4B.06 `[STANDARD]` Prompt Generator — Bug Fixes + New Features

**What:** Address known bugs and implement new ideas (details TBD from user testing):

- Fix any template rendering issues
- Add new templates as requested
- Implement user-suggested feature improvements
  **Files:** `src/modules/prompt-generator/`
  **Status:** TODO — awaiting user feedback from testing

---

### 4B.07 `[HEAVY]` Authentik SSO — Verify & Fix

**What:** End-to-end verification that Authentik OIDC login works:

- Verify auth.beletage.ro accessibility
- Test login flow (redirect → auth → callback → session)
- Verify group→role/company mapping
- Fix any issues with NextAuth v4 + Authentik provider config
- Ensure session persistence and token refresh
  **Files:** `src/core/auth/`, `src/app/api/auth/`, `.env` / `docker-compose.yml`
  **Status:** TODO — critical for multi-user testing

---

### 4B.08 `[STANDARD]` DB/Storage — End-to-End Verification

**What:** Verify all 14 modules correctly persist to PostgreSQL:

- Test CRUD operations for each module
- Verify data survives container restart
- Check storage adapter fallback behavior
- Validate MinIO file storage connection (adapter pending)
  **Files:** `src/core/storage/`, `src/app/api/storage/`, `prisma/schema.prisma`
  **Status:** TODO

---

### 4B.09 ✅ `[STANDARD]` Mini Utilities v0.2.0 — Extreme Compression, DWG, UX (2025-07-21)

**What:** Major Mini Utilities upgrade:
- **Extreme PDF compression** via direct Ghostscript + qpdf pipeline (rivaling iLovePDF — `PassThroughJPEGImages=false`, QFactor 1.5, 72 DPI downsample)
- **DWG→DXF converter** via libredwg (Docker only)
- **PDF Unlock** in-app via Stirling PDF proxy
- **Removed PDF/A** tab (unused)
- **Paste support** (Ctrl+V) on all file drop zones
- **Mouse drag-drop reordering** on thermal comparison layers
- **Tabs reorganized** into 2 visual rows
- Dockerfile updated: `apk add ghostscript qpdf libredwg`

**Files:** `Dockerfile`, `src/modules/mini-utilities/components/mini-utilities-module.tsx`, `src/app/api/compress-pdf/extreme/route.ts` (rewritten), `src/app/api/compress-pdf/unlock/route.ts` (new), `src/app/api/dwg-convert/route.ts` (new)
**Status:** ✅ DONE

---

### 4B.10 `[LIGHT]` Visual Copilot — Separate Repo Documentation

**What:** Visual Copilot is being developed in a **separate repository**: `https://git.beletage.ro/gitadmin/vim`. Current ArchiTools placeholder stays as-is. Module will be merged back as a proper module when ready.
**Status:** DOCUMENTED — no code changes needed in ArchiTools

---

## PHASE 8 — Advanced Features

> Cross-cutting features that enhance the entire platform.

### 8.01 `[HEAVY]` Project Entity & Cross-Module Linking

**What:** New module: Projects. Central entity linking Registratura entries, Tags, Contacts, Templates.
**Reference:** `docs/DATA-MODEL.md` lines 566-582.

---

### 8.02 `[STANDARD]` Global Search (Cmd+K)

**What:** Search across all modules. Each module registers a search provider. Header bar integration.

---

### 8.03 ✅ `[STANDARD]` Notification System + Registratura UI Polish (2026-03-11)

**What:** Email notification system with daily digest via Brevo SMTP + N8N cron. Plus Registratura toolbar and registry number UX improvements.
**Implemented:**
- Brevo SMTP relay (nodemailer, port 587 STARTTLS), sender "Alerte Termene" &lt;noreply@beletage.ro&gt;
- Daily digest email: urgent deadlines, overdue deadlines, expiring documents
- Per-user notification preferences (3 types + global opt-out) stored in KeyValueStore
- API routes: POST `/api/notifications/digest` (N8N Bearer auth), GET/PUT `/api/notifications/preferences` (session auth)
- Test mode via `?test=true` query param on digest endpoint
- "group" company users see ALL entries across companies in digest
- UI: Bell icon button "Notificari" in Registratura toolbar → dialog with toggles
- Icon-only toolbar buttons (Bune practici + Notificari) with native `title` tooltips
- HTML email: inline-styled tables, color-coded rows (red/yellow/blue), per-company grouping
- N8N cron: `0 8 * * 1-5` (weekdays 8:00)
- **Compact registry numbers**: single-letter company badge (B=blue, U=violet, S=green, G=gray) + direction arrow (↓ green=intrat, ↑ orange=iesit) + plain number — `CompactNumber` component in `registry-table.tsx`
**Files:** `src/core/notifications/`, `src/app/api/notifications/`, `components/notification-preferences.tsx`, `components/registry-table.tsx`

---

### 8.04 ✅ `[STANDARD]` Mini Utilities + Password Vault — UX Improvements (2026-03-12)

**What:** TVA calculator with configurable rate, new scale calculator for drawings, multi-user support in Password Vault.
**Implemented:**
- **TVA cotă configurabilă**: preseturi 5%/9%/19%/21% + câmp custom; rata efectivă afișată în rezultate; titlu card actualizat dinamic
- **Calculator scară desen** (tab nou "Scară"): modul Real→Desen (input cm, output mm) și Desen→Real (input mm, output cm); 7 preseturi 1:20..1:5000 + scară custom 1:X; afișare secundară în m/cm; copy button pe rezultat
  - Logică: `drawing_mm = real_cm × 10 / scale` / `real_cm = drawing_mm × scale / 10`
- **Password Vault — utilizatori multipli**: tip `VaultUser { username, password, email?, notes? }`; câmp `additionalUsers: VaultUser[]` pe `VaultEntry`; secțiune colapsibilă "Utilizatori suplimentari" în form; badge cu numărul de utilizatori în lista de intrări; normalizare backward-compat în `useVault` hook
**Files:** `src/modules/mini-utilities/components/mini-utilities-module.tsx`, `src/modules/password-vault/types.ts`, `src/modules/password-vault/components/password-vault-module.tsx`, `src/modules/password-vault/hooks/use-vault.ts`
**Versions:** Mini Utilities 0.2.0→0.3.0, Password Vault 0.3.0→0.4.0

---

### 8.05 `[STANDARD]` Registratura — Print/PDF Export

**What:** Export registry as formatted PDF. Options: full registry, single entry, deadline summary.

---

### 8.06 `[STANDARD]` Word Templates — Clause Library + Document Generator

**What:** In-app clause composition, template preview, simple Word generation from templates.

---

### 8.07 `[STANDARD]` N8N Webhook Integration

**What:** Fire webhooks on events (new entry, deadline approaching, status change). N8N at http://10.10.10.166:5678.

---

### 8.08 `[STANDARD]` Mobile Responsiveness Audit

**What:** Test all modules on 375px/768px. Fix overflowing tables, forms, sidebar.

---

## PHASE 9 — Security & External Access

### 9.01 `[HEAVY]` Guest/External Access Role

**What:** Read-only guest role, time-limited share links. Depends on Authentik (Phase 6).

---

### 9.02 `[STANDARD]` CrowdSec Integration

**What:** IP banning for brute force. CrowdSec at http://10.10.10.166:8088.

---

### 9.03 `[LIGHT]` SSL/TLS via Let's Encrypt

**What:** When public domain ready, configure in Nginx Proxy Manager.

---

## PHASE 10 — CI/CD

### 10.01 `[STANDARD]` Gitea Actions CI Pipeline

**What:** `.gitea/workflows/ci.yml` — lint, typecheck, test, build on push.
**Check first:** Is Gitea Actions runner installed on server?

---

### 10.02 `[STANDARD]` E2E Tests (Playwright)

**What:** End-to-end tests for critical flows: navigation, Registratura CRUD, email signature, tag management.

---

## Infrastructure Credentials Needed

| Service                  | What                                    | When Needed           | Status                |
| ------------------------ | --------------------------------------- | --------------------- | --------------------- |
| **US/SDT Logos**         | SVG/PNG logo files                      | Phase 1 (task 1.01)   | ✅ Done               |
| **US/SDT Addresses**     | Office addresses for email signature    | Phase 1 (task 1.02)   | ✅ Done (placeholder) |
| **Anthropic API Key**    | `sk-ant-...` from console.anthropic.com | Phase 5 (task 5.01)   | Pending               |
| **OpenAI API Key**       | `sk-...` from platform.openai.com       | Phase 5 (task 5.01)   | Pending               |
| **Authentik Admin**      | Login to create OAuth app at :9100      | Phase 6 (task 6.01)   | ✅ Done               |
| **MinIO Credentials**    | Access key + secret key for :9003       | Phase 7 (task 7.04)   | ✅ Done               |
| **PostgreSQL**           | Database + password                     | Phase 7 (task 7.01)   | ✅ Done               |
| **Gitea Actions Runner** | Registration token from Gitea admin     | Phase 10 (task 10.01) | Pending               |

---

## Quick Picker

**15 min tasks** `[LIGHT]`:

- 1.01 — Check logo files
- ~~1.07 — Password vault company + strength~~ ✅
- 1.08 — IT inventory contact link
- 1.12 — Registry linked-entry limit
- 1.13 — Remove POT/CUT auto-calc
- 3.04 — Update stale docs
- 3.05 — Wire env var URLs

**1 hour tasks** `[STANDARD]`:

- 1.03 — Prompt generator templates
- 1.04 — Tag manager seeds + mandatory
- ~~1.05 — Mini utilities new tools~~ ✅
- ~~1.06 — Digital signatures upload~~ ✅
- 1.09 — Address book vCard + reverse lookup
- 1.11 — Dashboard activity feed + KPIs
- 3.01 + 3.02 — Tests setup + core tests

**Full session tasks** `[HEAVY]`:

- 2.01 — Hot Desk module (new)
- 4.01 — AI Chat API integration
- 5.01 — Authentik SSO
- 6.01 + 6.02 — PostgreSQL + API adapter
- 7.01 — Project entity module
