oficina / fichas Public

Fichas on the spacing scale: the stack, the spacing gate and the rhythm audit

Paul, 2026-11-22: "Can we somehow put something in place to avoid weird
spacing issues like this in future?", then "Release and start the
rollout" (spacing-rollout/BRIEF.md).

- rastrillo v0.45.0 (Fiesta 1.6.1) and estilo 6238a47: tokens.css by
  rastrillo doctor -fix, chrome.css and menu.css by scripts/writeestilo,
  brand.css by estilo's brand/distribute.py.
- The page, the card, its call log, every form and the contract's box are
  rst-stack, with rst-section (the call log, Delete's zone) and
  rst-actions (the card's Save changes); hand margins are gone. A page
  header (fichas-appbar, fichas-page-head) opens the content at
  --rst-sp-5. The edit form writes its hidden was inputs first, so no
  field is hidden from the stack's rule.
- Every other margin, padding and gap is var(--rst-sp-N). Allowances
  kept: the grid canvas's density paddings (Paul's 2026-11-12 row
  heights), the cards view face at rst-box's own 1.1rem 1.25rem, the
  density switch's 2px track, and the rail row's 10px gap and padding
  (level-up R1, "its rows keep today's grid").
- The card beside the list is flush with the page's padding (it was
  pulled 8px past it each side and stopped 8px short of the bar), with
  --rst-sp-5 inside, so four field columns still fit at 1440. The View
  menu's targets are 2rem, 44px on a phone.
- make spacing in make ci (hub CI step 50-spacing): 77 off-scale
  declarations on main, none here.
