oficina / fichas Public

Fichas level-up: design spec, revision 1 (Escritorio, with Expediente's sentence and Rejilla's cell keys)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 00e3ad35c51f4829957eab2d023e0f8f007a9008 parent b791bdd
1 file changed, +814 −0
  • docs/superpowers/specs/2026-11-17-fichas-level-up.md +814 −0
diff --git a/docs/superpowers/specs/2026-11-17-fichas-level-up.md b/docs/superpowers/specs/2026-11-17-fichas-level-up.md
new file mode 100644
index 0000000..d2e5859
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-17-fichas-level-up.md
@@ -0,0 +1,814 @@
+# Fichas level-up: Escritorio, with Expediente's sentence and Rejilla's cell keys
+
+**Status:** revision 1, 2026-11-17. For review. Nothing is built.
+- §18 records each review round and what changed.
+- §13's questions to Paul are open. The design is built on the proposed answers, each marked "Proposed, awaiting Paul".
+
+**Branch:** `design/level-up-2` (Fichas), from `main` `b791bdd`. The old name `feat/level-up` is a merged branch and is not reused.
+
+**What still binds:**
+- the base spec, `2026-09-19-fichas-design.md`: §0's one rule, §2 ("never a second calculator"), §4's seal boundary and in-memory index, §4.3's no-DDL rule, §5's event log, §6's suite contract and §9's reach rules;
+- the type-designer draft 2, `2026-11-12-type-designer-design.md` on `origin/design/type-designer` (`f415c00`), with Paul's rulings R1–R6. This spec absorbs its slices A–E (§8), so that branch is not built on its own;
+- `AGENTS.md`'s hard rules: `scope.Owned`, no request body bound to a model, forward-only migrations, money as integer cents, screens that work with scripts off, confirm pages for destructive actions, `make ci`.
+
+**This spec changes no trust property.** It adds kinds of value, objects and screens. Every new column is either sealed or named in §10's leak list with its reason.
+
+**Mock-ups:** `oficina/polish-audit/fichas-ux/`: `c.html` (Escritorio), `b.html` (Expediente, for the sentence), `a.html` (Rejilla, for the cell keys), `index.html` (the round, its seal table and its Notion table), and `shots/`. `shots/current/` is today's app at `b791bdd`. The mock-ups are the reference for look and measurement. They move things with script and fake their data; the build renders everything on the server.
+
+**Prior art this spec reuses, and does not restate:**
+- Mapa's level-up (`mapa` `2026-11-14-mapa-level-up.md`): the house structure, the stacked header, the floating glass panel, the fold, and the scriptless-floor discipline.
+- Mapa images (`mapa` `design/images`, `2026-11-17-mapa-images.md`, revision 2, `c27a292`): sealed bytes in the CARLOS store, served through the app (§7).
+- The Notion importer (`mapa` `design/notion-import`, `2026-11-17-notion-import.md`, revision 2, `fda6c12`), whose §17 sketches phase 2, databases into Fichas. §11 says what this level-up gives it.
+
+---
+
+## 1. Why
+
+Paul, 2026-11-17: *"Fichas probably needs a lot of features like configurable columns, saved views, click to edit etc. etc."* Saved views, personal and team, were ruled on 2026-11-12.
+
+He was shown three directions: Rejilla (a grid), Expediente (views in the rail, a sentence, the card as a page) and Escritorio (a View panel, a view switcher in the header, the card beside the list). He ruled, 2026-11-17: **Escritorio.** *"I think Escritorio is more consistent with the other apps as we're guiding them."*
+
+Two things are borrowed from the other directions (Q1):
+- **Expediente's sentence**, as a caption over the table. It says what the view shows, and each of its words opens the matching part of the View panel.
+- **Rejilla's keyboard in the cells**: arrows move, Enter edits, typing replaces, Esc cancels.
+
+## 2. What was chosen
+
+- **Header:** Docs', Slides' and Mapa's I2 stacked header (estilo `39792ae`, already pinned). It carries Fichas' mark, the title, the menus Card, Edit, View, Type and Help, the **view switcher** and the save state in the lead slot, the **View** toggle, the primary action ("New customer") and the account.
+- **Rail:** Fichas' rail stays (R1), with **folders** as collapsible headings (R2), an icon per type, New type below a rule, and ⌘\ to fold it.
+- **The View panel:** one floating glass panel, Docs' inspector for data. It holds the layout (Table, Board, Calendar, Cards), filter, sort, group, and columns with order, width, hide and freeze. Its foot says "Changed" when the view differs from what is saved, with Reset, Save and Save as new.
+- **The caption:** one sentence over the table: "Customers where Stage is Lead, Contacted or Proposal and Next action is before 1 December, soonest Next action first." Each underlined word opens that part of the panel.
+- **The table:** click a cell to change it. Each change saves at once, is logged, and gets Undo in a toast (Q3). The keyboard moves between cells.
+- **The card beside the list:** the name opens the card in a pane beside a narrowed list. J and K walk the list. Its fields are quiet inputs, always editable. "Full page" opens it on its own.
+- **Saved views:** team views anyone may change, each change logged and undoable; personal views only their owner sees (Q2).
+- **Board and calendar** layouts (Q8).
+- **New field kinds:** date with an optional end and time (Q7), number formats and money, checkbox, multi-select, person, link to another type, and files and images (Q6).
+- **The stepped type designer**, with folders, templates and "describe it", as draft 2 specified.
+- **Phone:** the panel is a sheet, the table is a list of rows, the card is its own screen.
+
+---
+
+## 3. The shell
+
+### 3.1 Header
+
+The estilo bar stack, as Mapa uses it (Mapa level-up §3.1). Fichas' slots:
+
+| Slot | Contents |
+|---|---|
+| Mark | Fichas' mark, linking to `/` |
+| Title | The type's plural on a list ("Customers"); the card's title on a card's full page; "New type" in the designer. Not renamed in place: a type is renamed in its settings, a card on its card |
+| Menubar | **Card**: New, Open full page, Delete… · **Edit**: Undo, Redo · **View**: Show View panel, Table, Board, Calendar, Cards, Density, Fold rail · **Type**: Fields, Card layout, Type settings, New type, Folders · **Help** |
+| Lead | The view switcher (§4.2) and the save state: "Saved", "Saving…", or "Couldn't save" with Retry |
+| Actions | Search (focuses the Find box, ⌘K), View (toggles the panel, `aria-pressed`), the primary "New <singular>" |
+| Account | estilo's account menu, as today |
+
+- **Search stays per type.** ⌘K focuses the type's Find box. A search across every type is out (§12).
+- **Every menu item is a link or a form.** With scripts off, each menu is estilo's `<details>` menu.
+
+### 3.2 Rail
+
+- **R1:** the rail stays. Its rows keep today's grid: a 16px icon column and the label on one centre line (`TestRailIconsSitOnTheTextsCentreLine`).
+- **R2, folders:** each type is in at most one folder. A type with no folder sits above the folders. A folder heading is a `<details>`, so it collapses with no script. Its open state is a per-person cookie, as density is. The folder holding the current type is always open.
+- **Each type has its icon** (§8.1) and its card count, as the mock-ups show.
+- **New type** is a quieter row below a rule.
+- **⌘\ folds the rail** to icons, and back. The fold is two submit buttons, one per state, and CSS shows the one that fits (Mapa build note 10). `POST /view/rail` sets a cookie, writes no row, logs no event, and returns only to a local path.
+- **Below 800px** the rail is estilo's Menu sheet.
+
+### 3.3 Breakpoints
+
+| Width | Layout |
+|---|---|
+| ≥ 1280px | rail 232px, the work, and the panel (340px) floating over the work's inline end. With the card open: rail, list (288px), card |
+| 800–1279px | the rail folds by default (a saved choice wins). The panel floats over the table, which scrolls under it |
+| < 800px | the bar's Menu sheet; the table becomes a list (§5.6); the panel is a bottom sheet; the card is its own screen |
+
+At 1440px with the rail, the table and the panel open, the page has three columns. The mock-up round named this as Escritorio's cost. The panel is closed by default, and a person's choice to keep it open is remembered (§4.1).
+
+### 3.4 estilo
+
+- **The floating glass panel moves into estilo** as `[estilo-float]`: the glass, the rim and shadow, the dark values, and the placement helper.
+ - Docs' inspector is the first implementation and Mapa's Links panel the second. Mapa's build note 23 left the extraction to "the second adopter's" next step, and it has not happened. Fichas is the third, so the extraction is due now.
+ - Phase 2 (§14) does it on an estilo branch if it has not landed by then. Docs and Mapa adopt it at their next re-pin.
+- **The rail's folder headings and fold** stay Fichas' own. Mapa's sidebar is the likely second implementation; when it adopts them, they move.
+- **The calendar date picker** is rastrillo's `calendar.js`, which Fichas leaves out today (`vendoredIsMine`; `datetime.js` falls back to the browser's picker). The picker in the mock-ups (quick picks, a month grid, the zone named) is new work in `datetime.js`, with the browser's picker as the scriptless floor.
+
+---
+
+## 4. Views
+
+### 4.1 The View panel
+
+- **What it is:** Docs' inspector pattern, in `[estilo-float]` glass, 340px wide, 12px under the header and 12px in from the inline end.
+ - It is an `<aside>` labelled "View", not a modal. Focus moves into it when it is opened from the View button, and back to the button on Esc.
+ - Its open state is a per-person cookie (`POST /view/panel`), as the rail's is. It is closed by default.
+- **Sections, for a table:**
+ 1. **Layout:** Table, Board, Calendar, Cards, as a segmented control (radio buttons).
+ 2. **Filter** (§4.4), with a count: "7 of 10".
+ 3. **Sort** (§4.5).
+ 4. **Group** (§4.5).
+ 5. **Columns** (§4.6).
+- **For a board:** Layout, Filter, **Columns by** (a Choice, Person or Checkbox field), Show empty columns, and **Each card shows**.
+- **For a calendar:** Layout, Filter, **Date field**, and **Each card shows**.
+- **For cards:** Layout, Filter, Sort, and **Each card shows**.
+- **The foot:** when the state differs from the saved view, a "Changed" mark (a dot and the word), **Reset**, and **Save**. For a team view Save reads "Save for everyone". **Save as new…** opens the switcher's save form (§4.2).
+- **Every change applies at once with script.** The panel rewrites the URL (`history.replaceState`) and the work redraws from the server's HTML fragment. Nothing is written until Save.
+- **With scripts off, the panel is a GET form.** "Apply" submits it, and the server renders the same URL a script would have made. "Add a condition", "Then by…" and the column moves are submit buttons that redraw the form with one more row or a moved row. No GET writes anything (gate LU5).
+
+### 4.2 The view switcher
+
+In the header's lead slot: the current view's name, its scope ("Team", or a lock and "Only you"), and a chevron. It opens a menu:
+
+- **Find a view**, a filter over the list (with script).
+- **Team views**, each with its layout icon, in the team's order.
+- **Only you**, the person's own views, by name.
+- **Save what you see as a new view:** a name, and "Who sees it": *Everyone in <team>* ("A team view. Anyone can use it; changes are saved for everyone.") or *Only you* ("Your own view. Nobody else sees it, or that it exists."). Cancel and Save view.
+- **Manage views…**, a page (`/t/{type}/views`) to rename, reorder (Move up and Move down buttons), delete (its own confirm page), and see each team view's history with Restore (§4.8).
+
+With scripts off the switcher is a `<details>` menu of links, and Save as new is its own page.
+
+### 4.3 What a view is
+
+A saved view is one card type's:
+- name;
+- layout: table, board, calendar or cards;
+- filter: conditions, and whether all or any must match;
+- sorts, in order;
+- group, and for a date, its bucket;
+- columns: order, widths, hidden ones, and how many are frozen;
+- for a board, its field and whether empty columns show; for a calendar, its date field;
+- card face: which fields each card or board card shows.
+
+**Density is not part of a view.** It stays one reader's cookie (`fichas-density`), because it is about the reader's screen, not the records.
+
+**Each type always has at least one team view.** The migration that adds views (§10.1) makes "All <plural>" for each type from today's defaults: table, every column, no filter, newest first. It can be changed but not deleted.
+
+**Which view opens at `/t/{type}`:** the last one this person used for the type, from a cookie holding the view's opaque key, or else the first team view. A key that no longer resolves for this reader falls back without saying why.
+
+### 4.4 Filter on any field
+
+- **Every field and built-in can be filtered,** with operators that suit its kind (§6.3's table). Built-ins are Created, Edited, Created by, Edited by and Last call.
+- **One level: all or any.** The conditions are joined by "and" ("Match all") or by "or" ("Match any"), one switch for the view. "Is any of" covers most "or" within one field. Nested groups are out (§12; D3).
+- **At most 12 conditions** per view.
+- **Relative values** are kept as tokens and resolved when the list is drawn, in the team's zone (Europe/Dublin by default, 2026-11-13 ruling): today, tomorrow, yesterday, this week, last week, next week, this month, the next or last N days. **"Me"** is a token for the person reading, so a team view "Owner is me" shows each person their own.
+- **A condition on a field that no longer exists,** or on an option that was removed, is dropped when the view is drawn. The panel says "1 condition was left out: its field was removed".
+- **Search** (the Find box, `q`) still applies on top of the filter, over every value that shows as text (§6.4).
+
+The seal tiers do not limit any of this. The list runs on the in-memory index, which holds every live card unsealed (base §4.1). §10 says what the tiers still decide.
+
+### 4.5 Sort and group
+
+- **Sort by several fields,** each ascending or descending. Empty values sort last in either direction, as today (`TestSortingPutsEmptyValuesLast`). Ties fall back to the card's id, so a sort is stable.
+- **How each kind sorts** is in §6.3's table. Numbers and money compare exactly, as decimals (§6.2), never as floats.
+- **Group by** a Choice, Multi-select, Person, Checkbox, Link, or a date (by day, week, month or year), or Created, Edited or Created by.
+ - Groups follow the Choice's option order; other groups sort A–Z; "No <field>" comes last.
+ - A card with several values (multi-select, a link to several) appears **in each of its groups**. Group counts then add up to more than the total, and the foot says so: "7 customers, some in more than one group".
+ - A group heading is a `<details>` with its count. It collapses with no script.
+- **Paging stays 100 cards a page.** A group that crosses a page boundary repeats its heading, marked "continued".
+
+### 4.6 Columns
+
+- **Order:** the view holds the order of the columns it knows. A field added to the type later appears at the end, shown, as today's cookie rule does ("the cookie holds what is hidden, so a field added later appears").
+- **Hide and show:** an eye toggle per row. The title column cannot be hidden.
+- **Width:** in px, from 64 to 640. With script, drag a header edge; double-click it to fit the widest visible value. In the panel, a number. A column with no width takes its kind's default.
+- **Freeze:** a pin. Every column up to and including the pinned one is frozen (`position: sticky` at the inline start) while the table scrolls sideways. The title column is frozen by default.
+- **Reorder:** with script, drag a row in the panel or a header in the table. In the panel and without script, Move up and Move down buttons.
+- **Long text** can be a column, cut to one line. Today it is never one.
+- **The columns cookie retires** (`fichas-hide-<type>`). Paul is the only user and the data is not real, so nothing is carried over; columns now live in views (D5).
+
+### 4.7 Count only (Q5)
+
+- The foot of the table says how many cards are shown, of how many: "7 of 10 customers".
+- Each group heading shows its count.
+- A column's foot may show **a count**: filled, empty, or distinct values. It never shows a sum, an average, a minimum or a maximum. Base §2: *"Never a second calculator… if a number belongs to a Sheet, the card cites the cell."* A sum under a Value column is a calculation over a team's money that Fichas would then answer for.
+- **The trigger to revisit** is Paul ruling otherwise on Q5.
+
+### 4.8 Team and personal views (Q2)
+
+- **A team view** is the team's. **Anyone admitted may change, rename, reorder or delete it.**
+ - Each change is one event naming the person, with the before and after payload sealed (§9).
+ - The Save toast offers **Undo** for 10 seconds.
+ - **Manage views…** shows each team view's history ("Niamh changed the filter, 2 hours ago") with **Restore** inside the value window (base §5). Restore is a new change, logged, never a rewind.
+- **A personal view** is its owner's.
+ - Nobody else can list, open or learn that it exists. Another person asking for its key gets the app's ordinary 404, byte for byte the same as a key that never existed (gate LU8).
+ - Its events name its owner. The event log is plaintext, so the file (never the app) shows that a person has personal views and when they changed (§10.2).
+- **Saving a team view checks its revision.** If someone else saved it since this person loaded it, Save is refused: "Niamh changed this view a moment ago." The choices are **Save as new** and **Replace theirs**, which is an explicit second POST.
+- **Make a personal view a team view**, and back, from Manage views. Each is logged. Making a team view personal is refused while it is the type's only team view.
+- **Limits:** 50 team views per type, and 50 personal views per person per type.
+
+### 4.9 The URL (Q4)
+
+**Every state is a link.** Today the list's search, choice filters, sort and page are in the URL (`list.go`), and that stays the rule.
+
+```
+/t/{type}?v=<view key>&layout=board
+ &m=any&f0=<field key>&o0=any&x0=Lead&x0=Contacted
+ &s=<field key>&s=-<field key>&g=<field key>&gb=week
+ &cols=<key>:228,<key>:124&hide=<key>&frz=1
+ &bf=<field key>&cf=<field key>&month=2026-11
+ &q=<search>&card=<card id>&page=2
+```
+
+- **Keys are opaque** (`f_` and hex, `v_` and hex). Operators and layouts are this app's words. **Filter values and the search are the team's words, in the clear** (Q4), as `?q=` already is.
+- **A saved view's own URL is clean:** `/t/{type}?v=<key>`. Values appear only for unsaved changes. Saving moves them into the sealed payload and the URL drops them.
+- **The URL is canonical:** parameters in a fixed order, so the same state is always the same link (`listState.href` today). `parse(href(s)) = s` is a gate (LU7).
+- **Only known keys are read.** An unknown field key, an operator that does not suit the kind, or a value that is not an option is dropped, never honoured (today's rule for filters, `parseList`).
+- **A state longer than 4,000 bytes** is not drawn as a URL. The page says "This view is too long to keep in the address. Save it as a view to keep it."
+- **Where the values go:** the browser's history and address bar, and any link a person copies. Cross-origin requests carry only the origin (rastrillo's `Referrer-Policy: strict-origin-when-cross-origin`). The app's own log never records a query string (gate LU7). If CARLOS' edge logs query strings, it holds them too, as it holds `?q=` today. §10.2 lists this.
+
+### 4.10 The caption
+
+Expediente's sentence, as the caption over the table, the board and the calendar.
+
+- **The shape:** "<Plural> where <field> <operator> <values> and <field> <operator> <value>, <sort phrase>, grouped by <field>."
+ - Values join as "Lead, Contacted or Proposal" for "is any of", and "Pilot and Grant-funded" for "has all of".
+ - "Match any" joins conditions with "or".
+ - Sort phrases follow the kind: "soonest Next action first", "highest Value first", "A to Z by Name", "newest first".
+ - With no filter: "All 10 customers, newest first."
+- **Every field, operator and value is a link** to the same URL with the panel open at that control (`#panel-filter-0` and the panel cookie set by a POST on click with script, or the `panel=1` parameter without it). With script, clicking it opens the panel and focuses the control.
+- **It is built on the server** by one function, `describeView(state) []Span`, with golden tests for every operator and kind. Its copy goes through the copy-review skill.
+- **Past three conditions** the sentence wraps; it is never cut. The mock-up round named this as Expediente's weakness, and as a caption, not the control, it can afford to be long.
+- **On the phone** it sits under the switcher, as the mock-up shows.
+
+---
+
+## 5. Editing
+
+### 5.1 Click to edit (Q3)
+
+- **In the table,** every cell except the title is the editor for its field. Click it, or move to it and press Enter, or start typing.
+ - **The name opens the card** beside the list (§5.4). It is a link. Renaming happens on the card (D1).
+ - Text, long text, number, money, URL, email and phone edit in the cell, with an input of the right type and keyboard (`inputmode`).
+ - Choice, multi-select, person and link open a picker with search (§6.5).
+ - A date opens the date picker (§3.4).
+ - A checkbox ticks on click or Space.
+ - Files open the card at its files field.
+- **On the card,** every field is a quiet input, always editable, saved when it loses focus or when a picker closes.
+- **Each change saves at once.** There is no per-row Save.
+ - One field, one `POST /cards/{id}/fields/{key}`, one `updated` event, one new card revision.
+ - The header's lead slot says "Saving…", then "Saved".
+ - A toast says "Stage changed to Won. Undo", for 10 seconds.
+- **A refused value** (a bad email, a number that is not a number, an empty title) stays in the editor with the message beside it (`FormError`, today's wording). Nothing is written.
+- **Entries do not edit.** A call log is a fact about a past moment (base §3). Click to edit applies to cards only.
+
+### 5.2 Writes that do not cross
+
+**Each field write carries what the editor saw** (`was`), and the store compares it inside the transaction.
+
+- If the field still holds `was`, the write lands.
+- If it does not, it is refused with 409, and the editor says "Niamh changed this to Contacted a moment ago", with **Keep theirs** and **Use mine**. Use mine is a second POST with the new `was`.
+- Two people editing different fields of one card never collide.
+- This is why there is no whole-card save with script: a form that sends every field overwrites a teammate's change it never saw. The scriptless edit form (§5.7) sends `was` for every field it shows and changes only the fields that differ from it.
+
+### 5.3 Undo
+
+- **Undo reverses one event,** by a new event. `POST /cards/{id}/undo` with the event id.
+ - Each field the event changed goes back to its before value **only if it still holds the event's after value**. A field changed again since is left, and the toast says so: "Stage was changed again by Niamh, so it was left."
+ - The new event is `updated`, by the person, with `trigger_id` naming the undone event.
+ - Only the person who made a change can undo it from the toast. Anyone can restore an earlier value from the card's History (§5.5), as a new change.
+- **⌘Z and ⌘⇧Z** in the table and on the card undo and redo this tab's own changes, newest first, through the same route. Inside a text input, ⌘Z is the browser's own until the field is saved.
+- **With scripts off,** after the edit form saves, the card shows "Saved. Undo" with a one-button form.
+- **Undo needs the event's sealed payload,** so it works only inside the value window (base §5). A toast is far inside it.
+
+### 5.4 The card beside the list
+
+- **The name opens the card in a pane** beside the list: `?card=<id>` in the list's URL, so it is a link, bookmarkable, and works with scripts off.
+- **The list narrows** to a column of rows (title, status pill, one face field), with the view's name and count at its top and a back arrow that closes the card.
+- **The pane** shows the card's title, its type, "Edited by Niamh 2 days ago", "2 of 7 in Open pipeline", its fields in sections (§8.2, step 3), then the call log, notes, files, and **Linked here** (§6.6).
+- **J and K** move to the next and previous card in the list's order, when focus is not in an input. The pane's top has **Next** and **Previous** links, with `rel="next"` and `rel="prev"`, which the keys follow. So the keys work as links, and the links work with no script.
+- **Full page** opens `/cards/{id}`, as today. **Close** (✕ or Esc) returns to the list.
+- **The list keeps its scroll** and the open card's row is marked (`aria-current="true"`, a left rule, and its background).
+
+### 5.5 History on the card
+
+The mock-up's header has History. Base decision 2 ("versioned means we can see changes") has no screen today. This adds the smallest one.
+
+- **History**, in the card's header, opens a panel: each change, newest first, with who, when and which fields.
+- **Inside the value window** each change shows before and after, and **Restore this value** per field. Restore is a new change, checked as in §5.2.
+- **Past the window** a change shows only who, when and which fields. Base §5: the values are gone, so there is no restore.
+- With scripts off, History is a page, `/cards/{id}/history`.
+
+### 5.6 Rejilla's keyboard in the cells
+
+With script, the table is one tab stop: an ARIA `grid` with a roving `tabindex`.
+
+| Key | Does |
+|---|---|
+| Arrows | move the active cell |
+| Home, End | first and last cell in the row |
+| ⌘↑, ⌘↓ | first and last row |
+| Enter | edit the cell; in an editor, save and move down |
+| ⇧Enter | in an editor, save and move up |
+| Tab, ⇧Tab | in an editor, save and move right or left; otherwise leave the grid |
+| a printable key | edit, replacing the value with what is typed |
+| Esc | cancel the edit; again, leave the grid to the Find box |
+| Space | tick or untick a checkbox; open a picker |
+| Delete, Backspace | clear the value (with Undo) |
+| ⌘C | copy the cell's text |
+| ⌘V | paste text into the cell, parsed by its kind; a Choice must match an option |
+| O, or Enter on the name | open the card beside the list |
+| ⌘Z, ⌘⇧Z | undo, redo (§5.3) |
+
+- **Pasting a range of cells** is out (§12).
+- **A long-text editor** takes Enter as a new line, and ⌘Enter to save, as the call log does today.
+
+### 5.7 The scriptless floor
+
+**Every screen works with scripts off** (`AGENTS.md`). For editing:
+
+- **The table is a plain table.** The name links to the card. Every other cell is a link to the card's edit form with that field focused: `/cards/{id}/edit?field=<key>#<key>`. The 2026-11-12 stretched row link goes (D1).
+- **The edit form** is today's, with every new kind's input (§6.5). It sends `was` for each field and saves only what changed (§5.2). It returns to the list it came from, with "Saved. Undo".
+- **The card beside the list** is server-rendered. Its fields are a form with one Save button. Next and Previous are links.
+- **Pickers** are `<select>`s, checkboxes and radio buttons (§6.5).
+
+### 5.8 Phones
+
+- **The table becomes a list of rows**, as the mock-up shows: the title, the status pill, and the next two face fields.
+- **Tapping a value** opens a bottom sheet with that field's editor, Save at its foot, and the same Undo toast. Tapping the title opens the card as its own screen, with ‹ › for previous and next.
+- **The View panel** is a bottom sheet, a modal dialog with focus held inside it until it is closed.
+- **Inputs are at least 16px,** so iOS does not zoom (`TestNoZoomOnTap`). Touch targets are at least 44px.
+- **The board** scrolls sideways with scroll snap, one column at a time. **The calendar** is a list of days with cards for the month (an agenda), not a grid.
+
+---
+
+## 6. Field kinds
+
+### 6.1 The kinds
+
+| Kind | Today | New | Value, as sealed |
+|---|---|---|---|
+| Text | yes | — | the text |
+| Long text | yes | can be a column | the text, at most 20,000 characters (`maxLong`) |
+| Number | yes | a format (§6.2) | a canonical decimal string: `-1200.5` |
+| **Money** | — | new, a kind | integer minor units and nothing else: `4800000` for €48,000.00 |
+| Date | yes | optional end and time (§6.2, Q7) | `2026-11-20`, `2026-11-20T14:30+00:00`, or a start and end joined by `/` |
+| Choice | yes | a tone per option | the option's label |
+| **Multi-select** | — | new | a JSON array of option labels, in option order |
+| **Checkbox** | — | new | `1`, or no value |
+| **Person** | — | new | a JSON array of member ids |
+| Web address, Email, Phone | yes | — | as today |
+| **Link to…** | — | new (type designer slice D) | a JSON array of card ids |
+| **Files** | — | new (§7) | a JSON array of file public ids |
+
+**Built-ins, shown as columns and filterable:** Created and Edited (`cards.created_at`, `updated_at`), Created by (`cards.owner_id`), Edited by (the actor of the card's last event), and Last call (today's derived column).
+
+**A field's kind still never changes** once it exists (`UpdateField`, base §4). Kinds that only widen are settings, not kinds: a date gaining an end or a time, a person or link field going from one to several.
+
+### 6.2 Kind settings
+
+`field_defs.settings` is a small JSON object of **this app's words only** (§10.1). Each kind has a closed schema; anything else is refused at write, and a gate fuzzes it (LU2).
+
+- **Number:** `format`, one of `plain`, `grouped` (1,200), `decimals` with `places` 0–4, or `percent`.
+ - The format is display only. Values are exact decimals and compare as decimals (`math/big`), never as floats. Today's sort parses floats (`index.go`); that changes.
+ - A percent field stores what is shown: `50` is 50%.
+- **Money:** `currency`, an ISO 4217 code from a list (EUR first). Fixed at creation, because the stored unit depends on it. `AGENTS.md`: money is integer cents. A value with more decimal places than the currency allows is refused, never rounded.
+- **Date:** `end` (allowed or not) and `time` (allowed or not).
+ - Turning either on is always allowed. Turning one off is refused while any card uses it: "3 customers have an end date. Clear them first."
+ - A timed value is stored as an instant with its offset, entered and shown in the team's zone, with the zone named in the picker. A date-only value is a calendar date.
+ - An end is never before its start. Start and end are both dates, or both times.
+ - Sorting and filtering use the start. "Is on or overlaps" is the calendar's test.
+- **Choice and Multi-select:** options with tones live in `sealed_options` (they are the team's words). Renaming an option in the fields editor rewrites every card that holds it, in one transaction, one event per card, as `upgradeKind` does today. Removing an option leaves cards that hold it showing it, as today.
+- **Person:** `multiple` (true or false).
+- **Link to…:** `target` (the target type's opaque key) and `multiple`. The target never changes.
+- **Files:** `images_only` (true or false).
+
+### 6.3 What each kind can do
+
+| Kind | Filter | Sort | Group | Tier |
+|---|---|---|---|---|
+| Title (Name) | contains, is, is empty | A–Z | — | sealed + print |
+| Text | contains, is, is empty | A–Z | — | sealed (print only by the Advanced override) |
+| Long text | contains, is empty | — | — | sealed, never print |
+| Number | =, ≠, <, ≤, >, ≥, between, is empty | numeric | — | sealed |
+| Money | as Number | numeric | — | sealed |
+| Date | is, before, after, between, relative (§4.4), is empty | by start | day, week, month, year | sealed |
+| Choice | is, is any of, is none of, is empty | option order | yes | sealed, never print |
+| Multi-select | has any of, has all of, has none of, is empty | — | yes, one group per option | sealed, never print |
+| Checkbox | ticked, not ticked | ticked first | yes | sealed, never print |
+| Person | is, is any of, is me, is empty | by name | yes | sealed, never print |
+| Link to… | includes, is empty | by first linked title | yes, by linked card | sealed, never print |
+| Web address, Email, Phone | contains, is, is empty | A–Z | — | sealed + print |
+| Files | has files, has none | — | — | file names sealed; rows §7.3 |
+| Created, Edited | as Date | yes | as Date | plaintext (structural, base §4.2) |
+| Created by, Edited by | is, is any of, is me | by name | yes | plaintext member id (structural) |
+| Last call | before, after, never | yes | — | derived from entries |
+
+- **"—" is a product choice, not a seal limit:** grouping by a free-text value is possible, and useless.
+- **The print tier is only where base §4.1 allows:** high-cardinality values. Choice, Multi-select, Checkbox, Person and Link never print, because a few equality classes give the values away, and a link print would publish who links to whom (type designer §3).
+- **No user field is ever plaintext** (base §4.3). The plaintext rows are the ones the app ships.
+
+### 6.4 Search
+
+The Find box matches every value that **shows as text**: option labels, person names, linked cards' titles, file names, and money and dates as they are shown. It never reads a file's contents.
+
+### 6.5 Inputs and pickers
+
+| Kind | With script | Without script |
+|---|---|---|
+| Choice | a listbox with search and tones | `<select>` |
+| Multi-select | a listbox of checkable options with search | a checkbox per option |
+| Person | a listbox of the team's people, with search; "Me" first | `<select>` (multiple when the field holds several) |
+| Link to… | a search-as-you-type listbox of the target type's cards by title, then "New <target>" | a `<select>` up to 200 cards; past 200, a "Search and pick" page (`/cards/{id}/fields/{key}/pick?q=`) |
+| Date | the date picker (§3.4); a time input when the field allows times; an end when it allows ends | `<input type="date">`, `type="time"`, a second pair for the end |
+| Checkbox | a checkbox | a checkbox |
+| Money | a text input with the currency's symbol beside it | the same |
+| Files | §7.4 | a file input |
+
+- **A Link picker's "New <target>"** creates the target card with only its title, and links it, in one transaction with two events.
+- **The people a Person field offers** are the admission list: `FICHAS_OWNERS` in the lone shape, and the home's roster once Fichas runs in team mode. Picking one finds or creates that member's row, in the same transaction as the write.
+ - A person is shown by their roster name where there is one. Until then (the lone shape has no names), by their address, with the part before `@` in cells and the whole address in the title attribute and the picker.
+ - A member who has left the admission list stays on the cards that name them, marked "no longer in the team" in the picker, and cannot be newly chosen.
+
+### 6.6 Links between cards
+
+Type designer §3, unchanged except as stated:
+- **The value** is the target card ids, sealed, never printed.
+- **The index** resolves each id to the target's title and builds backlinks from the event feed.
+- **On the card:** each link is a chip to the target. The target shows **Linked here**: "3 products link to this customer", listed by title, grouped by type and field.
+- **A deleted target** is soft-deleted, as every card is. The link stays and shows "deleted card". Nothing cascades.
+- **A link never leaves this instance.** A reference to another app's item is a `ref` (base §3, §9) and keeps every reach rule: it resolves at render, per asker, and an unresolvable one renders nothing, never a count.
+- **Base §9's "Linked here" counts** are safe for links: every admitted person reads every card (base §6.1), so a count discloses nothing a member cannot open.
+
+### 6.7 What the suite contract sees
+
+S3 (base §6.4) renders each new kind as text: money with its currency ("€48,000.00"), dates with their end and time, a checkbox as "Yes" (and an empty one as nothing), multi-select labels joined by ", ", people by name or address, links by the targets' titles, and files by name. No bytes, no file id and no member id reach a sibling.
+
+A linked card's title changing does not move the linking card's revision, so memoria's copy keeps the old title until the linking card next changes. It is base §10's field-rename item again, and it stays open there.
+
+---
+
+## 7. Files and images (Q6)
+
+Mapa images' decisions, reused for Fichas files. Where Mapa's spec decides, this section cites it; where Fichas differs, it says why.
+
+### 7.1 Decisions
+
+| # | Decision | From Mapa images |
+|---|---|---|
+| F1 | **Bytes are sealed in Fichas, under Fichas' DEK, before they leave the process.** New seal purposes `file`, `file.record` and `file.thumb`. Plaintext is padded to the next 64 KiB before sealing. Stored as `application/octet-stream` | decision 1 |
+| F2 | **Readers get files only through Fichas**, at `GET /files/{id}` and `/files/{id}/thumb`. Never presigned, never public | decision 2 |
+| F3 | **The object key is the SHA-256 of the ciphertext.** Every seal draws a fresh nonce. The bytes read are checked against the key before opening | decision 3 |
+| F4 | **Development and tests use `blobs.Dir`.** Production with no store boots, and upload answers 503: "Files aren't set up on this Fichas yet". A partial store boots too, with a loud log | decision 4 |
+| F5 | **Any file type may be stored, up to 25 MiB.** Only PNG, JPEG, GIF and WebP are shown inline, and only after Mapa's metadata walker. Everything else downloads as an attachment | Mapa takes images only, at 10 MiB. Fichas holds proposals, contracts and floor plans (the mock-up), so it takes files; 25 MiB is Q6's figure |
+| F6 | **Thumbnails are made in the app**, sealed, and stored as their own objects | Mapa makes no display copies (its §9). A card's file list needs previews, and a bucket service cannot read ciphertext |
+
+### 7.2 Safety
+
+- **Types are decided from the bytes**, never from the name or the claimed type.
+- **Inline images** follow Mapa images §5 exactly: the format allowlist, `DecodeConfig` limits (10,000 px a side, 50 MP), and the metadata walker. SVG is never inline; it downloads.
+- **The walker is shared, never copied.** Whichever of Mapa and Fichas builds first puts the sniffing and the walker in rastrillo (`rastrillo/imagesafe`), and the other adopts it. Two copies would drift, and the second would miss the next fix.
+- **Other files are stored as uploaded.** A PDF's author, or a document's tracked changes, stay in it. Help says so.
+- **Serving:** `nosniff`, `default-src 'none'; sandbox`, `Cross-Origin-Resource-Policy: same-origin`, `Cache-Control: private, max-age=3600, immutable`, `ETag` from the public id (Mapa images §1.4).
+ - An allowlisted image is `inline`, with its sniffed type.
+ - Anything else is `attachment`, with `application/octet-stream` and the sealed file name in an RFC 5987 `filename*`.
+- **Thumbnails:** made only for inline images up to 4,096 px on the long side, decoded once in pure Go (`image/*` and `golang.org/x/image/webp`), scaled to 320 px on the long side, and encoded as JPEG or, for images with transparency, PNG.
+ - A decode semaphore admits **one** decode at a time. A 4,096 × 4,096 PNG is about 64 MiB unpacked. The figure is measured on the instance at build time and recorded in the build notes.
+ - With script, a JPEG over 4,096 px is scaled to 4,096 px in the browser before upload, as Mapa does. So phone photos get previews.
+ - Larger images, and every other file, show a type icon.
+- **The blob semaphore** (Mapa images §1.4) covers every upload, serve and thumbnail. It admits two at a time at 25 MiB (a body, its sealed copy and its opened copy, about 75 MiB each). Waiters queue; a wait past 10 s answers 503 with `Retry-After`.
+
+### 7.3 The `files` table
+
+| Column | Plaintext? | Why |
+|---|---|---|
+| `id` | yes | the row's key |
+| `public_id` | yes | the URL's id: random base 36, never sequential |
+| `card_id`, `field_def_id` | yes | where it is; structural (base §4.1 case 2). Scope is "the card is not gone" |
+| `owner_id` | yes | who uploaded it. Member id, provenance, as `cards.owner_id` |
+| `created_at` | yes | ordering and retention |
+| `detached_at` (nullable) | yes | when it was taken off the card. Retention runs over it |
+| `stored_bytes` | yes | the ciphertext's size, padded to 64 KiB, for the quota |
+| `object_key`, `thumb_key` | yes | bucket keys: hashes of ciphertext |
+| `sealed_record` | sealed | the file name, the sniffed type, the true size, and an image's width and height |
+
+`file_trash (object_key, queued_at)` is the delete queue, as Mapa's `image_trash`.
+
+### 7.4 Getting files in, and out
+
+- **On the card:** "Add a file, or drop one here". With script: pick, drop or paste, several at once, each with a `<progress>`. Without: a file input and **Upload** on the card's edit form.
+- **In the table:** a Files cell shows a count and the first thumbnail. Clicking it opens the card at its files.
+- **Upload** is `POST /cards/{id}/fields/{key}/files`, multipart, bounded by `http.MaxBytesReader` at 25 MiB plus the form.
+ - The bytes are checked, stripped (images), sealed and stored **before** the transaction.
+ - The transaction writes the file row, adds its id to the field's value, bumps the card's revision, and logs `updated` on the card with `file_added` in its payload.
+ - If the transaction fails, the object is deleted, and queued in `file_trash` if that fails too.
+- **Taking a file off a card** is a field edit (§5.1): the value loses its id, `detached_at` is stamped, the event is logged, and Undo puts it back.
+- **Removing a file now,** for one that should never have been uploaded: **Remove from Fichas** on its own confirm page (`GET` and `POST /files/{id}/remove`). One write deletes the row, queues the object, and logs `removed` on the file. The bytes go straight after.
+- **A deleted card's files** answer 404 while it is deleted. Cards are never hard-deleted today (`TestACardCannotBeHardDeleted`), so they are kept with it.
+
+### 7.5 Retention, quota and the store
+
+- **A detached file is kept for the value window** (base §5), so Undo and History can bring it back. Past the window the sweep deletes it.
+- **The value window is not built yet.** Until it is, detached files are kept, and only Remove from Fichas deletes bytes. Q11 proposes the window.
+- **The sweep** runs at wake, picks candidates by SQL alone, and empties `file_trash` off the boot path (Mapa images §3.3). It never fails boot.
+- **Quota:** one team total, `FICHAS_FILE_QUOTA`, default 10 GiB. Fichas has no private content (base §6.1), so a team-wide total counts nothing hidden. Upload is refused past it: "Fichas holds 10 GiB of files. Remove some, or ask whoever runs your team's Oficina."
+- **CARLOS:** Fichas has no store today. The setup is Mapa images §8's, with `--app fichas`: read the plan first, refuse a plan that forces scanning onto ciphertext, `store create`, check `scan status`, restart, `curl /api/version`. Paul runs it, or the agent with his say-so, after Phase 6 is deployed. Until then upload answers 503 (F4).
+
+---
+
+## 8. The type designer
+
+Draft 2 on `origin/design/type-designer` is the design. This section records what this spec changes in it, and nothing else.
+
+### 8.1 Folders and icons (slice A)
+
+As draft 2 §1: `type_groups`, `card_types.group_id` and `card_types.icon` (a slug from a curated list of about 40), the rail of §3.2, and `/groups` to rename, reorder and delete, each change logged.
+
+### 8.2 The steps (slices B and C)
+
+As draft 2 §2, at its URLs, every step a server-rendered page with its own URL, scriptless, held in a sealed `type_drafts` payload.
+
+1. **Start:** Describe it (when the assistant is configured), a template, or blank.
+2. **Name and look:** singular and plural, icon, folder, a one-line description.
+3. **Fields:** one editable list. Each row: label, kind, required, help text, and the kind's settings (§6.2). Sections between rows. Add, Remove, Move up and Move down are submit buttons.
+4. **Status and card:** the status field, the card face, and the default sort, which becomes the type's first team view (§4.3).
+5. **Review and create:** one transaction, every row logged.
+
+**Changes from draft 2:**
+- **The kinds list** is §6.1's: Text, Long text, Number, Money, Date, Choice, Multi-select, Checkbox, Person, Email, Phone, Web address, Link to…, Files.
+- **The preview panel** in the mock-up ("What this makes") is the `[estilo-float]` panel, showing a sample row, the other types the draft also makes, and its fields.
+- **Step 4's default sort** makes the type's "All <plural>" team view, rather than a setting on the type.
+- **Step 3 on a live type** (draft 2's "Afterwards") is the same editor. Kinds still never change.
+
+### 8.3 Templates (R4)
+
+| Template | Fields |
+|---|---|
+| **People** | Name (title, print), Email (print), Phone (print), Role (text), Notes (long text) |
+| **Organisations** | Name (title, print), Web address (print), Email (print), Phone (print), Stage (Choice), Next action (Date), Notes (long text), **People** (Link to People, several). Made together with People |
+| **Projects** | Name (title, print), Status (Choice: Idea, Planned, Active, Done, Dropped), Owner (Person), Start (Date), Due (Date), Notes |
+| **Products** | Name (title, print), Status (Choice: Idea, Designing, Building, Launched, Retired), Category (Choice), Price (Money, EUR), Launch date (Date), Notes |
+| **Applications** | Applicant (title, print), Email (print), Programme (Choice), Status (Choice: Received, Reviewing, Shortlisted, Accepted, Declined), Received (Date), Files (Files), Notes |
+
+Every field takes its kind's default tier (`DefaultTier`). No template field is plaintext.
+
+### 8.4 Customer gains Contacts (R5)
+
+- **A seeded People type** (`t_person`), with the People template's fields and tiers. Seeded types enter the catalogue only with a per-field tier review (base §4.4); the review is the table above.
+- **Customer gains Contacts** (`f_contacts`), a Link to People, several. Seed adds a missing field, as it does today; it refuses to boot on a changed kind or tier, as today.
+- Today's Customer has Email and Phone of its own. They stay. Moving them onto People is a choice for Paul once Contacts is in use.
+
+### 8.5 Describe it (slice E, R3, R6)
+
+As draft 2 §4: DeepSeek V4 Flash on TensorX through Slides' client, the sentence and the team's type and field labels sent, **never card values**, the answer validated as untrusted input and only ever a draft, nothing made until Create, a 20 s timeout, a rate limit, one log line with no sentence and no answer.
+
+- **The key is Fichas' own:** `FICHAS_TENSORX_API_KEY` (R6), from 1Password (Tito account, Oficina vault, "Fichas TensorX Key"). Paul runs the `carlos secrets set` himself, because `op` is not signed in from the agent's session. Unset, the Describe card is not offered.
+- **What it may draft** is §6.1's kinds and settings, so a draft can hold a Link between two new types, a Person, money, and dates with ends.
+
+---
+
+## 9. Events
+
+**Every write lands an event in the same transaction** (base §5; the index's change feed depends on it, `index.go`). This is the full list of writes this level-up adds.
+
+| Write | object_kind | kind | ChangedFields | Payload (sealed) |
+|---|---|---|---|---|
+| A field edit (cell, card, board move, calendar move) | `card` | `updated` | the field | before and after |
+| Undo, Restore this value | `card` | `updated`, `trigger_id` = the undone event | the fields | before and after |
+| New target from a link picker | `card` | `created`, then `updated` on the linking card | — / the field | values |
+| File added, taken off | `card` | `updated` | the field | before and after ids, and `file_added` or `file_detached` |
+| File removed now | `file` | `removed` | — | the file's name |
+| Option renamed (rewrites cards) | `field` `updated`, then `card` `updated` per card | | the field | before and after |
+| View created, changed, renamed, reordered, moved between scopes, deleted, restored | `view` | `created`, `updated`, `deleted` | — | before and after payload |
+| Folder created, renamed, reordered, deleted; a type moved | `group`, `type` | `created`, `updated`, `deleted` | — | before and after |
+| Type and fields created by the designer | `type`, `field` | `created` | — | as today |
+| Type settings (icon, description, status field, sections) | `type` | `updated` | — | before and after |
+| Field settings and help | `field` | `updated` | — | before and after |
+| A draft made by the assistant | `type` | `drafted` | — | none; the actor and that it happened |
+
+- **The suite feed** (S1) is unchanged: it reads `object_kind = card` events only. New object kinds are not items.
+- **Named exemptions**, as Mapa names retention:
+ - **Type drafts** (save, discard, expiry) log nothing. A draft is one person's scratch work and nothing exists until Create. Create logs every row it makes.
+ - **The sweep** (detached files past the window, `file_trash`, expired drafts) logs nothing. It removes only what nobody can still reach, and an event would have to name Fichas as the actor.
+ - **Preference cookies** (density, panel, rail, folder state, last view) write no row.
+- **Every event names its real actor** (ruling 9). An edit is the person's. Nothing here is written by Fichas as itself.
+
+---
+
+## 10. The seal boundary
+
+### 10.1 New columns
+
+| Table | Plaintext columns | Sealed columns | Case (base §4.1) |
+|---|---|---|---|
+| `type_groups` | `id`, `key`, `ordinal`, times | `sealed_label` | 2, 4 |
+| `card_types` (new columns) | `group_id`, `icon`, `status_key` | `sealed_description`, `sealed_sections` | 2, 4 |
+| `field_defs` (new columns) | `settings`, `required` | `sealed_help` (and options gain tones inside `sealed_options`) | 4 |
+| `views` | `id`, `key`, `card_type_id`, `scope`, `owner_id` (personal only), `ordinal`, `revision`, `gone`, times | `sealed_payload` (purpose `view.payload`) | 2, 4 |
+| `type_drafts` | `id`, `member_id`, times | `sealed_payload` (purpose `draft.payload`) | 2 |
+| `files` | §7.3 | `sealed_record` | 2 |
+| `file_trash` | `object_key`, `queued_at` | — | 2 |
+
+- **`field_defs.settings` is this app's words only:** format names, ISO currency codes, booleans, place counts and an opaque target type key. A closed schema per kind refuses anything else at write, so a team's words cannot reach it (LU2). It says, without the key, that a field is money in euros, or that one type links to another.
+- **A view's name, filters, values, sorts and columns are all in its sealed payload.** Only its type, scope, owner and order are plaintext, as type drafts are.
+- **Every new value kind is sealed in `card_values`** under `field.value`, as today. Person and Link values are member and card ids **inside the seal**, never plaintext foreign keys, so the file does not show who is assigned what or which cards link.
+- **`TestNoPlaintextColumnEscapesTheAllowlist`** names every new plaintext column with its case. The file gate's canaries grow (LU1).
+
+### 10.2 What the durable file shows that it did not
+
+To be added to the leak list in the README:
+- the number of saved views per type, which are personal, whose they are, and when each changed;
+- the number of folders and which types are in each; each type's icon;
+- each field's settings: that a field is money and in which currency, that a date takes times or ends, that a link points at a given type, that a person or link field holds several;
+- the number of files on each card and in each field, who uploaded each, when, when it was taken off, and its size to within 64 KiB;
+- that a person has drafts in progress, and when.
+
+**Outside the file:**
+- **Filter values and searches in URLs** (Q4): in the browser's history and address bar, in links people share, and in CARLOS' edge logs if they record query strings. Never in the app's own log.
+- **TensorX** receives the sentence and the type and field labels for each Describe it call (R6, draft 2 §4). TensorX is zero data retention and treated as local (2026-09-19).
+- **CARLOS' bucket** holds padded ciphertext and its sizes (§7).
+
+### 10.3 The in-memory index
+
+- **It holds every new kind unsealed,** as it holds today's: options, people's display names, linked titles and backlinks, and file records (never bytes).
+- **It is still fed only by the event log.** Every write above logs, so the index never needs telling.
+- **Saved views are not in the index.** A list request reads and unseals the one view it draws, and the switcher's list of names.
+- **The cost:** base §4.2's trigger stands. At today's measure (5,000 customers and 10,000 calls: 225 ms cold, 0.37 ms a search), adding backlinks and person names is small. LU12 measures a filtered, sorted, grouped query at 5,000 cards and fails past 20 ms warm.
+
+---
+
+## 11. What the Notion import needs (Q9)
+
+The importer's §17 sketches phase 2. This level-up gives it each thing it asks for. The mapping in that sketch is revised as follows, and the importer spec takes this table when it writes phase 2.
+
+| Notion property | Fichas | Changed from the sketch |
+|---|---|---|
+| `title` | the title field | — |
+| `rich_text` | Text, or Long text over one line | — |
+| `number` | Number with Notion's format; a currency format becomes **Money** in that currency | the sketch left format open |
+| `select` | Choice, colours as tones | — |
+| `status` | Choice, marked as the type's status | — |
+| `multi_select` | **Multi-select** | was Text |
+| `date` | Date, with end and time turned on for the field when any row uses them | the sketch left ranges and times open |
+| `checkbox` | **Checkbox** | was a Yes / No Choice |
+| `url`, `email`, `phone_number` | Web address, Email, Phone | — |
+| `people` | **Person**, each Notion user mapped to a team member by the importer on the import page; an unmapped user goes into a companion Text field, "<field> (from Notion)" | was a Link to People by name |
+| `relation` | Link to… the type the related database became | — |
+| `files` | **Files**, downloaded through the importer's file transport and stored by `AddFile` (below); external files stay as links in a Text field | was not imported |
+| `formula`, `rollup` | **The last value, as plain data**, in a field of the value's kind, with help text "From Notion: a formula, not kept up to date" | — |
+| `created_time`, `created_by`, `last_edited_time`, `last_edited_by` | the import's event payload, sealed: Notion's times and names kept as history, as Mapa's import does | — |
+| `unique_id` | Text, print, so Notion's numbers survive | — |
+| `button`, `verification`, `place` | not imported; `place` as Text | — |
+
+**A row's page body goes into the card's Notes** (Q9), a Long text field the importer adds when the type has none.
+- Long text shows paragraphs and line breaks only. The importer's Fichas mapper writes headings as their own lines, list items as "• " lines, to-dos as "☐ " or "☑ ", and links as "text (address)".
+- A body over 20,000 characters is cut at a paragraph and counted in the run report. Nothing is dropped silently (importer D10).
+
+**The store functions the importer calls,** never the HTTP routes, each by the importing person as actor:
+- `CreateModel(ctx, actor, Model)`: the designer's Create (§8.2 step 5) from a model, the same structure Describe it and templates produce.
+- `CreateCard`, as today, and `SetField(ctx, actor, cardID, key, value, was)`, §5.2's write.
+- `AddFile(ctx, actor, cardID, key, name string, data io.Reader) (File, error)`: §7.4's upload, waiting on the blob semaphore rather than failing. Typed refusals: `ErrFileTooLarge`, `ErrFileQuota`, `ErrNoFileStore`.
+- **Relations are written in a second pass,** after every card exists, as `SetField` on each link field.
+
+**Views:** a Notion view becomes a Fichas team view where each of its filters and sorts maps onto §6.3's operators. One that does not map is listed in the report, not approximated (importer §17).
+
+**Out, and the importer says so:** formulas and rollups as live values, Notion's status groups, page icons and covers.
+
+---
+
+## 12. Out of scope
+
+| Thing | Why, and the trigger to revisit |
+|---|---|
+| **Formulas and rollups** | Base §2: never a second calculator. A formula engine is also a query engine over sealed values. Imported formulas keep their last value as data. Trigger: Paul rules otherwise |
+| Sums, averages, minimums and maximums under a column | Q5. Trigger: Paul rules otherwise on Q5 |
+| Nested "or" groups in a filter | One all-or-any switch covers the cases seen. Trigger: a view that needs "(A and B) or C" |
+| Manual order of cards on a board, or a list | Needs a rank stored per card. Trigger: someone asks to drag a card above another |
+| Pasting a range of cells; fill down | Bulk entry is Sheets' job (base decision 1). Trigger: an import or bulk fix that a person does by hand |
+| Search across every type | Today's search is per type. Trigger: more than a handful of types in use |
+| Automations, buttons, conditional colours, charts | Not asked for |
+| Sharing a view outside the team | Suite ruling 2: never cross-team |
+| Week and day calendar views; a calendar across types | Month and agenda cover a CRM. Trigger: a type with timed dates in daily use |
+| Server display copies beyond one thumbnail | Trigger: card pages with many photos feel slow on a phone |
+| Previews of PDFs and documents | Trigger: people open files only to see what they are |
+| Comments on cards | Not asked for |
+| Editing entries | Base §11: never. A correction is a new entry |
+
+---
+
+## 13. Open questions for Paul
+
+Each answer below is the author's proposal. The design is built on it, and none is a ruling until Paul says so.
+
+1. **Q1, the direction.** *Proposed, awaiting Paul:* Escritorio, with Expediente's sentence as the caption over the table and Rejilla's keyboard in the cells. (The direction is Paul's ruling of 2026-11-17; the two borrowings are the proposal.)
+2. **Q2, team views.** *Proposed, awaiting Paul:* anyone in the team may change a team view. Each change is logged and can be undone. Personal views belong to their owner, and nobody else sees that they exist.
+3. **Q3, saving.** *Proposed, awaiting Paul:* each edit saves at once, is logged, and gets Undo in a toast. There is no per-row Save.
+4. **Q4, filter values in the URL.** *Proposed, awaiting Paul:* filter values sit in the URL in the clear, as search already does, so views can be bookmarked. Saved views are stored sealed, and their URL holds only a key.
+5. **Q5, column totals.** *Proposed, awaiting Paul:* count only. A sum would break "never a second calculator".
+6. **Q6, files and images.** *Proposed, awaiting Paul:* sealed before upload, thumbnails made in the app, 25 MiB per file. *Note:* the brief said "the same as Mapa", but Mapa's images spec (revision 2) sets **10 MiB per image**. This spec takes 25 MiB for any file, because Fichas holds documents as well as pictures, and holds inline images to Mapa's other limits (formats, 50 MP, 10,000 px).
+7. **Q7, dates.** *Proposed, awaiting Paul:* a date may have an end date and a time, each turned on per field.
+8. **Q8, the calendar.** *Proposed, awaiting Paul:* the calendar view is in this level-up.
+9. **Q9, Notion page bodies.** *Proposed, awaiting Paul:* a Notion row's page body imports into the card's Notes.
+10. **Q10, a click on a row.** On 2026-11-12 Paul ruled that "inline grid editing, if it comes, is a separate mode, so a row click always opens the card". Escritorio's table edits a cell on click. *Proposed, awaiting Paul:* no separate mode. **The name opens the card**; every other cell edits in place (D1).
+11. **Q11, the value window.** Undo past the toast, Restore in History, and keeping detached files all live inside base §5's bounded window, which has no length and is not built. *Proposed, awaiting Paul:* 90 days, as Mapa's history, built in Phase 1 with the History panel.
+12. **Q12, money as its own kind.** *Proposed, awaiting Paul:* "Money" is a kind, with its currency fixed when the field is made, stored as integer cents (`AGENTS.md`). A Notion currency number becomes Money.
+
+---
+
+## 14. Phasing
+
+**Phase 0:** this spec, reviewed by Fable until no High finding is left. Then Paul's answers to §13. Then stop.
+
+Each phase after that is its own branch from `main`, with mock-ups checked against the round's (Paul, 2026-09-29: "mockups before implementing"), `make ci` and `make browser` green at every commit, a Fable review, and then a merge and a deploy, so Paul uses each phase while the next is built. Deploys follow the Fichas rule: `git fetch`, check `carlos releases` for a newer live build, `carlos restart` after deploy, and poll `/api/version`.
+
+**Phase 1: edit in place.** The first thing Paul can use.
+1. The stacked header, the menus and the lead slot's save state (§3.1). The rail's fold (§3.2).
+2. `SetField`: one field, compare-and-set on `was`, one event (§5.2). `POST /cards/{id}/fields/{key}`, JSON with script, redirect without.
+3. Click to edit in the table and on the card, for today's kinds (§5.1). The scriptless cell links and the edit form's `was` (§5.7).
+4. Undo: the toast, ⌘Z and ⌘⇧Z, the scriptless "Saved. Undo" (§5.3).
+5. Rejilla's keys (§5.6).
+6. The card beside the list, J and K, Next and Previous links (§5.4).
+7. History on the card (§5.5), and the value window's length (Q11) with its sweep of event payloads.
+8. Phones: the list of rows and the edit sheet (§5.8).
+9. Gates LU3, LU4, LU5, LU9 and LU10 for this phase.
+
+**Phase 2: saved views.**
+1. `[estilo-float]` in estilo, if it has not landed (§3.4).
+2. The `views` table and its migration, "All <plural>" for each type, the columns cookie retired (§4.3, §4.6).
+3. The URL grammar, `parse` and `href`, and the length cap (§4.9).
+4. The View panel for the table and the cards layouts: filter on any field with §6.3's operators, sort by several, group, columns with order, width, hide and freeze (§4.1, §4.4–4.6).
+5. The caption (§4.10).
+6. The switcher, Save, Save as new, Reset, team and personal scope, the revision check, Manage views, view history and Restore (§4.2, §4.8).
+7. Count only (§4.7).
+8. Gates LU6, LU7, LU8 and LU12.
+
+**Phase 3: board and calendar.** Both work on today's kinds: a board by a Choice, a calendar by a Date.
+1. The board: columns by a Choice, Person or Checkbox, a card's move as a field edit with Undo, "Move to…" without script, New in a column, empty columns, the phone's snap scroll.
+2. The calendar: a month by a Date field, weeks from Monday in the team's zone, "Cards with no date", a drag as a field edit, the phone's agenda.
+
+**Phase 4: folders and the stepped designer** (draft 2's slices A, B and C, with §8.2's changes). Folders and icons; drafts; steps 1, 2, 3 and 5 with templates and blank; step 4; the step 3 editor on live types.
+
+**Phase 5: the new kinds.**
+1. Number formats with exact decimals, and Money (§6.2, Q12).
+2. Date ends and times (§6.2).
+3. Checkbox, Multi-select and Person (§6.5).
+4. Link to…, backlinks, Linked here, the picker and its search page (§6.6; draft 2's slice D).
+5. The People type and Customer's Contacts (§8.4).
+6. Each kind's filter, sort and group (§6.3), S3's text (§6.7), and the designer's kinds list.
+7. Gates LU2, LU14 and LU16.
+
+**Phase 6: files and images** (§7). The shared walker in rastrillo, if Mapa has not built it; the `files` table, upload, serve, thumbnails, remove, retention, quota; then the CARLOS store steps of §7.5 with Paul. Gate LU13.
+
+**Phase 7: describe it** (§8.5, draft 2's slice E). After Paul sets `FICHAS_TENSORX_API_KEY`. Gate LU15.
+
+**Then the Notion import's phase 2** may start: it needs Phases 4, 5 and 6, and §11's store functions.
+
+---
+
+## 15. Gates
+
+**Every existing gate keeps passing,** unchanged: the file gate (`TestPlaintextNeverReachesTheDatabase`), the allowlist, the index's event feed, the store's revision chain, the suite conformance test and its pinned twelve failures, the markup gates, and `make browser`'s walk. The new gates are LU1–LU16. They run in `make ci` unless marked "browser". Each guard is mutation-tested, with the mutation and date in the test's comment, as Fichas' gates are today.
+
+- **LU1, the file gate grows.** New canaries, written through the real store and routes: a view name, a filter value, a search saved in a view, a folder name, a type description, a section name, help text, an option tone's option, a multi-select option, a person's address, a linked card's title, a file name, a canary inside a file's bytes and inside its EXIF, a draft's sentence, and money and date values. None may appear in the database, its WAL, or the blob directory. No blob starts with a PNG or JPEG magic number.
+- **LU2, the allowlist and settings.** Every new plaintext column is named with its case. `field_defs.settings` refuses any key or value outside its kind's closed schema; a fuzz test writes random strings through every settings path and none reaches the column.
+- **LU3, events.** Every write in §9 logs in the same transaction, and a write whose event fails does not land (`TestAChangeThatCannotBeLoggedDoesNotLand`, extended). One mutant per new write path drops its event and must be caught. The named exemptions are tested as exemptions.
+- **LU4, writes that do not cross, and Undo.** A stale `was` is refused with 409 and writes nothing. Two people editing two fields of one card both land. Undo restores only fields that still hold the event's after value, names the ones it left, and logs with `trigger_id`. Only the change's author can undo from the toast.
+- **LU5, a GET writes nothing.** A logical dump of every table is unchanged across every list layout, every panel state, the caption's links, the card beside the list, History, Manage views, the designer's GET steps, and file serving (200 and 304).
+- **LU6, the query engine.** For each kind and operator, a property test compares the index's answer with a naive reference over random cards: filters, all and any, relative dates in the team's zone, "me", sorts with empty values last and stable ties, exact decimal and money order, groups with multi-valued cards in each group. Dates with times compare as instants; date-only values as dates.
+- **LU7, the URL.** `parse(href(s)) = s` over random states. Unknown keys, unsuited operators and non-options are dropped. A state past 4,000 bytes is refused with the sentence. **The app's log never contains a query string:** a test captures the log over a filtered list request and greps for the filter value.
+- **LU8, view scope.** Ana's personal view is invisible to Bo: the switcher's HTML, Manage views, `/t/{type}?v=<Ana's key>` (the same status, headers and body as a key that never existed), and the save routes. A team view changed by Bo is logged with Bo as actor, and Restore brings back the previous payload. A stale save is refused. The type's last team view cannot be deleted or made personal.
+- **LU9, the scriptless floor (browser).** With scripts off, with no console error: edit a cell through the edit form and Undo it; open a card beside the list and follow Next; change the filter, sort, group and columns through the panel's form and save a view; switch views; move a board card with "Move to…"; page the calendar; walk the designer's steps; upload a file and remove it through its confirm page.
+- **LU10, keyboard and accessibility (browser).** A keyboard-only walk: the grid's keys of §5.6, the pickers, the panel opened and closed with focus returned, J and K, Undo with ⌘Z, the board's Move to, the calendar's days. A polite live region announces "Saved", the Undo, and refusals. axe-core finds nothing serious on the table, the panel, the card, the board, the calendar, the designer and the phone sheets.
+- **LU11, phones (browser, 390 px).** The list of rows, the edit sheet, the panel as a modal sheet that holds focus, the card's own screen with ‹ ›, the board's snap, the agenda; no zoom on tap; touch targets at least 44 px.
+- **LU12, speed.** At 5,000 cards and 10,000 entries: a query with three filters, two sorts and a group answers in under 20 ms warm; the cold load stays within 10% of today's 225 ms plus what backlinks cost, recorded in the build notes.
+- **LU13, files.** Mapa images' IMG2, IMG5 and IMG6, for Fichas: padding and the hash check, metadata stripped from inline images with the pixels unchanged, the format refusals, headers (`inline` only for allowlisted images, `attachment` otherwise), 25 MiB and the quota refused, 503 with no store, the semaphores' bounds, thumbnails only within 4,096 px, a failed transaction deleting its object, `file_trash` emptied off the boot path.
+- **LU14, the suite contract.** S3's text for every new kind (§6.7), with no member id, card id or file id in it. Conformance is unchanged.
+- **LU15, the assistant.** With a fake provider capturing each request, no card value canary is ever sent. The answer's limits hold (5 types, 25 fields, 30 options). It is off with no key. The rate limit holds. Its log line holds no sentence and no answer.
+- **LU16, links.** A link value is never printed. Backlinks follow the event log, including after a target is deleted ("deleted card") and restored. A link to a card of the wrong type is refused.
+
+---
+
+## 16. Departures
+
+### From the mock-ups
+
+- **D1, the name opens the card.** The mock-up opened the card from an arrow beside the name, and let the name be edited in place. Here the name is a link to the card, and renaming happens on the card. It keeps the part of Paul's 2026-11-12 ruling that matters (a click on the name always opens the card) and gives up the rest (Q10).
+- **D2, Owner is a Person field, sealed.** The mock-up's seal table said "the shipped Owner stays plaintext". `cards.owner_id` is provenance, "who put this here" (`models.go`), never an assignment. It shows as **Created by**. A field a person sets, such as a customer's owner, is a Person field and sealed.
+- **D3, one all-or-any switch** instead of "or" groups (§4.4).
+- **D4, no manual order on a board.** A board's columns are sorted by the view's sort (§12).
+- **D5, the columns cookie retires** rather than becoming a personal default (§4.6).
+- **D6, weeks start on Monday** with no switch. The mock-up's toggle is dropped; the team's zone and Monday are the 2026-11-13 defaults.
+- **D7, the calendar on a phone is an agenda,** not the month grid.
+
+### From the base spec and draft 2, each for the reviewer
+
+- **D8, a type designer exists.** Base decision 6 and §11 ("a type designer: a second stack asks for it") are superseded by Paul's 2026-11-12 rulings (draft 2). Base §4.3 still holds: types are rows, never DDL, and user fields are never plaintext.
+- **D9, the catalogue gains People** (R5), with §8.3's tier table as its review (base §4.4).
+- **D10, files are a new kind of object,** with plaintext coordinates (§7.3) and a bucket. Base §4.1's cases 2 and 4 cover them; §10.2 states what they show.
+- **D11, two named exemptions from "every write logs"**: type drafts and the sweep (§9).
+- **D12, Fichas makes thumbnails** where Mapa makes no display copies (F6).
+- **D13, money is a kind** (Q12), where draft 2 had only Number.
+- **D14, number sorting is exact.** Today's sort compares floats (`index.go`). It now compares decimals, which changes no order a person could see except between values that differ past a float's precision.
+
+---
+
+## 17. Build notes
+
+Choices made while building, where this spec was silent or the build chose differently. Each is the smallest reasonable choice. A reviewer who disagrees changes the code and this list together.
+
+*None yet. Nothing is built.*
+
+---
+
+## 18. Findings and what changed
+
+*Rounds are recorded here as they happen.*