- TestTheScreensKeepTheRhythm (make browser): Fiesta's rhythm audit over
  every screen state at 1440 and 390px, scripts on and off, nothing
  skipped (the grid's canvas is a table, read as one block): 95 findings
  on main's CSS, none here. TestTheFormsFieldsAreAStepApart holds the
  fields of the edit form, a conflict and the new-card form at
  --rst-sp-3; it fails with the hidden inputs interleaved.
- Sign-in flow unchanged. rastrillo v0.45.0's own new wording is pinned;
  AuthEnv.KeymailServers (nil in production) lets the Keymail tests
  name their fake, which v0.45's public-only default cannot reach.

Review: Fable, APPROVE AFTER FIXES (no High; one Medium, the edit
form's 8px fields, and Lows L1-L6, all fixed in a86faa9; no re-review
needed for M1 per the coordinator). make ci and make browser green
(TestSmartDoorInABrowser passes alone; it hangs in a loaded full run as
on main). Hub CI green at a86faa9. Not deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from feat/rhythm into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 4d6eba91fce12e73550f6579ad0eaa876bb0d702 parent 48dd215
28 files changed, +633 −188
  • .amadan/ci.d/50-spacing +2 −0
  • AGENTS.md +11 −0
  • Makefile +17 −2
  • go.mod +8 −4
  • go.sum +8 −6
  • internal/fichas/auth.go +16 −9
  • internal/fichas/static/brand/brand.css +1 −1
  • internal/fichas/static/chrome.css +104 −49
  • internal/fichas/static/fichas.css +33 −24
  • internal/fichas/static/frame.css +7 −5
  • internal/fichas/static/grid.css +62 −55
  • internal/fichas/static/menu.css +8 −8
  • internal/fichas/static/tokens.css +84 −0
  • internal/fichas/templates/card_edit.html +7 −3
  • internal/fichas/templates/card_layout.html +2 −2
  • internal/fichas/templates/card_new.html +1 −1
  • internal/fichas/templates/contract_prepare.html +2 −2
  • internal/fichas/templates/field_edit.html +1 −1
  • internal/fichas/templates/field_new.html +1 −1
  • internal/fichas/templates/index.html +1 −1
  • internal/fichas/templates/partials.html +5 −5
  • internal/fichas/templates/shell.html +1 −1
  • internal/fichas/templates/type_new.html +1 −1
  • internal/fichastest/browser_rhythm_test.go +229 −0
  • internal/fichastest/browser_test.go +9 −0
  • internal/fichastest/markup_test.go +1 −1
  • internal/fichastest/signin_door_keymail_test.go +10 −5
  • internal/fichastest/signin_flow_test.go +1 −1

CI passed — run details

CI log
=== vet ===
go vet ./...
go: downloading amadan.net/rastrillo/rastrillo v0.45.0
go: downloading amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
go: downloading amadan.net/rastrillo/fiesta v1.6.1
go vet -tags browser ./internal/fichastest/
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/fichas/cmd/fichas	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas	2.336s
?   	amadan.net/oficina/fichas/internal/fichas/icons	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas/locale	0.008s
ok  	amadan.net/oficina/fichas/internal/fichas/seal	(cached)
ok  	amadan.net/oficina/fichas/internal/fichastest	2.635s
?   	amadan.net/oficina/fichas/scripts/mockups	[no test files]
?   	amadan.net/oficina/fichas/scripts/preview	[no test files]
?   	amadan.net/oficina/fichas/scripts/writeestilo	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== spacing ===
go tool fiesta spacing \
	-skip tokens.css -skip shell.css \
	-skip theme.css -skip busy.css -skip chrome.css -skip menu.css \
	-skip sky.css -skip savestatus.css -skip brand/brand.css \
	internal/fichas/static
go: downloading golang.org/x/net v0.58.0
diff --git a/.amadan/ci.d/50-spacing b/.amadan/ci.d/50-spacing
new file mode 100755
index 0000000..53c0bd3
--- /dev/null
+++ b/.amadan/ci.d/50-spacing
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec make spacing
diff --git a/AGENTS.md b/AGENTS.md
index b08b830..28d2d28 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -70,6 +70,17 @@ mechanically.
return memory is rastrillo's with Fichas' guards (`beginReturn`).
Bump estilo and rastrillo together (estilo's AGENTS.md); `frame.css`
draws the rail on `--rst-bg`, not Calma's `--rst-rail-bg`.
+- **Spacing is the scale's** (Paul, 2026-11-22: no ad-hoc spacing).
+ Page, card and form content sits in Fiesta's `rst-stack` (with
+ `rst-section` and `rst-actions`), never hand margins; every other
+ margin, padding and gap is `var(--rst-sp-N)` or carries a
+ `/* spacing-allow: why */`. `make spacing` (in `make ci`) checks the
+ stylesheets; `TestTheScreensKeepTheRhythm` (in `make browser`) runs
+ Fiesta's rhythm audit over every screen at 1440 and 390px (the
+ contract's last two phases excepted: they need a signed release). A
+ new screen joins its list. A hidden input between two of a stack's
+ blocks hides the first from the stack's rule (the second falls to its
+ 8px floor): write hidden inputs first, as the edit form does.
## Serving
diff --git a/Makefile b/Makefile
index 6e2dbd9..c08c1e9 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)
# make release VERSION=v0.1.0
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null)
-.PHONY: build release version-check test vet fmt-check migration-check ci
+.PHONY: build release version-check test vet fmt-check migration-check spacing ci
# build is the compile check: with more than one package matched, go
# build discards the output, so this catches a broken package without
@@ -117,7 +117,22 @@ migration-check:
# fails the build the moment models.go and migrations/ disagree,
# instead of at boot on whatever machine notices next. If the app
# declares manifest resources, also add: rastrillo generate --check
-ci: vet fmt-check test migration-check
+ci: vet fmt-check test migration-check spacing
+
+# spacing is Fiesta's spacing gate (rastrillo v0.45.0, Fiesta 1.6): every
+# margin, padding and gap in this app's own stylesheets is a step of the
+# scale, var(--rst-sp-N), or says why not with /* spacing-allow: why */.
+# The skipped files are vendored, somebody else's to space: tokens.css is
+# rastrillo's (rastrillo doctor), shell.css too, and the rest are estilo's
+# (go run ./scripts/writeestilo; brand/ from estilo's brand/distribute.py).
+# The rhythm audit, its runtime half, is in make browser
+# (browser_rhythm_test.go).
+spacing:
+ go tool fiesta spacing \
+ -skip tokens.css -skip shell.css \
+ -skip theme.css -skip busy.css -skip chrome.css -skip menu.css \
+ -skip sky.css -skip savestatus.css -skip brand/brand.css \
+ internal/fichas/static
# browser runs the real-Chromium tests (internal/fichastest/browser_test.go).
# Behind a build tag because CI runners may have no Chromium — which is
diff --git a/go.mod b/go.mod
index 96a54f2..3c1bbb4 100644
--- a/go.mod
+++ b/go.mod
@@ -5,9 +5,10 @@ go 1.26.0
toolchain go1.26.11
require (
- amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803
+ amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e
amadan.net/oficina/suite v0.0.0-20261102002704-91affa14eae4
- amadan.net/rastrillo/rastrillo v0.43.0
+ amadan.net/rastrillo/fiesta v1.6.1
+ amadan.net/rastrillo/rastrillo v0.45.0
github.com/chromedp/cdproto v0.158.6
github.com/chromedp/chromedp v0.21.0
github.com/go-chi/chi/v5 v5.3.2
@@ -19,7 +20,6 @@ require (
)
require (
- amadan.net/rastrillo/fiesta v1.5.0 // indirect
amadan.net/rastrillo/rastrillo/money v0.1.0 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/carlosframework/rastrillo v0.23.0 // indirect
@@ -32,6 +32,7 @@ require (
github.com/tdewolff/minify/v2 v2.24.19 // indirect
github.com/tdewolff/parse/v2 v2.8.16 // indirect
golang.org/x/mod v0.38.0 // indirect
+ golang.org/x/net v0.58.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.41.0 // indirect
@@ -43,4 +44,7 @@ require (
modernc.org/sqlite v1.55.0 // indirect
)
-tool amadan.net/rastrillo/rastrillo/cmd/rastrillo
+tool (
+ amadan.net/rastrillo/fiesta/cmd/fiesta
+ amadan.net/rastrillo/rastrillo/cmd/rastrillo
+)
diff --git a/go.sum b/go.sum
index e540023..37ffc91 100644
--- a/go.sum
+++ b/go.sum
@@ -1,11 +1,11 @@
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803 h1:yl1LyYZW3/722xRPnXMu5veg4sZGjyDMJFLqOWST0ws=
-amadan.net/oficina/estilo.git v0.0.0-20261121233240-468fab16e803/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e h1:g2EvXlQAleAEFsc4yIBvS7ycMG3GyuEySEOia0yo8nY=
+amadan.net/oficina/estilo.git v0.0.0-20261122204240-6238a478888e/go.mod h1:2UFIFrbTrhew8EFM0C94WmTo2OASM2pHEgT4jzeE/s8=
amadan.net/oficina/suite v0.0.0-20261102002704-91affa14eae4 h1:BP+KHZTSgL7HDCz9IL/gxKXmbmXQpclUlJIyQEY/N2E=
amadan.net/oficina/suite v0.0.0-20261102002704-91affa14eae4/go.mod h1:Xgw0N+DBiDzkhQHm/nIhgumfaiMElDg/KIFD1OxTm5w=
-amadan.net/rastrillo/fiesta v1.5.0 h1:wKfTsL5zRMofJBAqOxNlCY7aCtgHCtfwvTPBMA+ZA20=
-amadan.net/rastrillo/fiesta v1.5.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
-amadan.net/rastrillo/rastrillo v0.43.0 h1:cJWZKfJ03xqMBKTh0J5tBLmefnIU8udi1jNq7x4E7f0=
-amadan.net/rastrillo/rastrillo v0.43.0/go.mod h1:0bufVMz8D4aWvxvJjehW70T8Jsvytrp1YEwoIzFTKm8=
+amadan.net/rastrillo/fiesta v1.6.1 h1:WYgHt652+uQj6eR0Y0JLin+XrdRPGk1WPW7o0lSrc94=
+amadan.net/rastrillo/fiesta v1.6.1/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY=
+amadan.net/rastrillo/rastrillo v0.45.0 h1:zJfxetxg/H/CkCBFIvdGQbiATQ0hV3JR7H82AMk4bmM=
+amadan.net/rastrillo/rastrillo v0.45.0/go.mod h1:Vk7QL+RePyKtcP+7XclR9hpSDp/CjrVo37TENKifaFY=
amadan.net/rastrillo/rastrillo/money v0.1.0 h1:MxU4oqNrW8abxRTkgZBv24OYNpFnvonajNqeLIzmmaM=
amadan.net/rastrillo/rastrillo/money v0.1.0/go.mod h1:cmgkjBEIQh1pFSYvQk0UU6oPYS8kSDypdT9+t4Flx0U=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
@@ -58,6 +58,8 @@ golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
+golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
+golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/internal/fichas/auth.go b/internal/fichas/auth.go
index 2ab3708..a0152c0 100644
--- a/internal/fichas/auth.go
+++ b/internal/fichas/auth.go
@@ -147,6 +147,12 @@ type AuthEnv struct {
// computable value identical across every deployment.
InstanceKey string
Mailer mail.Sender
+ // KeymailServers is auth.Config's: nil, as main.go and AppForTest
+ // leave it, is any server an address's own _keymail delegation
+ // names, which rastrillo (v0.45) dials at public addresses only. The
+ // Keymail door tests name their fake's hosts here, the one way a
+ // test's transport is still the one a probe goes through.
+ KeymailServers []string
}
// Gate is what the sign-in flow needs from the app: the admission
@@ -177,15 +183,16 @@ func NewAuth(sqlDB *sql.DB, env AuthEnv, logger *slog.Logger, gate Gate) (*auth.
return nil, errors.New("sign-in: refusing to wire auth with no admission gate")
}
return auth.New(auth.Config{
- DB: sqlDB,
- Origin: env.Origin,
- InstanceKey: env.InstanceKey,
- Mailer: env.Mailer,
- Authorize: gate.Admit,
- SigninPath: signinPath,
- SignedInPath: "/",
- Subject: chrome.EmailSubject("Fichas"),
- Logger: logger,
+ DB: sqlDB,
+ Origin: env.Origin,
+ InstanceKey: env.InstanceKey,
+ Mailer: env.Mailer,
+ Authorize: gate.Admit,
+ SigninPath: signinPath,
+ SignedInPath: "/",
+ Subject: chrome.EmailSubject("Fichas"),
+ Logger: logger,
+ KeymailServers: env.KeymailServers,
// No proof-of-work front door on POST /signin, as in Docs: the
// abuse controls are rastrillo's per-address and per-IP rate
// limits and the owners list, which never mails an address it
diff --git a/internal/fichas/static/brand/brand.css b/internal/fichas/static/brand/brand.css
index 27e25ad..475fb08 100644
--- a/internal/fichas/static/brand/brand.css
+++ b/internal/fichas/static/brand/brand.css
@@ -3,7 +3,7 @@
[estilo-brand] {
display: inline-flex;
align-items: center;
- gap: .5rem;
+ gap: var(--rst-sp-2);
min-block-size: 24px;
}
[estilo-brand-icon] {
diff --git a/internal/fichas/static/chrome.css b/internal/fichas/static/chrome.css
index 83a482f..95a4320 100644
--- a/internal/fichas/static/chrome.css
+++ b/internal/fichas/static/chrome.css
@@ -25,7 +25,7 @@
[estilo-bar-brand] {
display: inline-flex;
align-items: center;
- gap: 0.5rem;
+ gap: var(--rst-sp-2);
flex: none;
color: var(--rst-text);
font-weight: 650;
@@ -63,11 +63,11 @@
display: inline-flex;
align-items: center;
justify-content: center;
- gap: 0.3rem;
+ gap: var(--rst-sp-1);
box-sizing: border-box;
min-inline-size: var(--estilo-trigger-size);
block-size: var(--estilo-trigger-size);
- padding-inline: 0.4rem;
+ padding-inline: var(--rst-sp-2);
border-radius: 0; /* in-flow: square */
color: var(--rst-text-muted);
font-size: var(--rst-fs-sm);
@@ -124,7 +124,7 @@
block-size: 2rem;
inline-size: 100%;
min-inline-size: 6rem;
- padding-inline: 0.4rem;
+ padding-inline: var(--rst-sp-2);
border: 1px solid transparent;
border-radius: var(--rst-radius-sm);
background: transparent;
@@ -168,13 +168,13 @@
/* The app switcher: a float, so its tiles may be rounded. */
[estilo-switcher] { position: relative; }
[estilo-switcher-panel] { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); }
-[estilo-switcher-grid] { display: grid; grid-template-columns: repeat(3, 5.5rem); gap: 0.25rem; }
+[estilo-switcher-grid] { display: grid; grid-template-columns: repeat(3, 5.5rem); gap: var(--rst-sp-1); }
[estilo-switcher-app] {
display: flex;
flex-direction: column;
align-items: center;
- gap: 0.35rem;
- padding: 0.6rem 0.25rem;
+ gap: var(--rst-sp-1);
+ padding: var(--rst-sp-2) var(--rst-sp-1);
border-radius: var(--rst-radius-sm); /* inside a float: rounded is allowed */
color: var(--rst-text);
font-size: var(--rst-fs-xs);
@@ -210,7 +210,7 @@
font-size: var(--rst-fs-xs);
font-weight: 650;
}
-[estilo-menu-identity] { display: grid; gap: 0.1rem; padding: 0.5rem var(--estilo-item-padding-inline, 0.65rem); }
+[estilo-menu-identity] { display: grid; gap: 0; padding: var(--rst-sp-2) var(--estilo-item-padding-inline, var(--rst-sp-3)); }
[estilo-menu-identity-label] { color: var(--rst-text-muted); font-size: var(--rst-fs-xs); }
[estilo-menu-identity-name] { font-weight: 600; overflow-wrap: anywhere; }
[estilo-menu-identity-address] { color: var(--rst-text-muted); overflow-wrap: anywhere; }
@@ -258,8 +258,8 @@
:root:has([estilo-door]) { overflow-x: clip; --rst-scrollbar-gutter: auto; scrollbar-gutter: auto; }
[estilo-door] {
box-sizing: border-box;
- margin-inline: calc(50% - 50vw);
- padding: max(40px, 9vh) var(--rst-sp-4) var(--rst-sp-6);
+ margin-inline: calc(50% - 50vw); /* spacing-allow: full-bleed, the door spans the viewport whatever column it sits in */
+ padding: max(var(--rst-sp-6), 9vh) var(--rst-sp-4) var(--rst-sp-6); /* spacing-allow: the card sits lower on a taller window, 9vh down */
min-block-size: 680px;
/* The whole sky lies inside the door, fading in and out, so the door's
edges never cut it: under an app's bar there is no page top to hide
@@ -270,25 +270,81 @@
--estilo-sky-top: 67px;
--estilo-sky-height: 560px;
}
+/* The card is a stack: its children's own block margins go, and the
+ space above each comes from the table Fiesta's rst-stack uses
+ (DESIGN.md, "The stack"), written here in estilo's own names because
+ an app's tokens.css may predate it:
+
+ after a heading (h1 to h6) --rst-sp-2
+ an actions row: a button, the card's
+ action or a paragraph holding it,
+ Forget (under another action:
+ --rst-sp-2) --rst-sp-4
+ an input after its label or its hint
+ ([estilo-signin-hint]), a hint after
+ its input --rst-sp-2
+ an h1 or h2, a section
+ ([estilo-signin-section]), or anything
+ after the brand, which heads the card
+ as a page header heads a page --rst-sp-5
+ an h3 to h6 --rst-sp-4
+ anything else --rst-sp-3
+
+ Higher in the table wins: each relation sets its own property on the
+ child, and the one margin rule reads them in the table's order, so
+ specificity never decides it; every child resets them first, so
+ content nested in the card never inherits an answer. A column, so
+ nothing collapses; a button or a picture keeps its own width.
+
+ As in Fiesta's stack, the column's gap is the table's smallest step
+ and a child's margin is the rest of its answer: a hidden child (or a
+ hidden input) is no flex item and takes no gap, so the block after
+ one keeps --rst-sp-2 and never touches what is above it. */
[estilo-signin] {
box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
max-inline-size: 460px;
margin: 0 auto;
- padding: 34px 40px 32px;
+ padding: var(--rst-sp-6);
+ gap: var(--rst-sp-2);
background: var(--rst-surface);
border-radius: 20px;
box-shadow: 0 0 0 1px light-dark(transparent, var(--rst-line)), var(--rst-shadow-lift);
}
-[estilo-signin] > [estilo-brand] { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
+[estilo-signin] > * {
+ --estilo-stack-heading: initial;
+ --estilo-stack-actions: initial;
+ --estilo-stack-control: initial;
+ --estilo-stack-section: initial;
+ --estilo-stack-sub: initial;
+ margin-block: 0;
+}
+[estilo-signin] > :not([hidden], [type="hidden"]) + :not([hidden]) {
+ /* spacing-allow: the table's step less the column's --rst-sp-2 gap; margin and gap together are the step */
+ margin-block-start: calc(var(--estilo-stack-heading, var(--estilo-stack-actions, var(--estilo-stack-control, var(--estilo-stack-section, var(--estilo-stack-sub, var(--rst-sp-3)))))) - var(--rst-sp-2));
+}
+[estilo-signin] > :is(img, button, a[estilo-signin-action]) { align-self: flex-start; }
+[estilo-signin] > :not([hidden], [type="hidden"]) + :is(h3, h4, h5, h6) { --estilo-stack-sub: var(--rst-sp-4); }
+[estilo-signin] > :not([hidden], [type="hidden"]) + :is(h1, h2),
+[estilo-signin] > :not([hidden], [type="hidden"]) + [estilo-signin-section],
+[estilo-signin] > [estilo-brand] + * { --estilo-stack-section: var(--rst-sp-5); }
+[estilo-signin] > :is(label, [estilo-signin-hint]) + :is(input, select, textarea),
+[estilo-signin] > :is(input, select, textarea) + [estilo-signin-hint] { --estilo-stack-control: var(--rst-sp-2); }
+[estilo-signin] > :not([hidden], [type="hidden"]) + :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) { --estilo-stack-actions: var(--rst-sp-4); }
+[estilo-signin] > :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) + :is(button, [estilo-signin-action], [estilo-signin-forget], p:has(> [estilo-signin-action]), p:has(> button)) { --estilo-stack-actions: var(--rst-sp-2); }
+[estilo-signin] > :is(h1, h2, h3, h4, h5, h6) + * { --estilo-stack-heading: var(--rst-sp-2); }
+[estilo-signin] > [estilo-brand] { display: flex; align-items: center; gap: var(--rst-sp-2); font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
[estilo-signin] > [estilo-brand] [estilo-brand-icon] { inline-size: 36px; block-size: 36px; }
-[estilo-signin] h1 { margin: 0; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; }
-[estilo-signin-lede] { margin: 0.5rem 0 var(--rst-sp-4); color: var(--rst-text-muted); }
-[estilo-signin] > h1 + :not([estilo-signin-lede]) { margin-block-start: var(--rst-sp-4); }
-[estilo-signin-form] { max-inline-size: none; margin-block-start: var(--rst-sp-4); }
-[estilo-signin-body] { margin: var(--rst-sp-4) 0; }
+[estilo-signin] h1 { font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; }
+/* A heading the card holds directly is spaced by the stack above; one
+ nested deeper brings no margin of its own. */
+[estilo-signin] * h1 { margin: 0; }
+[estilo-signin-lede] { color: var(--rst-text-muted); }
+[estilo-signin-form] { max-inline-size: none; }
@media (max-width: 520px) {
- [estilo-door] { padding-inline: 14px; padding-block-start: 28px; }
- [estilo-signin] { padding: 26px 22px 24px; }
+ [estilo-door] { padding-inline: var(--rst-sp-4); padding-block-start: var(--rst-sp-5); }
+ [estilo-signin] { padding: var(--rst-sp-5); }
}
/* The door's links are drawn here, not left to the app: an app that does
not link base.css (Calendar, Memoria, Calls, Fichas) showed the browser's
@@ -313,7 +369,7 @@
stylesheets are linked in never decides it. */
[estilo-signin-screen] > section { display: block; inline-size: auto; max-inline-size: none; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
[estilo-signin-screen] > section > :first-child:not(:only-child):not(:has(h1)) { display: none; }
-[estilo-signin] [estilo-signin-screen] h1 { margin: 0 0 2px; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; }
+[estilo-signin] [estilo-signin-screen] h1 { margin: 0; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; }
/* The door's buttons are the smart door's (Paul, 2026-11-21, "yes to pill
buttons"), on every card the door draws. The card's main action is a
full-width pill, 44px tall, lit from above, its shadow tinted by its
@@ -335,7 +391,7 @@
rules give it the door's shape. A hidden button stays hidden. */
[estilo-signin] :is([estilo-signin-form] [type="submit"], [estilo-signin-action]:not([estilo-signin-action~="quiet"])):not([hidden]) {
display: flex; inline-size: 100%; box-sizing: border-box; justify-content: center; align-items: center;
- min-block-size: 44px; padding-inline: 18px; border-radius: 999px; font-weight: 600; text-decoration: none;
+ min-block-size: 44px; padding-inline: var(--rst-sp-4); border-radius: 999px; font-weight: 600; text-decoration: none;
}
/* The glow lifts the pill only at rest: pressed, rastrillo's own pressed
shadow draws it sinking. */
@@ -346,10 +402,9 @@
[estilo-signin] [estilo-signin-action~="danger"] {
--estilo-signin-glow: light-dark(color-mix(in srgb, var(--rst-danger-fill, var(--rst-tone-negative-fg)) 60%, transparent), color-mix(in srgb, var(--rst-danger-fill, var(--rst-tone-negative-fg)) 30%, transparent));
}
-[estilo-signin-forget] { margin: var(--rst-sp-2) 0 0; }
[estilo-signin] :is([estilo-signin-action~="quiet"], [estilo-signin-forget] > button):not([hidden]) {
display: flex; inline-size: fit-content; margin-inline: auto; justify-content: center; align-items: center;
- min-block-size: 2.5rem; padding: 0 0.875rem; border-color: transparent; border-radius: 999px; background: transparent; box-shadow: none;
+ min-block-size: 2.5rem; padding: 0 var(--rst-sp-3); border-color: transparent; border-radius: 999px; background: transparent; box-shadow: none;
color: var(--rst-text-muted); font-size: calc(var(--rst-fs-base) * 0.9375); font-weight: 500; text-decoration: none;
}
/* On touch, and on a narrow screen, a quiet control is a full tap target,
@@ -435,7 +490,7 @@
grid-area: menus;
align-self: stretch;
min-inline-size: 0;
- margin-inline: calc(var(--rst-sp-3) - var(--rst-sp-4)); /* the menus' edge 12px in, as Docs' own row had it */
+ margin-inline: calc(-1 * var(--rst-sp-1)); /* the menus' edge 12px in (the bar's 16px less 4px), as Docs' own row had it */
}
}
@@ -449,7 +504,7 @@
1px above that edge. */
@media (min-width: 800px) {
:root:has([estilo-bar~="stacked"]) { --estilo-bar-block-size: 56px; } /* PUBLIC */
- [estilo-bar~="stacked"] { gap: 12px; padding-inline: 12px; }
+ [estilo-bar~="stacked"] { gap: var(--rst-sp-3); padding-inline: var(--rst-sp-3); }
[estilo-bar~="stacked"] [estilo-bar-brand] img { inline-size: 32px; block-size: 32px; }
[estilo-bar~="stacked"] [estilo-bar-name] { display: none; }
[estilo-bar-stack] {
@@ -472,8 +527,8 @@
[estilo-bar~="stacked"] [estilo-bar-title-input] {
block-size: 24px;
padding-block: 0;
- margin-inline-start: calc(-0.4rem - 1px); /* the field's padding and border pulled back: the text sits on the edge */
- max-inline-size: calc(100% + 0.4rem + 1px); /* the form is that much narrower than the field: the cap gives it back */
+ margin-inline-start: calc(-1 * var(--rst-sp-2) - 1px); /* spacing-allow: the field's padding and 1px border pulled back, so its text sits on the edge */
+ max-inline-size: calc(100% + var(--rst-sp-2) + 1px); /* the form is that much narrower than the field: the cap gives it back */
font-size: 16px;
line-height: 24px;
font-weight: 600;
@@ -501,7 +556,7 @@
min-block-size: 0;
min-inline-size: 0;
margin: 0;
- padding: 0 10px;
+ padding: 0 var(--rst-sp-2);
border: 1px solid transparent;
border-radius: 999px;
background-color: var(--rst-accent-soft);
@@ -524,16 +579,16 @@
position: relative;
inset-block-start: 1px;
block-size: 20px;
- max-inline-size: calc(100% + 7px);
- margin-inline-start: -7px; /* the titles' padding pulled back: the first title's text sits on the edge */
+ max-inline-size: calc(100% + var(--rst-sp-2));
+ margin-inline-start: calc(-1 * var(--rst-sp-2)); /* the titles' padding pulled back: the first title's text sits on the edge */
}
[estilo-bar~="stacked"] [estilo-menubar] { block-size: 20px; min-block-size: 0; align-items: center; flex-wrap: nowrap; }
[estilo-bar~="stacked"] [estilo-menubar-menu] { block-size: 20px; }
[estilo-bar~="stacked"] [estilo-menubar-title] {
block-size: 24px;
min-block-size: 0;
- margin-block: -2px;
- padding-inline: 7px;
+ margin-block: -2px; /* spacing-allow: the 24px highlight overhangs the 20px row by 2px each way and takes no room */
+ padding-inline: var(--rst-sp-2);
border-radius: 6px;
color: var(--rst-text-muted);
font-size: 13px;
@@ -546,14 +601,14 @@
/* Every panel in the stacked header matches it: 28px rows, 13px type,
shortcuts muted, 4px padding and a 10px radius. */
[estilo-bar~="stacked"] [estilo-menu] {
- --estilo-float-padding: 4px;
- --estilo-item-padding-block: 4px;
- --estilo-item-padding-inline: 10px;
+ --estilo-float-padding: var(--rst-sp-1);
+ --estilo-item-padding-block: var(--rst-sp-1);
+ --estilo-item-padding-inline: var(--rst-sp-3);
border-radius: 10px;
font-size: 13px;
}
[estilo-bar~="stacked"] [estilo-menu-item] { min-block-size: 28px; border-radius: 6px; }
- [estilo-bar~="stacked"] [estilo-menu] hr { margin-block: 4px; }
+ [estilo-bar~="stacked"] [estilo-menu] hr { margin-block: var(--rst-sp-1); }
[estilo-bar~="stacked"] [estilo-menu-key] { color: var(--rst-text-muted); font-size: 12px; }
/* The controls set, in a bar with a slot: every action a 28px pill,
@@ -562,16 +617,16 @@
the person's. Lit from above as the index's New document is, and far
fainter in dark. */
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end],
- :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-actions] { gap: 8px; }
+ :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-actions] { gap: var(--rst-sp-2); }
:is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) {
display: inline-flex;
align-items: center;
- gap: 6px;
+ gap: var(--rst-sp-2);
box-sizing: border-box;
block-size: 28px;
min-block-size: 28px;
min-inline-size: 28px;
- padding: 0 12px;
+ padding: 0 var(--rst-sp-3);
border: 0;
border-radius: 999px;
background-color: transparent;
@@ -597,7 +652,7 @@
and a shadow tinted with its own accent, 0 5px 12px -5px. */
:is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button),
:is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button):hover:not(:disabled) {
- padding-inline: 14px;
+ padding-inline: var(--rst-sp-4);
background-color: var(--rst-accent);
color: var(--rst-on-accent);
box-shadow:
@@ -646,8 +701,8 @@
lead. Below 64rem a WideOnly action is hidden, so it does not count
there. */
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account] {
- margin-inline-start: 4px;
- padding-inline-start: 12px;
+ margin-inline-start: var(--rst-sp-1);
+ padding-inline-start: var(--rst-sp-3);
background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat;
}
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account]:dir(rtl) {
@@ -696,8 +751,8 @@
}
@media (min-width: 64rem) {
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account] {
- margin-inline-start: 4px;
- padding-inline-start: 12px;
+ margin-inline-start: var(--rst-sp-1);
+ padding-inline-start: var(--rst-sp-3);
background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat;
}
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account]:dir(rtl) {
@@ -729,9 +784,9 @@
[estilo-appearance] {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 2px;
- margin: 2px 6px 6px;
- padding: 3px;
+ gap: var(--rst-sp-1);
+ margin: var(--rst-sp-1) var(--rst-sp-2) var(--rst-sp-2);
+ padding: var(--rst-sp-1);
border-radius: 10px;
background: var(--rst-surface-2);
box-shadow: inset 0 1px 2px light-dark(rgb(23 32 60 / 0.06), rgb(0 0 0 / 0.25));
@@ -739,9 +794,9 @@
[estilo-appearance] [estilo-menu-item] {
flex-direction: column;
justify-content: center;
- gap: 4px;
+ gap: var(--rst-sp-1);
min-block-size: 46px;
- padding: 6px 4px;
+ padding: var(--rst-sp-2) var(--rst-sp-1);
border-radius: 8px;
background: none;
color: var(--rst-text-muted);
diff --git a/internal/fichas/static/fichas.css b/internal/fichas/static/fichas.css
index bffb682..9460198 100644
--- a/internal/fichas/static/fichas.css
+++ b/internal/fichas/static/fichas.css
@@ -8,8 +8,9 @@
* TestTemplatesUseOnlyDefinedAttributes pins every rst-* and fichas-*
* attribute a template writes to a rule in one of the app's stylesheets —
* the check that would have caught rst-stack and rst-muted, the two
- * invented attributes that shipped the first index with a bullet point and
- * an underlined purple link.
+ * invented attributes that shipped the first index with a bullet point
+ * and an underlined purple link. (rst-stack is real since rastrillo
+ * v0.45.0: Fiesta's stack, in tokens.css.)
*
* Only tokens.css custom properties are used, so the Calma theme and the
* light/dark switch apply unchanged.
@@ -83,7 +84,7 @@
[fichas-card-grid] [rst-card] {
/* rst-card is a bare container by design; rst-box's padding, so a card
face and a box read as the same material. */
- padding: 1.1rem 1.25rem;
+ padding: 1.1rem 1.25rem; /* spacing-allow: rst-box's own padding (tokens.css), so a card face and a box are one material */
box-shadow: var(--rst-shadow-lift);
border-radius: var(--rst-radius);
display: flex;
@@ -116,7 +117,6 @@
align-items: center;
justify-content: space-between;
gap: var(--rst-sp-3);
- margin-block-end: var(--rst-sp-4);
}
/* The view switch sits in the row, so rastrillo's margin under a block of
tabs (since v0.35, kept by v0.42) only pushes the row apart and lifts
@@ -135,7 +135,6 @@
every space on the show page. Let the boxes space themselves. */
[fichas-split] > * { min-inline-size: 0; }
[fichas-split] > * > [rst-box]:first-child { margin-block-start: 0; }
-[rst-box] form + [fichas-timeline] { margin-block-start: var(--rst-sp-5); }
[fichas-timeline] {
list-style: none;
@@ -172,7 +171,6 @@
/* ---- A destructive action set apart at the foot of an edit page. */
[fichas-danger-zone] {
- margin-block-start: var(--rst-sp-6);
padding-block-start: var(--rst-sp-4);
border-block-start: 1px solid var(--rst-line);
}
@@ -183,8 +181,11 @@
align-items: center;
justify-content: space-between;
gap: var(--rst-sp-3);
- margin-block-end: var(--rst-sp-5);
}
+/* The page's header, either shape: what follows it opens the page's
+ content, as after rastrillo's rst-page-header (Fiesta's stack table,
+ "anything after the page header"). */
+[rst-stack] > :is([fichas-appbar], [fichas-page-head]) + :not([hidden]) { --rst-stack-section: var(--rst-sp-5); }
[fichas-appbar-title] {
display: flex;
align-items: baseline;
@@ -215,18 +216,15 @@
}
[fichas-link]:hover { text-decoration-color: currentColor; }
-/* ---- The record bar sits under the view switch, full width, with room. */
-[fichas-toolbar] + [rst-lbar] { margin-block-end: var(--rst-sp-4); }
-
/* ---- The table's density (listprefs.go). Comfortable is the default:
room to read a row (Paul, 2026-11-12: the old rows were "a bit
squished"). Compact fits more on a screen, for those who want it. */
[fichas-grid][data-density="comfortable"] { font-size: 0.84375rem; }
[fichas-grid][data-density="comfortable"] th,
-[fichas-grid][data-density="comfortable"] td { padding: 0.8125rem 0.6875rem; }
-[fichas-grid][data-density="comfortable"] thead th { font-size: var(--rst-fs-sm); padding-block: 0.625rem; }
+[fichas-grid][data-density="comfortable"] td { padding: 0.8125rem 0.6875rem; /* spacing-allow: the grid's canvas, its comfortable row height (Paul, 2026-11-12) */ }
+[fichas-grid][data-density="comfortable"] thead th { font-size: var(--rst-fs-sm); padding-block: 0.625rem; /* spacing-allow: the grid's canvas, its header row at comfortable density */ }
[fichas-grid][data-density="compact"] th,
-[fichas-grid][data-density="compact"] td { padding: 0.3125rem 0.625rem; }
+[fichas-grid][data-density="compact"] td { padding: 0.3125rem 0.625rem; /* spacing-allow: the grid's canvas, its compact row height */ }
/* ---- A row opens its card: the title's link is stretched over the
whole row, so it works with scripts off, middle-clicks into a new tab,
@@ -263,13 +261,16 @@
[fichas-view-seg] {
display: grid;
grid-template-columns: 1fr 1fr;
+ /* spacing-allow: a hairline of the track between and around the pressed segment */
gap: 2px;
+ /* spacing-allow: the same hairline of track around the segments */
padding: 2px;
border-radius: 8px;
background: var(--rst-surface-2);
}
[fichas-view-seg] button {
- padding: 0.375rem var(--rst-sp-2);
+ min-block-size: 2rem;
+ padding: var(--rst-sp-1) var(--rst-sp-2);
border: 0;
border-radius: 6px;
background: none;
@@ -289,16 +290,21 @@
[fichas-view-check] {
display: flex;
align-items: center;
+ min-block-size: 2rem;
gap: var(--rst-sp-2);
- padding: 0.3125rem 0;
+ padding: var(--rst-sp-1) 0;
font-size: var(--rst-fs-sm);
cursor: pointer;
}
+/* A phone's finger: the View menu's targets at 44px (level-up §5.8). */
+@media (max-width: 799.98px) {
+ [fichas-view-seg] button, [fichas-view-check] { min-block-size: 44px; }
+}
[fichas-view-check]:has(input:disabled) { color: var(--rst-text-muted); cursor: default; }
/* The dropdown styles every button in it as a menu row; this one is the
panel's action, filled as a primary is. */
[fichas-view-panel] [fichas-view-apply] {
- padding: 0.5rem var(--rst-sp-3);
+ padding: var(--rst-sp-2) var(--rst-sp-3);
border-radius: var(--rst-radius-sm);
background: var(--rst-accent);
color: var(--rst-on-accent);
@@ -321,7 +327,7 @@
[fichas-checklist] {
border: 0;
padding: 0;
- margin: 0 0 var(--rst-sp-4);
+ margin: 0;
display: flex;
flex-direction: column;
gap: var(--rst-sp-2);
@@ -367,7 +373,7 @@
}
[rst-page] [rst-btn] {
border-radius: 999px;
- padding-inline: 14px;
+ padding-inline: var(--rst-sp-4);
font-weight: 600;
box-shadow:
inset 0 1px 0 light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.06)),
@@ -384,7 +390,6 @@
}
[rst-page] [rst-btn]:not([rst-btn~="primary"]):not([rst-btn~="danger"]):hover { background-color: var(--rst-surface-2); }
[rst-page] [rst-btn~="primary"] {
- padding-inline: 18px;
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.22),
0 1px 1px rgb(23 32 60 / 0.10),
@@ -393,11 +398,11 @@
[rst-page] [rst-btn~="primary"]:hover { background-color: var(--rst-accent-strong); }
[rst-page] [rst-seg-tabs] {
border-radius: 999px;
- padding: 3px;
+ padding: var(--rst-sp-1);
background: var(--rst-surface-2);
box-shadow: inset 0 1px 2px rgb(23 32 60 / 0.08);
}
-[rst-page] [rst-seg-tabs] a { border-radius: 999px; padding-inline: 16px; }
+[rst-page] [rst-seg-tabs] a { border-radius: 999px; padding-inline: var(--rst-sp-4); }
[rst-page] [rst-seg-tabs] a[aria-current] {
background: var(--rst-surface);
color: var(--rst-text);
@@ -407,7 +412,7 @@
[rst-page] [rst-lbar] [rst-search] {
border-color: transparent;
border-radius: 999px;
- padding-inline-start: 14px;
+ padding-inline-start: var(--rst-sp-3);
box-shadow: 0 0 0 1px var(--rst-line), inset 0 1px 2px rgb(23 32 60 / 0.06);
}
[rst-page] [rst-lbar] [rst-search]:focus-within { box-shadow: 0 0 0 2px var(--rst-accent); }
@@ -425,11 +430,15 @@
/* ---- Add a field: the choices box only while Choice is picked, and the
storage question tucked under Advanced (UX review, 2026-11-12). */
[fichas-form]:has(input[name="kind"]:checked:not([value="enum"])) [fichas-choice-options] { display: none; }
-[fichas-advanced] { margin-block: var(--rst-sp-2) var(--rst-sp-4); }
+/* The wrapper is the form stack's block, so the stack spaces it, not the
+ field's own margins inside it. */
+[fichas-choice-options] > [rst-field] { margin: 0; }
[fichas-advanced] > summary {
cursor: pointer;
color: var(--rst-text-muted);
font-size: var(--rst-fs-sm);
font-weight: 600;
- margin-block-end: var(--rst-sp-3);
}
+/* Under Advanced, its blocks each sit one step below the last, in place
+ of their own margins. */
+[fichas-advanced] > :not(summary) { margin-block: var(--rst-sp-3) 0; }
diff --git a/internal/fichas/static/frame.css b/internal/fichas/static/frame.css
index 49aed31..7598c7b 100644
--- a/internal/fichas/static/frame.css
+++ b/internal/fichas/static/frame.css
@@ -35,8 +35,8 @@
block-size: calc(100dvh - 56px);
display: flex;
flex-direction: column;
- gap: 2px;
- padding: 12px 8px;
+ gap: var(--rst-sp-1);
+ padding: var(--rst-sp-3) var(--rst-sp-2);
border-inline-end: 1px solid var(--rst-line);
/* The page's own ground, not --rst-rail-bg: Calma declares that as
--rst-surface since estilo 487cadb, which would tint the rail
@@ -49,8 +49,10 @@
display: grid;
grid-template-columns: 16px minmax(0, 1fr) auto;
align-items: center;
+ /* spacing-allow: level-up spec R1, "its rows keep today's grid": the icon 10px from its label */
gap: 10px;
min-block-size: 36px;
+ /* spacing-allow: level-up spec R1, "its rows keep today's grid": the icon 10px in from the row's highlight */
padding: 0 10px;
border: 0;
border-radius: 8px;
@@ -72,12 +74,12 @@
[fichas-rail-label] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[fichas-rail-count] { font-size: var(--rst-fs-xs); font-variant-numeric: tabular-nums; color: var(--rst-text-faint, var(--rst-text-muted)); }
[fichas-rail-new] { color: var(--rst-text-muted); }
-[fichas-rail-rule] { border: 0; border-block-start: 1px solid var(--rst-line); margin: 8px 6px; }
+[fichas-rail-rule] { border: 0; border-block-start: 1px solid var(--rst-line); margin: var(--rst-sp-2) var(--rst-sp-2); }
[fichas-rail-foot] { margin-block-start: auto; display: grid; }
[fichas-kbd], [fichas-keys-dialog] kbd {
font: inherit;
font-size: var(--rst-fs-xs);
- padding: 0 5px;
+ padding: 0 var(--rst-sp-1);
border: 1px solid var(--rst-line);
border-radius: 4px;
color: var(--rst-text-muted);
@@ -115,7 +117,7 @@
}
[fichas-keys-dialog]::backdrop { background: rgb(15 20 30 / 0.35); }
[fichas-keys-dialog] h2 { margin-block: 0 var(--rst-sp-3); font-size: var(--rst-fs-lg); }
-[fichas-keys-list] { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 var(--rst-sp-4); }
+[fichas-keys-list] { display: grid; grid-template-columns: auto 1fr; gap: var(--rst-sp-2) var(--rst-sp-4); margin: 0 0 var(--rst-sp-4); }
[fichas-keys-list] dt { white-space: nowrap; }
[fichas-keys-list] dd { margin: 0; color: var(--rst-text-muted); }
diff --git a/internal/fichas/static/grid.css b/internal/fichas/static/grid.css
index 91cfa4f..83972dc 100644
--- a/internal/fichas/static/grid.css
+++ b/internal/fichas/static/grid.css
@@ -22,14 +22,13 @@
[fichas-out-of-view] {
display: inline-flex;
align-items: center;
- gap: 4px;
- margin-inline-start: 8px;
+ gap: var(--rst-sp-1);
+ margin-inline-start: var(--rst-sp-2);
font-size: var(--rst-fs-xs);
font-weight: 500;
color: var(--rst-text-muted);
}
[fichas-out-of-view] > .icon { inline-size: 12px; block-size: 12px; }
-[fichas-grid-help] { margin-block-start: var(--rst-sp-2); }
/* The editor floats over its cell, at least as wide, so the table never
reflows under the person typing. */
@@ -49,7 +48,7 @@
block-size: 100%;
min-block-size: 2.25rem;
border: 0;
- padding: 0 12px;
+ padding: 0 var(--rst-sp-3);
font: inherit;
font-size: max(16px, 1em);
color: var(--rst-text);
@@ -63,14 +62,14 @@
inset-inline-start: 0;
z-index: 4;
min-inline-size: 14rem;
- padding: 6px 10px;
+ padding: var(--rst-sp-2) var(--rst-sp-3);
border-radius: 8px;
background: var(--rst-tone-negative-bg);
color: var(--rst-tone-negative-fg);
font-size: var(--rst-fs-sm);
box-shadow: var(--rst-shadow-pop, 0 8px 20px -8px rgb(0 0 0 / 0.3));
}
-[fichas-editor-error] button { margin-inline-start: 6px; }
+[fichas-editor-error] button { margin-inline-start: var(--rst-sp-2); }
/* A choice's picker: a listbox with a search box (§6.5). */
[fichas-picker] {
@@ -81,14 +80,14 @@
min-inline-size: 14rem;
max-block-size: 18rem;
overflow: auto;
- padding: 6px;
+ padding: var(--rst-sp-1);
border-radius: 12px;
background: var(--rst-surface);
box-shadow: 0 0 0 1px var(--rst-line), var(--rst-shadow-pop, 0 14px 30px -12px rgb(0 0 0 / 0.35));
}
-[fichas-picker] input { inline-size: 100%; box-sizing: border-box; padding: 6px 10px; border: 1px solid var(--rst-line); border-radius: 8px; font: inherit; font-size: max(16px, 1em); margin-block-end: 4px; background: var(--rst-surface); color: var(--rst-text); }
+[fichas-picker] input { inline-size: 100%; box-sizing: border-box; padding: var(--rst-sp-1) var(--rst-sp-2); border: 1px solid var(--rst-line); border-radius: 8px; font: inherit; font-size: max(16px, 1em); margin-block-end: var(--rst-sp-1); background: var(--rst-surface); color: var(--rst-text); }
[fichas-picker] [role="listbox"] { list-style: none; margin: 0; padding: 0; }
-[fichas-picker] [role="option"] { padding: 6px 10px; border-radius: 8px; cursor: pointer; min-block-size: 32px; display: flex; align-items: center; }
+[fichas-picker] [role="option"] { padding: var(--rst-sp-1) var(--rst-sp-2); border-radius: 8px; cursor: pointer; min-block-size: 32px; display: flex; align-items: center; }
[fichas-picker] [role="option"][aria-selected="true"] { background: var(--rst-accent-soft); }
[fichas-picker] [role="option"][data-current]::after { content: "✓"; margin-inline-start: auto; color: var(--rst-accent); }
@@ -97,16 +96,22 @@
display: grid;
grid-template-columns: 288px minmax(0, 1fr);
gap: 0;
- margin-inline: calc(-1 * var(--rst-px, 24px));
- margin-block-start: calc(-1 * var(--rst-py, 16px));
+ margin-inline: calc(-1 * var(--rst-sp-4));
min-block-size: calc(100dvh - 56px);
}
+/* Flush under the bar on a wide screen: the page's own block-start
+ padding taken back, when nothing (no notice) sits above the split. The
+ split is a child of the page's stack, so this outranks the stack's
+ margin rule. */
+@media (min-width: 800px) {
+ [rst-page] > h1:first-child + [fichas-split-view] { margin-block-start: calc(-1 * var(--rst-sp-5)); }
+}
[fichas-narrow] { border-inline-end: 1px solid var(--rst-line); min-inline-size: 0; }
[fichas-narrow-head] {
display: flex;
align-items: center;
- gap: 8px;
- padding: 12px 14px;
+ gap: var(--rst-sp-2);
+ padding: var(--rst-sp-3) var(--rst-sp-4);
border-block-end: 1px solid var(--rst-line);
font-weight: 600;
position: sticky;
@@ -121,8 +126,8 @@
[fichas-narrow-list] { list-style: none; margin: 0; padding: 0; }
[fichas-narrow-list] a {
display: grid;
- gap: 4px;
- padding: 12px 14px;
+ gap: var(--rst-sp-1);
+ padding: var(--rst-sp-3) var(--rst-sp-4);
border-block-end: 1px solid var(--rst-line);
border-inline-start: 3px solid transparent;
color: var(--rst-text);
@@ -130,36 +135,40 @@
}
[fichas-narrow-list] a:hover { background: var(--rst-surface-2); }
[fichas-narrow-list] a[aria-current] { background: var(--rst-accent-soft); border-inline-start-color: var(--rst-accent); }
-[fichas-narrow-face] { display: flex; align-items: center; gap: 8px; font-size: var(--rst-fs-sm); }
-[fichas-pane] { padding: 20px clamp(16px, 3vw, 40px) 40px; min-inline-size: 0; }
+[fichas-narrow-face] { display: flex; align-items: center; gap: var(--rst-sp-2); font-size: var(--rst-fs-sm); }
+[fichas-pane] { padding: var(--rst-sp-5) var(--rst-sp-5) var(--rst-sp-6); min-inline-size: 0; }
[fichas-full-card] { max-inline-size: 64rem; }
-[fichas-card-top] { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-end: 12px; }
-[fichas-card-steps] { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; }
+[fichas-card-top] { display: flex; align-items: center; gap: var(--rst-sp-2); flex-wrap: wrap; }
+[fichas-card-steps] { display: flex; align-items: center; gap: var(--rst-sp-2); margin-inline-end: auto; }
[fichas-card-close] { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 36px; min-block-size: 36px; border-radius: 999px; color: var(--rst-text-muted); }
[fichas-card-close]:hover { background: var(--rst-surface-2); color: var(--rst-text); }
-[fichas-card-form] { display: grid; gap: 14px; }
-[fichas-card-heading] { margin: 0; }
-[fichas-card-meta] { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--rst-text-muted); font-size: var(--rst-fs-sm); padding-block-end: 14px; border-block-end: 1px solid var(--rst-line); }
-[fichas-not-in-view] { display: inline-flex; align-items: center; gap: 4px; }
+[fichas-card-meta] { display: flex; flex-wrap: wrap; gap: var(--rst-sp-1) var(--rst-sp-4); color: var(--rst-text-muted); font-size: var(--rst-fs-sm); padding-block-end: var(--rst-sp-3); border-block-end: 1px solid var(--rst-line); }
+[fichas-not-in-view] { display: inline-flex; align-items: center; gap: var(--rst-sp-1); }
[fichas-not-in-view] > .icon { inline-size: 14px; block-size: 14px; }
-[fichas-card-fields] { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 14px 24px; }
+[fichas-card-fields] { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--rst-sp-3) var(--rst-sp-5); }
+/* The card's form is a stack, which spaces its blocks; it and its title
+ are also grid.js's hooks. The form never widens the card past the
+ pane, and the title has no margin of its own, in a stack or out. */
+[fichas-card-form] { min-inline-size: 0; }
+[fichas-card-heading] { margin: 0; }
[fichas-card-long] { display: grid; }
-[fichas-card-save] { display: flex; justify-content: flex-end; }
+[fichas-card-save] { justify-content: flex-end; }
/* With script each field saves on its own, so the form's button goes. */
[data-fichas-live] [fichas-card-save] { display: none; }
-[fichas-card-log] { margin-block-start: 28px; display: grid; gap: 10px; max-inline-size: 44rem; }
-[fichas-card-log] h3 { margin: 0; font-size: var(--rst-fs-lg); }
+[fichas-card-log] { max-inline-size: 44rem; }
+[fichas-card-log] h3 { font-size: var(--rst-fs-lg); }
/* Quiet inputs: a field that reads as text until it is touched (§5.1). */
-[fichas-quiet-field] { display: grid; gap: 4px; min-inline-size: 0; }
+[fichas-quiet-field] { display: grid; gap: var(--rst-sp-1); min-inline-size: 0; }
[fichas-quiet-label] { font-size: var(--rst-fs-sm); font-weight: 600; color: var(--rst-text-muted); }
[fichas-quiet] {
inline-size: 100%;
box-sizing: border-box;
min-block-size: 36px;
- padding: 6px 8px;
- margin-inline: -8px;
+ padding: var(--rst-sp-1) var(--rst-sp-2);
+ /* the padding taken back, so the value's text sits under its label */
+ margin-inline: calc(-1 * var(--rst-sp-2));
border: 1px solid transparent;
border-radius: 8px;
background: transparent;
@@ -185,9 +194,8 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
[fichas-notice] {
display: flex;
align-items: center;
- gap: 12px;
- margin-block-end: var(--rst-sp-3);
- padding: 8px 12px;
+ gap: var(--rst-sp-3);
+ padding: var(--rst-sp-2) var(--rst-sp-3);
border-radius: 10px;
background: var(--rst-surface-2);
font-size: var(--rst-fs-sm);
@@ -200,7 +208,7 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
inset-inline: 0;
display: grid;
justify-items: center;
- gap: 8px;
+ gap: var(--rst-sp-2);
pointer-events: none;
z-index: 40;
}
@@ -208,9 +216,9 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
pointer-events: auto;
display: flex;
align-items: center;
- gap: 14px;
+ gap: var(--rst-sp-3);
max-inline-size: min(36rem, calc(100vw - 32px));
- padding: 10px 12px 10px 16px;
+ padding: var(--rst-sp-2) var(--rst-sp-3) var(--rst-sp-2) var(--rst-sp-4);
border-radius: 12px;
background: var(--rst-text);
color: var(--rst-bg);
@@ -220,7 +228,7 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
[fichas-toast] button {
border: 0;
border-radius: 8px;
- padding: 6px 10px;
+ padding: var(--rst-sp-1) var(--rst-sp-2);
min-block-size: 32px;
background: color-mix(in srgb, var(--rst-bg) 16%, transparent);
color: inherit;
@@ -230,22 +238,21 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
}
/* ---- History (§5.5), the edit form's conflicts, and page heads. */
-[fichas-page-head] { margin-block-end: var(--rst-sp-4); }
-[fichas-page-head] h1 { margin: 0 0 4px; }
-[fichas-page-head] a { display: inline-flex; align-items: center; gap: 4px; color: var(--rst-text-muted); }
+[fichas-page-head] h1 { margin: 0 0 var(--rst-sp-1); }
+[fichas-page-head] a { display: inline-flex; align-items: center; gap: var(--rst-sp-1); color: var(--rst-text-muted); }
[fichas-history] { list-style: none; margin: 0; padding: 0; display: grid; max-inline-size: 48rem; }
-[fichas-history-item] { padding-block: 14px; border-block-end: 1px solid var(--rst-line); display: grid; gap: 8px; }
+[fichas-history-item] { padding-block: var(--rst-sp-3); border-block-end: 1px solid var(--rst-line); display: grid; gap: var(--rst-sp-2); }
[fichas-history-head] { margin: 0; }
-[fichas-history-head] time { color: var(--rst-text-muted); margin-inline-start: 6px; font-size: var(--rst-fs-sm); }
-[fichas-history-values] { display: grid; grid-template-columns: minmax(6rem, auto) 1fr; gap: 6px 16px; margin: 0; font-size: var(--rst-fs-sm); }
+[fichas-history-head] time { color: var(--rst-text-muted); margin-inline-start: var(--rst-sp-1); font-size: var(--rst-fs-sm); }
+[fichas-history-values] { display: grid; grid-template-columns: minmax(6rem, auto) 1fr; gap: var(--rst-sp-2) var(--rst-sp-4); margin: 0; font-size: var(--rst-fs-sm); }
[fichas-history-values] dt { color: var(--rst-text-muted); font-weight: 600; }
-[fichas-history-values] dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
+[fichas-history-values] dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--rst-sp-1) var(--rst-sp-2); }
[fichas-history-before] { text-decoration: line-through; color: var(--rst-text-muted); }
[fichas-history-after] { font-weight: 600; }
[fichas-restore] { display: inline; }
-[fichas-conflict] { border: 1px solid var(--rst-line); border-radius: 12px; padding: 12px 16px; margin: 0 0 var(--rst-sp-4); display: grid; gap: 8px; }
-[fichas-conflict] legend { font-weight: 600; padding-inline: 4px; }
-[fichas-conflict-choice] { display: flex; align-items: center; gap: 8px; min-block-size: 32px; }
+[fichas-conflict] { border: 1px solid var(--rst-line); border-radius: 12px; padding: var(--rst-sp-3) var(--rst-sp-4); margin: 0; display: grid; gap: var(--rst-sp-2); }
+[fichas-conflict] legend { font-weight: 600; padding-inline: var(--rst-sp-1); }
+[fichas-conflict-choice] { display: flex; align-items: center; gap: var(--rst-sp-2); min-block-size: 32px; }
/* ---- Phones (§5.8): the table is a list of rows; a card is its own
screen with ‹ ›; a value opens a sheet. Inputs are at least 16px, so
@@ -258,8 +265,8 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
display: grid;
grid-template-columns: auto minmax(0, 1fr) auto;
align-items: center;
- column-gap: 16px;
- padding: 6px 4px;
+ column-gap: var(--rst-sp-4);
+ padding: var(--rst-sp-1);
border-block-end: 1px solid var(--rst-line);
}
[fichas-grid] :is(th, td) { display: none; padding: 0; border: 0; background: none; }
@@ -269,11 +276,11 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
[fichas-grid] td[data-kind="enum"] { display: block; grid-column: 3; grid-row: 1; justify-self: end; }
[fichas-grid] td[data-field]:not([data-kind="enum"]):nth-child(-n+3) { display: block; grid-row: 2; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); }
[fichas-grid] [fichas-cell-link] { display: flex; align-items: center; min-block-size: 44px; }
- [fichas-grid-help] { padding-inline: 4px; }
+ [fichas-grid-help] { padding-inline: var(--rst-sp-1); }
[fichas-split-view] { display: block; margin: 0; }
[fichas-narrow] { display: none; }
- [fichas-pane] { padding: 4px 0 32px; }
+ [fichas-pane] { padding: var(--rst-sp-1) 0 var(--rst-sp-6); }
[fichas-card-fields] { grid-template-columns: 1fr; }
[fichas-card-top] [rst-btn] { min-block-size: 44px; }
[fichas-card-steps] [fichas-meta] { display: none; }
@@ -289,15 +296,15 @@ textarea[fichas-quiet] { resize: vertical; line-height: 1.5; }
box-sizing: border-box;
border: 0;
border-radius: 18px 18px 0 0;
- padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
+ padding: var(--rst-sp-4) var(--rst-sp-4) calc(var(--rst-sp-4) + env(safe-area-inset-bottom));
background: var(--rst-surface);
color: var(--rst-text);
box-shadow: 0 -18px 40px -18px rgb(0 0 0 / 0.4);
}
[fichas-sheet]::backdrop { background: rgb(15 20 30 / 0.35); }
-[fichas-sheet] form { display: grid; gap: 12px; }
+[fichas-sheet] form { display: grid; gap: var(--rst-sp-3); }
[fichas-sheet] label { font-weight: 600; }
-[fichas-sheet] :is(input, select) { min-block-size: 44px; font-size: 16px; padding: 0 12px; border: 1px solid var(--rst-line); border-radius: 10px; background: var(--rst-surface); color: var(--rst-text); font-family: inherit; }
-[fichas-sheet-foot] { display: flex; justify-content: flex-end; gap: 8px; }
+[fichas-sheet] :is(input, select) { min-block-size: 44px; font-size: 16px; padding: 0 var(--rst-sp-3); border: 1px solid var(--rst-line); border-radius: 10px; background: var(--rst-surface); color: var(--rst-text); font-family: inherit; }
+[fichas-sheet-foot] { display: flex; justify-content: flex-end; gap: var(--rst-sp-2); }
[fichas-sheet-foot] button { min-block-size: 44px; }
[fichas-sheet-error] { color: var(--rst-tone-negative-fg); margin: 0; font-size: var(--rst-fs-sm); }
diff --git a/internal/fichas/static/menu.css b/internal/fichas/static/menu.css
index 9070652..eb420e2 100644
--- a/internal/fichas/static/menu.css
+++ b/internal/fichas/static/menu.css
@@ -5,9 +5,9 @@
in the page flow, so it is square (the suite's square rule). */
:root {
--estilo-float-radius: 9px; /* rastrillo's hard-coded dropdown value, named. PUBLIC */
- --estilo-float-padding: 0.25rem;
- --estilo-item-padding-block: 0.4rem;
- --estilo-item-padding-inline: 0.65rem;
+ --estilo-float-padding: var(--rst-sp-1);
+ --estilo-item-padding-block: var(--rst-sp-1);
+ --estilo-item-padding-inline: var(--rst-sp-3);
}
[estilo-menu] {
box-sizing: border-box;
@@ -46,7 +46,7 @@
[estilo-menu-item] {
display: flex;
align-items: center;
- gap: 0.5rem;
+ gap: var(--rst-sp-2);
box-sizing: border-box;
inline-size: 100%;
min-block-size: 2rem;
@@ -88,7 +88,7 @@
[estilo-menu-key] {
flex: none;
margin-inline-start: auto;
- padding-inline-start: 1.5rem;
+ padding-inline-start: var(--rst-sp-5);
color: var(--rst-text-muted);
font: inherit;
font-size: var(--rst-fs-xs);
@@ -98,11 +98,11 @@
[estilo-menu] hr {
border: 0;
border-block-start: 1px solid var(--rst-line);
- margin: 0.25rem 0;
+ margin: var(--rst-sp-1) 0;
}
[estilo-menu-heading] {
margin: 0;
- padding: 0.5rem var(--estilo-item-padding-inline) 0.25rem;
+ padding: var(--rst-sp-2) var(--estilo-item-padding-inline) var(--rst-sp-1);
color: var(--rst-text-muted);
font-size: var(--rst-fs-xs);
font-weight: 600; /* no text-transform */
@@ -124,7 +124,7 @@
box-sizing: border-box;
block-size: 100%;
min-block-size: 2rem;
- padding-inline: 0.6rem;
+ padding-inline: var(--rst-sp-2);
border-radius: 0; /* square: in-flow */
color: var(--rst-text);
font-size: var(--rst-fs-sm);
diff --git a/internal/fichas/static/tokens.css b/internal/fichas/static/tokens.css
index 3ae9664..07f8b10 100644
--- a/internal/fichas/static/tokens.css
+++ b/internal/fichas/static/tokens.css
@@ -2476,6 +2476,90 @@ small.rst-field__hint, small[rst-field-hint] { display: block; font-size: var(--
and every caller writes by hand, is rst-form-bar now. */
.rst-form-foot, [rst-form-foot] { display: flex; gap: var(--rst-sp-3); margin-block-start: var(--rst-sp-3); }
+/* ── stack: a page's vertical rhythm ──────────────────────────────────
+ The blocks a screen is written in, a heading, a paragraph, a hint, a
+ card, a row of buttons, are spaced by the stack they sit in and by
+ nothing else. Hand-rolled margins gave every screen its own rhythm:
+ a heading further from its own text than from the section before
+ it, a hint resting on the button under it. So a stack is a flex
+ column, where no margin collapses, every child's own block margins
+ are zeroed, and the space before each child is read off one table
+ by what it is and what it follows (DESIGN.md, "Spacing"):
+
+ after a heading (h1 to h6) --rst-sp-2
+ before an actions row, a button --rst-sp-4
+ a label or hint, then its input, or an
+ input, then its hint --rst-sp-2
+ before h1, h2 or a section, or after
+ the page header --rst-sp-5
+ before h3 to h6 --rst-sp-4
+ anything else --rst-sp-3
+
+ Higher in the table wins. Each relation sets its own custom property
+ on the child, and the one margin rule reads them in the table's
+ order through var() fallbacks, so which rule wins is written in one
+ place rather than left to specificity. Every child resets all five
+ first, so a nested stack's child never inherits its parent's answer.
+ rst-section marks a child that opens a new section; a section that
+ holds blocks of its own is a stack too, <section rst-stack
+ rst-section>.
+
+ The column's gap is the table's smallest step, --rst-sp-2, and a
+ child's block-start margin is the rest of its answer. The gap is
+ the floor: it falls only between children that are drawn, so a
+ [hidden] child, which a sibling selector cannot see past, costs the
+ block after it its relation but never leaves it touching. A hidden
+ input, a form's CSRF field, is passed over the same way, so the
+ first block after one still opens the stack flush. */
+.rst-stack, [rst-stack] { display: flex; flex-direction: column; gap: var(--rst-sp-2); }
+.rst-stack > :not([hidden]), [rst-stack] > :not([hidden]) {
+ --rst-stack-actions: initial;
+ --rst-stack-heading: initial;
+ --rst-stack-control: initial;
+ --rst-stack-section: initial;
+ --rst-stack-sub: initial;
+ margin-block: 0;
+}
+.rst-stack > :not([hidden], [type="hidden"]) + :not([hidden]), [rst-stack] > :not([hidden], [type="hidden"]) + :not([hidden]) {
+ margin-block-start: calc(var(--rst-stack-heading, var(--rst-stack-actions, var(--rst-stack-control, var(--rst-stack-section, var(--rst-stack-sub, var(--rst-sp-3)))))) - var(--rst-sp-2));
+}
+/* A column stretches its children across; a button or a picture keeps
+ its own width. */
+.rst-stack > button, [rst-stack] > button, .rst-stack > .rst-btn, [rst-stack] > [rst-btn], .rst-stack > img, [rst-stack] > img { align-self: flex-start; }
+.rst-stack > :not([hidden], [type="hidden"]) + h3, [rst-stack] > :not([hidden], [type="hidden"]) + h3,
+.rst-stack > :not([hidden], [type="hidden"]) + h4, [rst-stack] > :not([hidden], [type="hidden"]) + h4,
+.rst-stack > :not([hidden], [type="hidden"]) + h5, [rst-stack] > :not([hidden], [type="hidden"]) + h5,
+.rst-stack > :not([hidden], [type="hidden"]) + h6, [rst-stack] > :not([hidden], [type="hidden"]) + h6 { --rst-stack-sub: var(--rst-sp-4); }
+.rst-stack > :not([hidden], [type="hidden"]) + h1, [rst-stack] > :not([hidden], [type="hidden"]) + h1,
+.rst-stack > :not([hidden], [type="hidden"]) + h2, [rst-stack] > :not([hidden], [type="hidden"]) + h2,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-section, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-section],
+.rst-stack > .rst-page-header + :not([hidden]), [rst-stack] > [rst-page-header] + :not([hidden]) { --rst-stack-section: var(--rst-sp-5); }
+.rst-stack > label + input:not([hidden]), [rst-stack] > label + input:not([hidden]),
+.rst-stack > label + select:not([hidden]), [rst-stack] > label + select:not([hidden]),
+.rst-stack > label + textarea:not([hidden]), [rst-stack] > label + textarea:not([hidden]),
+.rst-stack > .rst-field__help + input:not([hidden]), [rst-stack] > [rst-field-help] + input:not([hidden]),
+.rst-stack > .rst-field__help + select:not([hidden]), [rst-stack] > [rst-field-help] + select:not([hidden]),
+.rst-stack > .rst-field__help + textarea:not([hidden]), [rst-stack] > [rst-field-help] + textarea:not([hidden]),
+.rst-stack > input + .rst-field__help, [rst-stack] > input + [rst-field-help],
+.rst-stack > select + .rst-field__help, [rst-stack] > select + [rst-field-help],
+.rst-stack > textarea + .rst-field__help, [rst-stack] > textarea + [rst-field-help] { --rst-stack-control: var(--rst-sp-2); }
+.rst-stack > h1 + :not([hidden]), [rst-stack] > h1 + :not([hidden]),
+.rst-stack > h2 + :not([hidden]), [rst-stack] > h2 + :not([hidden]),
+.rst-stack > h3 + :not([hidden]), [rst-stack] > h3 + :not([hidden]),
+.rst-stack > h4 + :not([hidden]), [rst-stack] > h4 + :not([hidden]),
+.rst-stack > h5 + :not([hidden]), [rst-stack] > h5 + :not([hidden]),
+.rst-stack > h6 + :not([hidden]), [rst-stack] > h6 + :not([hidden]) { --rst-stack-heading: var(--rst-sp-2); }
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-foot, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-foot],
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-form-actions, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-form-actions],
+.rst-stack > :not([hidden], [type="hidden"]) + button, [rst-stack] > :not([hidden], [type="hidden"]) + button,
+.rst-stack > :not([hidden], [type="hidden"]) + .rst-btn, [rst-stack] > :not([hidden], [type="hidden"]) + [rst-btn] { --rst-stack-actions: var(--rst-sp-4); }
+/* The actions row: buttons, links styled as buttons, and the one-button
+ forms a POST action needs, side by side and wrapping on a phone. A
+ form stays a box (display: contents would make it one no driver can
+ see), and a one-button form is as wide as its button. */
+.rst-actions, [rst-actions] { align-items: center; display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); }
+
@media (prefers-reduced-motion: reduce) {
.rst-switch__track, [rst-switch-track], .rst-switch[data-rst-settle] .rst-switch__track, [rst-switch][data-rst-settle] [rst-switch-track], .rst-tblock > .rst-tblock__head[data-rst-settle] > .rst-switch__track, [rst-tblock] > [rst-tblock-head][data-rst-settle] > [rst-switch-track] { transition: none; }
}
diff --git a/internal/fichas/templates/card_edit.html b/internal/fichas/templates/card_edit.html
index 64de5fb..12f96e4 100644
--- a/internal/fichas/templates/card_edit.html
+++ b/internal/fichas/templates/card_edit.html
@@ -10,10 +10,14 @@
{{/* The scriptless edit form (§5.2, §5.7): was rides beside every field,
and only the fields whose value differs from it are changed. After a
conflict, each conflicting field offers theirs and mine. */}}
-<form method="post" action="/cards/{{$c.Card.ID}}" fichas-form novalidate>
+<form method="post" action="/cards/{{$c.Card.ID}}" fichas-form rst-stack novalidate>
<input type="hidden" name="return_to" value="{{.ReturnTo}}">
+ {{/* Every was first, beside return_to: a hidden input between two
+ fields hides the first from the stack's rule, and the second would
+ sit at the stack's 8px gap, not a field's 12px. */}}
+ {{range $f := $c.Fields}}<input type="hidden" name="was.{{$f.Def.Key}}" value="{{index $.Was $f.Def.Key}}">
+ {{end}}
{{range $f := $c.Fields}}
- <input type="hidden" name="was.{{$f.Def.Key}}" value="{{index $.Was $f.Def.Key}}">
{{with index $.Conflicts $f.Def.Key}}
<fieldset fichas-conflict id="{{$f.Def.Key}}">
<legend>{{$f.Label}}</legend>
@@ -28,7 +32,7 @@
{{template "form-foot" (dict "Submit" "Save changes" "CancelHref" .ReturnTo "CancelLabel" "Cancel")}}
</form>
-<div fichas-danger-zone>
+<div fichas-danger-zone rst-stack rst-section>
<a rst-btn="danger" href="/cards/{{$c.Card.ID}}/delete">Delete this {{lower $c.TypeLabel}}…</a>
<p fichas-meta>Opens a confirmation page. The change log keeps who deleted it.</p>
</div>
diff --git a/internal/fichas/templates/card_layout.html b/internal/fichas/templates/card_layout.html
index 0c8edad..be0ea00 100644
--- a/internal/fichas/templates/card_layout.html
+++ b/internal/fichas/templates/card_layout.html
@@ -4,7 +4,7 @@
<h1 fichas-appbar-title>Arrange the {{.Type.Label}} card <span>what each card shows in Cards view</span></h1>
</header>
<form method="post" action="/t/{{.TypeKey}}/layout" fichas-layout-editor>
- <div>
+ <div rst-stack>
<fieldset fichas-checklist>
<legend>Show on the card</legend>
{{range .Options}}
@@ -16,7 +16,7 @@
<p fichas-meta>The first Choice you show sits beside the title as a status.</p>
{{template "form-foot" (dict "Submit" "Save card layout" "CancelHref" (printf "/t/%s?view=cards" .TypeKey) "CancelLabel" "Cancel")}}
</div>
- <aside>
+ <aside rst-stack>
<p fichas-meta>Current layout, on your most recent card</p>
{{with .Preview}}{{$face := .Face $.Face}}
<ul fichas-card-grid><li><article rst-card>
diff --git a/internal/fichas/templates/card_new.html b/internal/fichas/templates/card_new.html
index 6557565..0d07b40 100644
--- a/internal/fichas/templates/card_new.html
+++ b/internal/fichas/templates/card_new.html
@@ -4,7 +4,7 @@
<h1 fichas-appbar-title>Add a {{lower .Type.Label}}</h1>
</header>
-<form method="post" action="/cards" fichas-form novalidate>
+<form method="post" action="/cards" fichas-form rst-stack novalidate>
<input type="hidden" name="type" value="{{.TypeKey}}">
{{range $i, $f := .Fields}}{{template "fichas-input" (dict "F" $f "Error" (errFor $.Errors $f.Def.Key) "Autofocus" (eq $i 0) "L" $.L)}}{{end}}
{{template "form-foot" (dict "Submit" (printf "Save this %s" (lower .Type.Label)) "CancelHref" (printf "/t/%s" .TypeKey) "CancelLabel" "Cancel")}}
diff --git a/internal/fichas/templates/contract_prepare.html b/internal/fichas/templates/contract_prepare.html
index 4375806..65ae6f0 100644
--- a/internal/fichas/templates/contract_prepare.html
+++ b/internal/fichas/templates/contract_prepare.html
@@ -1,9 +1,9 @@
{{define "title"}}Prepare contract · Fichas{{end}}
{{define "content"}}
<header fichas-appbar><h1 fichas-appbar-title>Prepare a contract <span>Selected customer details → Oficina Docs</span></h1></header>
-<div rst-box>
+<div rst-box rst-stack>
{{if eq .Phase "choose"}}<h2>Choose a live customer</h2><p>Select the customer whose details belong in this agreement.</p>{{range .Cards}}<p><a rst-btn href="/contracts/prepare?flow={{$.Flow}}&amp;card={{.Card.ID}}">{{.Title}} →</a></p>{{else}}<p>No customer cards are available.</p>{{end}}{{end}}
-{{if eq .Phase "fields"}}<h2>{{.Card.Title}}</h2><p>Choose the fields to use. Notes and call entries are not included automatically.</p><form method="post" action="/contracts/review"><input type="hidden" name="flow" value="{{.Flow}}"><input type="hidden" name="card" value="{{.Card.Card.ID}}"><input type="hidden" name="revision" value="{{.Card.Card.Revision}}">
+{{if eq .Phase "fields"}}<h2>{{.Card.Title}}</h2><p>Choose the fields to use. Notes and call entries are not included automatically.</p><form method="post" action="/contracts/review" rst-stack><input type="hidden" name="flow" value="{{.Flow}}"><input type="hidden" name="card" value="{{.Card.Card.ID}}"><input type="hidden" name="revision" value="{{.Card.Card.Revision}}">
{{range .Card.Fields}}{{if or (eq .Def.Kind "text") (eq .Def.Kind "date") (eq .Def.Kind "email") (eq .Def.Kind "phone")}}<p><label><input type="checkbox" name="field" value="{{.Def.Key}}" {{if eq .Def.Key "f_name"}}checked{{end}}> <strong>{{.Label}}</strong> — {{.Value}}</label></p>{{end}}{{end}}
<button rst-btn="primary">Review selected details →</button></form>{{end}}
{{if eq .Phase "review"}}<h2>Approve these details for your contract</h2><dl rst-detail>{{range .Release.Fields}}<dt>{{.Label}}</dt><dd>{{.Value}}</dd>{{end}}</dl><p>Destination: <strong>{{.Destination}}</strong><br>Importer and signer: <strong>{{.Importer}}</strong><br>Source revision: {{.Release.Revision}}</p><p>This authorises these selected values for one contract you sign yourself. Docs must issue it within 30 minutes. Later edits or deletion in Fichas will not retract this approved copy. There is no external-recipient access in this pilot.</p><p>Issued demo records are available for seven days. Existing encrypted backups follow the app’s backup policy; deletion from this screen cannot recall downloaded copies or guarantee backup erasure.</p><form method="post" action="/contracts/approve"><input type="hidden" name="payload" value="{{.Payload}}"><input type="hidden" name="signature" value="{{.Signature}}"><button rst-btn="primary">Approve these details</button></form>{{end}}
diff --git a/internal/fichas/templates/field_edit.html b/internal/fichas/templates/field_edit.html
index b78b552..14527b5 100644
--- a/internal/fichas/templates/field_edit.html
+++ b/internal/fichas/templates/field_edit.html
@@ -3,7 +3,7 @@
<header fichas-appbar>
<h1 fichas-appbar-title>Edit {{.Field.Label}} <span>{{.Type.Plural}}</span></h1>
</header>
-<form method="post" action="/fields/{{.Field.Def.Key}}" fichas-form>
+<form method="post" action="/fields/{{.Field.Def.Key}}" fichas-form rst-stack>
{{template "field" (dict "ID" "label" "Name" "label" "Label" "Field name" "Value" .Label "Required" true "Error" (errFor .Errors "label"))}}
{{if eq .Field.Def.Kind "enum"}}
{{template "field-textarea" (dict "Name" "options" "Label" "Options" "Value" .Options "Rows" 6 "Hint" "one per line" "Error" (errFor .Errors "options"))}}
diff --git a/internal/fichas/templates/field_new.html b/internal/fichas/templates/field_new.html
index 66a49b5..74615e2 100644
--- a/internal/fichas/templates/field_new.html
+++ b/internal/fichas/templates/field_new.html
@@ -3,7 +3,7 @@
<header fichas-appbar>
<h1 fichas-appbar-title>Add a field <span>to {{.Type.Plural}}</span></h1>
</header>
-<form method="post" action="/t/{{.TypeKey}}/fields" fichas-form>
+<form method="post" action="/t/{{.TypeKey}}/fields" fichas-form rst-stack>
{{template "field" (dict "ID" "label" "Name" "label" "Label" "Field name" "Value" (index .Form "label") "Placeholder" "e.g. Contract value" "Required" true "Autofocus" true "Error" (errFor .Errors "label"))}}
{{template "choice-field" (dict "Legend" "What kind of value" "Name" "kind" "Options" (list
(dict "Value" "text" "Title" "Text" "Desc" "A name, a reference, a short note." "Checked" (eq (index .Form "kind") "text"))
diff --git a/internal/fichas/templates/index.html b/internal/fichas/templates/index.html
index fb2cedf..b12fbfb 100644
--- a/internal/fichas/templates/index.html
+++ b/internal/fichas/templates/index.html
@@ -46,7 +46,7 @@
<div id="list-filters" data-live-region>{{range .Filters}}{{template "dropdown" .}}{{end}}</div>
</div>
-<div id="results" data-live-results data-live-region>
+<div id="results" rst-stack data-live-results data-live-region>
{{if .Cards}}
{{if eq .View "table"}}{{template "fichas-table" .}}
{{else}}
diff --git a/internal/fichas/templates/partials.html b/internal/fichas/templates/partials.html
index a182a0a..c326b72 100644
--- a/internal/fichas/templates/partials.html
+++ b/internal/fichas/templates/partials.html
@@ -150,7 +150,7 @@
as quiet inputs, its long text, and the call log. Keys: P (cardPane),
L, Here, EntryFields, Errors, Pane (bool: beside the list). */}}
{{define "fichas-card"}}{{$c := .P.Card}}{{$L := .L}}
-<article fichas-card-view data-card="{{$c.Card.ID}}" aria-labelledby="card-title-{{$c.Card.ID}}">
+<article fichas-card-view rst-stack data-card="{{$c.Card.ID}}" aria-labelledby="card-title-{{$c.Card.ID}}">
{{if .Pane}}<div fichas-card-top>
<div fichas-card-steps>
{{with .P.PrevHref}}<a rst-btn="sm" rel="prev" href="{{.}}" data-fichas-step="prev">{{icon "chevron-left"}}Previous</a>{{end}}
@@ -161,7 +161,7 @@
<a rst-btn="sm" href="/cards/{{$c.Card.ID}}/history">{{icon "history"}}History</a>
<a fichas-card-close href="{{.P.CloseHref}}" aria-label="Close the card" aria-keyshortcuts="Escape" data-fichas-close>{{icon "x"}}</a>
</div>{{end}}
- <form method="post" action="/cards/{{$c.Card.ID}}" fichas-card-form data-card="{{$c.Card.ID}}" novalidate>
+ <form method="post" action="/cards/{{$c.Card.ID}}" fichas-card-form rst-stack data-card="{{$c.Card.ID}}" novalidate>
<input type="hidden" name="return_to" value="{{.Here}}">
{{range $c.Fields}}{{if $c.IsTitle .Def.Key}}
<input type="hidden" name="was.{{.Def.Key}}" value="{{.Value}}">
@@ -177,11 +177,11 @@
{{range $c.Fields}}{{if and (not ($c.IsTitle .Def.Key)) (not (isLong .Def))}}{{template "fichas-quiet" (dict "F" . "L" $L "Error" (errFor $.Errors .Def.Key))}}{{end}}{{end}}
</div>
{{range $c.Fields}}{{if and (not ($c.IsTitle .Def.Key)) (isLong .Def)}}<div fichas-card-long>{{template "fichas-quiet" (dict "F" . "L" $L "Error" (errFor $.Errors .Def.Key))}}</div>{{end}}{{end}}
- <div fichas-card-save><button rst-btn="primary" type="submit">Save changes</button></div>
+ <div fichas-card-save rst-actions><button rst-btn="primary" type="submit">Save changes</button></div>
</form>
- <section fichas-card-log aria-labelledby="call-log-{{$c.Card.ID}}">
+ <section fichas-card-log rst-stack rst-section aria-labelledby="call-log-{{$c.Card.ID}}">
<h3 id="call-log-{{$c.Card.ID}}">Call log</h3>
- <form method="post" action="/cards/{{$c.Card.ID}}/entries">
+ <form method="post" action="/cards/{{$c.Card.ID}}/entries" rst-stack>
<input type="hidden" name="return_to" value="{{.Here}}">
{{range $f := .EntryFields}}{{if eq $f.Def.Key "f_body"}}
{{template "field-textarea" (dict "Name" $f.Def.Key "Label" "Log a call" "Rows" 2 "Value" $f.Value "Error" (errFor $.Errors $f.Def.Key) "Hint" "⌘↩ to save")}}
diff --git a/internal/fichas/templates/shell.html b/internal/fichas/templates/shell.html
index bffa1dd..b8a3be6 100644
--- a/internal/fichas/templates/shell.html
+++ b/internal/fichas/templates/shell.html
@@ -43,7 +43,7 @@
<div fichas-app{{with .Rail}} data-rail="{{.}}"{{end}}>
{{template "fichas-rail" .}}
<main fichas-main id="main">
-<div rst-page>
+<div rst-page rst-stack>
{{template "content" .}}
</div>
</main>
diff --git a/internal/fichas/templates/type_new.html b/internal/fichas/templates/type_new.html
index 1a34334..9a051a6 100644
--- a/internal/fichas/templates/type_new.html
+++ b/internal/fichas/templates/type_new.html
@@ -3,7 +3,7 @@
<header fichas-appbar>
<h1 fichas-appbar-title>New type <span>a new kind of card</span></h1>
</header>
-<form method="post" action="/types" fichas-form>
+<form method="post" action="/types" fichas-form rst-stack>
{{template "field" (dict "ID" "label" "Name" "label" "Label" "One of them is called" "Value" (index .Form "label") "Placeholder" "Supplier" "Required" true "Autofocus" true "Error" (errFor .Errors "label"))}}
{{template "field" (dict "ID" "plural" "Name" "plural" "Label" "A list of them is called" "Value" (index .Form "plural") "Placeholder" "Suppliers" "Hint" "optional" "Error" (errFor .Errors "plural"))}}
<p fichas-meta>It starts with one field, Name. You'll add the rest next.</p>
diff --git a/internal/fichastest/browser_rhythm_test.go b/internal/fichastest/browser_rhythm_test.go
new file mode 100644
index 0000000..824a76f
--- /dev/null
+++ b/internal/fichastest/browser_rhythm_test.go
@@ -0,0 +1,229 @@
+//go:build browser
+
+package fichastest
+
+import (
+ "context"
+ "crypto/ed25519"
+ "crypto/rand"
+ "fmt"
+ "math"
+ "testing"
+ "time"
+
+ "amadan.net/rastrillo/fiesta/check/rhythm"
+ "amadan.net/rastrillo/rastrillo/db"
+ "amadan.net/rastrillo/rastrillo/harness"
+ "github.com/chromedp/chromedp"
+
+ fichas "amadan.net/oficina/fichas/internal/fichas"
+)
+
+// rhythmSkip is what the audit does not read, and it is nothing. The
+// grid's canvas (its rows, cells and editors) is the one region whose
+// spacing is not the page's, and the audit already reads a table as one
+// block, measured against its neighbours but never walked into; an
+// editor or picker floats (position: absolute), which it passes over.
+// Name a region here only if it is a component's internals.
+var rhythmSkip []string
+
+// contractFlow is any well-formed flow: the contract's first two phases
+// (choose a customer, choose its fields) are GETs a signed-in person
+// reaches with one. Its last two need a signed release, so the audit
+// reads the phases a person sees first.
+const contractFlow = "00000000-0000-4000-8000-000000000000"
+
+// rhythmScreen is one state of one screen: the path, what to wait for
+// once it is drawn, whether page scripts run, and an optional step in
+// the page (open Advanced, submit a form) and what to wait for after it.
+type rhythmScreen struct {
+ name, path, ready string
+ noScript bool
+ act, then string
+}
+
+// TestTheScreensKeepTheRhythm: Fiesta's rhythm audit (Paul, 2026-11-22:
+// "Can we somehow put something in place to avoid weird spacing issues
+// like this in future?") over Fichas' own screens: the grid, the cards
+// view, the card beside the list and on its own page (with scripts and
+// without), its History, every form (a card's, a field's, a type's, the
+// card layout, the contract's first two phases) with Advanced open, the
+// choices box shown and the server's errors drawn, at a desktop width
+// and a phone's. Every gap between two blocks is a step of the scale, no
+// text rests on a control, and every heading sits closer to its content
+// than to what comes before.
+//
+// It failed on main before the rhythm swap (95 findings, 2026-11-22):
+// the card's heading, meta line, fields and call log were 14, 28 and
+// 10px apart, and the grid's help line sat 11.2px over the count.
+func TestTheScreensKeepTheRhythm(t *testing.T) {
+ var id int64
+ var empty string
+ // The contract's release is configured, so its pages are mounted.
+ _, key, err := ed25519.GenerateKey(rand.Reader)
+ if err != nil {
+ t.Fatal(err)
+ }
+ release := func(cfg *fichas.Config) {
+ cfg.ContractRelease = &fichas.ContractReleaseConfig{Destination: "https://docs.example.com", Importer: TestOwner, Team: "test-team", Key: key}
+ }
+ rig := browserAppWith(t, release, func(ctx context.Context, d *db.DB, cfg fichas.Config) {
+ m, err := fichas.EnsureMember(ctx, d.G, cfg.Sealer, TestOwner)
+ if err != nil {
+ t.Fatalf("member: %v", err)
+ }
+ ct, err := fichas.CreateType(ctx, d.G, cfg.Sealer, fichas.Person(m.ID), "Supplier", "Suppliers")
+ if err != nil {
+ t.Fatalf("type: %v", err)
+ }
+ empty = ct.Key
+ for i := 0; i < 3; i++ {
+ c, err := fichas.CreateCard(ctx, d.G, cfg.Sealer, fichas.TypeCustomer, fichas.Person(m.ID),
+ map[string]string{fichas.FieldName: fmt.Sprintf("Card %03d", i), fichas.FieldStage: "Lead",
+ fichas.FieldEmail: fmt.Sprintf("c%d@example.com", i), fichas.FieldPhone: "+353 1 555 0142"})
+ if err != nil {
+ t.Fatalf("seed: %v", err)
+ }
+ if i == 0 {
+ id = c.ID
+ if _, err := fichas.AddEntry(ctx, d.G, cfg.Sealer, c.ID, fichas.Person(m.ID), fichas.TypeCallLog, "manual",
+ map[string]string{fichas.FieldBody: "Asked for the renewal quote by Friday."}); err != nil {
+ t.Fatalf("seed entry: %v", err)
+ }
+ }
+ }
+ })
+ card := cardPath(id)
+ split := "/t/t_customer?sort=f_name&card=" + itoa(id)
+ // submit sends a form past the browser's own checks, so the server's
+ // errors are what is drawn.
+ submit := func(form string) string {
+ return `HTMLFormElement.prototype.submit.call(document.querySelector(` + "`" + form + "`" + `))`
+ }
+ screens := []rhythmScreen{
+ {name: "the grid", path: "/t/t_customer?sort=f_name", ready: `[fichas-grid][role="grid"] tbody tr`},
+ {name: "the grid under a notice", path: "/t/t_customer?sort=f_name&saved=1", ready: `[fichas-notice]`},
+ {name: "a type with no cards", path: "/t/" + empty, ready: `[rst-empty]`},
+ {name: "the cards view", path: "/t/t_customer?sort=f_name&view=cards", ready: `[fichas-card-grid]`},
+ {name: "the card beside the list", path: split, ready: `[fichas-pane] form[data-card-ready]`},
+ {name: "the card beside the list, without script", path: split, ready: `[fichas-pane] [fichas-card-save]`, noScript: true},
+ {name: "the card beside the list under a notice", path: split + "&saved=1", ready: `[fichas-pane] form[data-card-ready]`},
+ {name: "the card's page", path: card, ready: `form[data-card-ready]`},
+ {name: "the card's page, without script", path: card, ready: `[fichas-card-save]`, noScript: true},
+ {name: "the card's History", path: card + "/history", ready: `[fichas-history]`},
+ {name: "the card's edit form", path: card + "/edit", ready: `form[fichas-form]`},
+ {name: "the card's edit form, without script", path: card + "/edit", ready: `form[fichas-form]`, noScript: true},
+ {name: "Delete, confirmed", path: card + "/delete", ready: `[fichas-appbar]`},
+ {name: "a new card", path: "/cards/new?type=t_customer", ready: `form[fichas-form]`},
+ {name: "a new card, refused", path: "/cards/new?type=t_customer", ready: `form[fichas-form]`,
+ act: submit(`form[fichas-form]`), then: `[rst-field-error]`},
+ {name: "the fields", path: "/t/t_customer/fields", ready: `[fichas-grid]`},
+ {name: "a new field", path: "/t/t_customer/fields/new", ready: `form[fichas-form]`},
+ {name: "a new field, a Choice, Advanced open", path: "/t/t_customer/fields/new", ready: `form[fichas-form]`,
+ act: `document.querySelector('input[name="kind"][value="enum"]').checked = true; document.querySelector('[fichas-advanced]').open = true`,
+ then: `[fichas-choice-options] textarea`},
+ {name: "a new field, refused", path: "/t/t_customer/fields/new", ready: `form[fichas-form]`,
+ act: submit(`form[fichas-form]`), then: `[rst-field-error]`},
+ {name: "a field's edit form", path: "/fields/" + fichas.FieldStage + "/edit", ready: `form[fichas-form]`},
+ {name: "a new type", path: "/types/new", ready: `form[fichas-form]`},
+ {name: "a new type, refused", path: "/types/new", ready: `form[fichas-form]`,
+ act: submit(`form[fichas-form]`), then: `[rst-field-error]`},
+ {name: "the card layout", path: "/t/t_customer/layout", ready: `[fichas-layout-editor]`},
+ {name: "a contract: choose a customer", path: "/contracts/prepare?flow=" + contractFlow, ready: `[rst-box]`},
+ {name: "a contract: choose its fields", path: "/contracts/prepare?flow=" + contractFlow + "&card=" + itoa(id), ready: `[rst-box] form`},
+ }
+ for _, width := range []int64{1440, 390} {
+ for _, s := range screens {
+ found, err := auditScreen(rig, width, s)
+ if err != nil {
+ t.Fatalf("%s at %dpx: %v", s.name, width, err)
+ }
+ if len(found) > 0 {
+ t.Errorf("%s at %dpx: %s", s.name, width, rhythm.Report(found))
+ }
+ }
+ }
+}
+
+// auditScreen draws one screen state and reads the audit over main.
+// Scripts are switched back on afterwards, whatever happened.
+func auditScreen(rig *harness.Rig, width int64, s rhythmScreen) ([]rhythm.Finding, error) {
+ ctx, cancel := context.WithTimeout(rig.Context(), 30*time.Second)
+ defer cancel()
+ defer rig.Run(scriptsOn(true))
+ steps := []chromedp.Action[chromedp.Void]{scriptsOn(!s.noScript), viewport(width), chromedp.Navigate(rig.Origin + s.path)}
+ if s.noScript {
+ // No page script, so no script-made marker: wait on the server's
+ // markup, through the DOM domain.
+ steps = append(steps, chromedp.WaitReady(chromedp.CSS(s.ready)))
+ } else {
+ steps = append(steps, chromedp.WaitVisible(chromedp.CSS(s.ready)))
+ }
+ if s.act != "" {
+ steps = append(steps, chromedp.Evaluate[chromedp.Void](s.act), chromedp.WaitVisible(chromedp.CSS(s.then)))
+ }
+ var found []rhythm.Finding
+ steps = append(steps, harness.Into(&found, chromedp.Evaluate[[]rhythm.Finding](
+ rhythm.Expression("main", rhythm.Options{Skip: rhythmSkip}))))
+ return found, chromedp.Do(ctx, steps...)
+}
+
+// fieldGaps is the space between each two neighbouring fields (rst-field
+// or a conflict's fieldset) of a form, and the scale's --rst-sp-3 in px.
+const fieldGaps = `(() => {
+ const form = document.querySelector('form[fichas-form]');
+ const root = parseFloat(getComputedStyle(document.documentElement).fontSize);
+ const step = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--rst-sp-3')) * root;
+ const field = e => e.hasAttribute('rst-field') || e.hasAttribute('fichas-conflict');
+ const kids = [...form.children].filter(e => e.getBoundingClientRect().height > 0);
+ const gaps = [];
+ for (let i = 1; i < kids.length; i++) {
+ if (field(kids[i - 1]) && field(kids[i])) gaps.push(kids[i].getBoundingClientRect().top - kids[i - 1].getBoundingClientRect().bottom);
+ }
+ return {step, gaps};
+})()`
+
+// TestTheFormsFieldsAreAStepApart: the rhythm audit cannot see a gap that
+// is on the scale but the wrong step. The edit form once wrote each
+// field's hidden "was" input between it and the field before, which hid
+// that field from the stack's rule: its fields sat at the stack's 8px
+// floor, where the new-card form's sit at --rst-sp-3 (Fable, the rhythm
+// swap's review, M1). Every two fields, and a conflict's fieldset beside
+// a field, are --rst-sp-3 apart, on the edit form, after a conflict, and
+// on the new-card form.
+func TestTheFormsFieldsAreAStepApart(t *testing.T) {
+ s := seedCards(t, 1)
+ type spacing struct {
+ Step float64 `json:"step"`
+ Gaps []float64 `json:"gaps"`
+ }
+ check := func(name string, got spacing) {
+ t.Helper()
+ if len(got.Gaps) < 4 {
+ t.Fatalf("%s: %d gaps between fields; this test would pass vacuously", name, len(got.Gaps))
+ }
+ for i, g := range got.Gaps {
+ if math.Abs(g-got.Step) > 0.5 {
+ t.Errorf("%s: fields %d and %d are %.1fpx apart, want --rst-sp-3, %.1fpx", name, i, i+1, g, got.Step)
+ }
+ }
+ }
+ id := s.ids[0]
+ for _, path := range []string{cardPath(id) + "/edit", "/cards/new?type=t_customer"} {
+ var got spacing
+ s.rig.Run(wide(), chromedp.Navigate(s.rig.Origin+path), chromedp.WaitVisible(`form[fichas-form]`),
+ harness.Into(&got, chromedp.Evaluate[spacing](fieldGaps)))
+ check(path, got)
+ }
+
+ // A conflict: a teammate changes City under the open edit form, and
+ // Save draws theirs and mine as a fieldset among the fields.
+ var got spacing
+ s.rig.Run(wide(), chromedp.Navigate(s.rig.Origin+cardPath(id)+"/edit"), chromedp.WaitVisible(`#`+s.city))
+ s.teammate(t, id, s.city, "Galway", "")
+ s.rig.Run(chromedp.SetValue(`#`+s.city, "Cork"),
+ chromedp.Evaluate[chromedp.Void](`HTMLFormElement.prototype.submit.call(document.querySelector('form[fichas-form]'))`),
+ chromedp.WaitVisible(`[fichas-conflict]`),
+ harness.Into(&got, chromedp.Evaluate[spacing](fieldGaps)))
+ check("the edit form after a conflict", got)
+}
diff --git a/internal/fichastest/browser_test.go b/internal/fichastest/browser_test.go
index 4a9cdb9..77b4f74 100644
--- a/internal/fichastest/browser_test.go
+++ b/internal/fichastest/browser_test.go
@@ -39,6 +39,12 @@ import (
// browserApp is the app signed in as TestOwner, with the rig's own origin,
// optionally seeded through the real store.
func browserApp(t *testing.T, seed func(context.Context, *db.DB, fichas.Config)) *harness.Rig {
+ return browserAppWith(t, nil, seed)
+}
+
+// browserAppWith is browserApp with its config changed first, by
+// configure, when that is not nil.
+func browserAppWith(t *testing.T, configure func(*fichas.Config), seed func(context.Context, *db.DB, fichas.Config)) *harness.Rig {
return harness.New(t, func(origin string) http.Handler {
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
d, err := db.Open(filepath.Join(t.TempDir(), "app.db"), logger)
@@ -58,6 +64,9 @@ func browserApp(t *testing.T, seed func(context.Context, *db.DB, fichas.Config))
if err != nil {
t.Fatalf("LoadConfig: %v", err)
}
+ if configure != nil {
+ configure(&cfg)
+ }
mux, err := fichas.AppForTest(d, cfg, logger, TestOwner)
if err != nil {
t.Fatalf("AppForTest: %v", err)
diff --git a/internal/fichastest/markup_test.go b/internal/fichastest/markup_test.go
index 5745d82..a9c27c3 100644
--- a/internal/fichastest/markup_test.go
+++ b/internal/fichastest/markup_test.go
@@ -30,7 +30,7 @@ func read(t *testing.T, path string) string {
// TestTemplatesUseOnlyDefinedAttributes: every rst-* or fichas-* attribute a
// template writes must have a rule in one of the app's stylesheets.
//
-// The first index shipped rst-stack and rst-muted, which rastrillo does not
+// The first index shipped rst-stack and rst-muted, which rastrillo did not
// have. With no rule behind them the browser's defaults showed through — a
// bullet point and an underlined purple link — and nothing failed. Only
// attributes in THIS app's templates are checked: what rastrillo's partials
diff --git a/internal/fichastest/signin_door_keymail_test.go b/internal/fichastest/signin_door_keymail_test.go
index a1bb614..7b5ceda 100644
--- a/internal/fichastest/signin_door_keymail_test.go
+++ b/internal/fichastest/signin_door_keymail_test.go
@@ -109,7 +109,11 @@ func keymailApp(t *testing.T) (*http.ServeMux, *capturingMailer) {
t.Fatalf("App: %v", err)
}
m := &capturingMailer{}
- au, err := fichas.NewAuth(d.Writer(), fichas.AuthEnv{Origin: cfg.Origin, InstanceKey: cfg.InstanceKey, Mailer: m}, logger, app)
+ // The fake's two hosts, listed: rastrillo's default (nil, any server)
+ // dials only public addresses, on a transport of its own, so it never
+ // reaches the fake (rastrillo v0.45.0).
+ au, err := fichas.NewAuth(d.Writer(), fichas.AuthEnv{Origin: cfg.Origin, InstanceKey: cfg.InstanceKey, Mailer: m,
+ KeymailServers: []string{keymailHost, "plain.test"}}, logger, app)
if err != nil {
t.Fatalf("NewAuth: %v", err)
}
@@ -148,7 +152,8 @@ func TestAKeymailAddressContinuesOnTheDoor(t *testing.T) {
t.Fatalf("GET %s: %d", loc, page.Code)
}
body := page.Body.String()
- if got := titleOf(body); got != "Taking you to Keymail to sign in to Fichas" {
+ // rastrillo's own words since v0.45.0, which never name Keymail.
+ if got := titleOf(body); got != "Signing in to Fichas" {
t.Errorf("title %q", got)
}
if !strings.Contains(body, `<div rst-signin-door="one-way">`) {
@@ -168,8 +173,8 @@ func TestAKeymailAddressContinuesOnTheDoor(t *testing.T) {
q.Get("code_challenge_method") != "S256" || q.Get("state") == "" || q.Get("code_challenge") == "" {
t.Errorf("the continuation goes to %s, not this origin's Keymail authorize URL", dest)
}
- if !strings.Contains(body, `<a rst-btn="primary block" href="`+refresh[1]+`">Continue to Keymail</a>`) {
- t.Errorf("no Continue to Keymail link to the same URL:\n%s", body)
+ if !strings.Contains(body, `<a rst-btn="primary block" href="`+refresh[1]+`">Continue</a>`) {
+ t.Errorf("no Continue link to the same URL:\n%s", body)
}
if page.Header().Get("Referrer-Policy") != "no-referrer" || page.Header().Get("Cache-Control") != "no-store" {
t.Errorf("Referrer-Policy %q, Cache-Control %q", page.Header().Get("Referrer-Policy"), page.Header().Get("Cache-Control"))
@@ -206,7 +211,7 @@ func TestTheContinuationGoesNowhereItWasNotSent(t *testing.T) {
jar = b
}
body := jar.get(t, h, target).Body.String()
- if strings.Contains(body, "http-equiv=\"refresh\"") || strings.Contains(body, "evil.example") || strings.Contains(body, "/oauth/authorize") || strings.Contains(body, "Continue to Keymail") {
+ if strings.Contains(body, "http-equiv=\"refresh\"") || strings.Contains(body, "evil.example") || strings.Contains(body, "/oauth/authorize") || strings.Contains(body, ">Continue</a>") {
t.Errorf("%s: the door links somewhere:\n%s", name, body)
}
if !strings.Contains(body, "That link has expired or was already used. Send a new one.") {
diff --git a/internal/fichastest/signin_flow_test.go b/internal/fichastest/signin_flow_test.go
index a7f1067..f3b7154 100644
--- a/internal/fichastest/signin_flow_test.go
+++ b/internal/fichastest/signin_flow_test.go
@@ -200,7 +200,7 @@ func TestSigninErrorsArePlainLanguage(t *testing.T) {
for code, want := range map[string]string{
"rate": "Too many tries. Try again in a few minutes.",
"expired": "That link has expired or was already used. Send a new one.",
- "keymail": "Keymail couldn&#39;t confirm it&#39;s you.",
+ "keymail": "We couldn&#39;t confirm it&#39;s you. Try again, or email yourself a sign-in link.", // rastrillo v0.45.0: never names Keymail
"address": "That doesn&#39;t look like an email address.",
"1": "Something went wrong. Try again.",
} {