carlos / platform Public

demo claims: browser claim completes in one click, console styled

CSP form-action blocked the redirect to Keymail step-up, so Keep this demo
did nothing. form-action now names the configured Keymail origin, a resume
cookie finishes the confirmed choice, and the page uses console chrome.

Squashed from demo-claim-page-fix into main.
codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 4c41cb9e1db6a54235f19f2f97c3574488bf66fa parent 3a58ccf
18 files changed, +2,102 −1,203
  • internal/console/demo_claim_browser_test.go +1 −1
  • internal/console/demo_claim_copy.go +3 −0
  • internal/console/demo_claim_csp_test.go +82 −0
  • internal/console/demo_claim_page.go +79 −47
  • internal/console/demo_claim_page_test.go +17 −1
  • internal/console/demo_claim_resume_browser_test.go +71 −0
  • internal/console/demo_claim_resume_test.go +347 −0
  • internal/console/demo_claim_selection.go +110 −0
  • internal/console/icons_test.go +4 −0
  • internal/console/keymail.go +34 −0
  • internal/console/keymail_origin_test.go +48 −0
  • internal/console/server.go +1 −0
  • internal/console/static/demo_claim.js +23 −1
  • internal/console/stepup.go +5 −1
  • internal/console/templates/console_chrome.html +1,149 −0
  • internal/console/templates/demo_claim.html +7 −4
  • internal/console/templates/layout.html +2 −1,148
  • internal/console/testdata/demo_claim_resume_browser.mjs +119 −0

CI passed — run details

diff --git a/internal/console/demo_claim_browser_test.go b/internal/console/demo_claim_browser_test.go
index 10fd67854..6c923af4f 100644
--- a/internal/console/demo_claim_browser_test.go
+++ b/internal/console/demo_claim_browser_test.go
@@ -155,7 +155,7 @@ func TestDemoClaimBrowserRecovery(t *testing.T) {
t.Fatalf("signin minted account: %v %v", as, err)
}
w = b.request("GET", "/demo/claim", nil)
- if w.Code != 200 || b.cookie != cookie || !strings.Contains(w.Body.String(), "actual@example.com") {
+ if w.Code != 200 || b.cookie != cookie || !strings.Contains(w.Body.String(), "actual@example.com") || strings.Contains(w.Body.String(), "data-auto-submit") {
t.Fatal("intent lost")
}
})
diff --git a/internal/console/demo_claim_copy.go b/internal/console/demo_claim_copy.go
index 2ea655557..dcab12abe 100644
--- a/internal/console/demo_claim_copy.go
+++ b/internal/console/demo_claim_copy.go
@@ -87,3 +87,6 @@ const (
// CLAIM-ACCOUNT-CAP: plan cap refusal during browser reservation.
demoClaimAccountCap = "This account has reached its plan limit. Choose another account or free up capacity."
)
+
+// CLAIM-RESUME-SUBMITTING: the previously confirmed selection is being posted.
+const demoClaimResuming = "Keeping your demo in the account you chose…"
diff --git a/internal/console/demo_claim_csp_test.go b/internal/console/demo_claim_csp_test.go
new file mode 100644
index 000000000..9fb0cefc7
--- /dev/null
+++ b/internal/console/demo_claim_csp_test.go
@@ -0,0 +1,82 @@
+package console
+
+import (
+ "crypto/sha256"
+ "encoding/base64"
+ "net/http/httptest"
+ "net/url"
+ "strings"
+ "testing"
+)
+
+func TestDemoClaimPageFormOrigin(t *testing.T) {
+ s, _, _ := claimTestServer(t)
+ for _, base := range []string{"https://keymail.example:8443/deployment/?ignored=1", "http://127.0.0.1:12345", "https://keymail.example"} {
+ s.km = NewKeymail(base, s.cfg.Origin)
+ b := &claimBrowser{t: t, s: s}
+ w := b.request("GET", "/demo/claim", nil)
+ u, _ := url.Parse(base)
+ if !strings.Contains(w.Header().Get("Content-Security-Policy"), "form-action 'self' "+u.Scheme+"://"+u.Host+";") {
+ t.Errorf("wrong origin for %s: %s", base, w.Header().Get("Content-Security-Policy"))
+ }
+ }
+ w := httptest.NewRecorder()
+ s.demoClaimBrowserError(w, 403, demoClaimWrongSite)
+ if !strings.Contains(w.Header().Get("Content-Security-Policy"), "form-action 'self';") {
+ t.Fatal("error page widened form policy")
+ }
+}
+
+func TestDemoClaimPageConsoleChrome(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodEmail, true)
+ w := b.request("GET", "/demo/claim", nil)
+ body := w.Body.String()
+ for _, want := range []string{"<header>", "<style>", "--rst-bg:", "color-scheme: light dark", "system-ui"} {
+ if !strings.Contains(body, want) {
+ t.Errorf("claim page missing shared chrome %q", want)
+ }
+ }
+ if !strings.Contains(w.Header().Get("Content-Security-Policy"), "style-src 'sha256-") {
+ t.Error("shared inline style must have a CSP hash")
+ }
+ _, rest, _ := strings.Cut(body, "<style>")
+ css, _, _ := strings.Cut(rest, "</style>")
+ sum := sha256.Sum256([]byte(css))
+ if !strings.Contains(w.Header().Get("Content-Security-Policy"), "'sha256-"+base64.StdEncoding.EncodeToString(sum[:])+"'") {
+ t.Error("style hash does not match the rendered bytes")
+ }
+ if strings.Count(body, "<script") != 1 || strings.Contains(body, "Bricolage") {
+ t.Error("unexpected script or font")
+ }
+}
+
+func TestDemoClaimRefusalBrand(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ s.consoleNameCfg = "Claim test console"
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodKeymail, true)
+ w := b.request("POST", "/demo/claim/select", url.Values{"nonce": {"stale"}, "csrf": {b.session}})
+ if w.Code != 403 {
+ t.Fatalf("refusal status = %d", w.Code)
+ }
+ if !strings.Contains(w.Body.String(), s.consoleNameCfg) || strings.Contains(w.Body.String(), "CARLOS console") {
+ t.Fatal("claim refusal did not use the deployment brand")
+ }
+ if strings.Contains(w.Body.String(), "claimant@example.com") || strings.Contains(w.Body.String(), "/logout") {
+ t.Fatal("claim refusal should retain signed-out chrome")
+ }
+}
+
+func TestDemoClaimPageRejectsUnsafeFormOrigin(t *testing.T) {
+ s, _, _ := claimTestServer(t)
+ for _, base := range []string{"https://*.example.com", "https://*", "https://keymail.dev;sandbox", "https://a'b", "https://a,b", "https://:443"} {
+ s.km = NewKeymail(base, s.cfg.Origin)
+ b := &claimBrowser{t: t, s: s}
+ w := b.request("GET", "/demo/claim", nil)
+ if !strings.Contains(w.Header().Get("Content-Security-Policy"), "form-action 'self';") {
+ t.Errorf("unsafe form origin for %q", base)
+ }
+ }
+}
diff --git a/internal/console/demo_claim_page.go b/internal/console/demo_claim_page.go
index 2b0a89493..bddaa542e 100644
--- a/internal/console/demo_claim_page.go
+++ b/internal/console/demo_claim_page.go
@@ -1,8 +1,11 @@
package console
import (
+ "bytes"
+ "crypto/sha256"
"crypto/subtle"
"database/sql"
+ "encoding/base64"
"errors"
"fmt"
"html/template"
@@ -14,26 +17,46 @@ import (
const demoClaimBrowserCookie = "carlos_demo_claim_flow"
-var demoClaimPageTemplate = template.Must(template.New("demo_claim.html").Funcs(template.FuncMap{"asset": assetURL}).ParseFS(tmplFS, "templates/demo_claim.html"))
+var demoClaimPageTemplate = template.Must(template.New("demo_claim.html").Funcs(template.FuncMap{"asset": assetURL, "icon": icon}).ParseFS(tmplFS, "templates/demo_claim.html", "templates/console_chrome.html", "templates/fiesta.html"))
+
+var demoClaimStyleHash = func() string {
+ // Hash the style in its HTML context: html/template removes CSS comments
+ // inside <style>, so the standalone template's bytes are not the sent bytes.
+ var rendered bytes.Buffer
+ if err := demoClaimPageTemplate.ExecuteTemplate(&rendered, "demo_claim.html", demoClaimPageData{}); err != nil {
+ panic(err)
+ }
+ _, rest, _ := strings.Cut(rendered.String(), "<style>")
+ css, _, _ := strings.Cut(rest, "</style>")
+ sum := sha256.Sum256([]byte(css))
+ return "'sha256-" + base64.StdEncoding.EncodeToString(sum[:]) + "'"
+}()
type demoClaimPageData struct {
+ AutoSubmit bool
+ SelectedAccount string
+ Chrome page
Copy map[string]string
Nonce, CSRF, Address, State, AccountID, App, URL, Error string
Accounts []Account
CanClaim, HasIntent, EmailPending bool
}
-func demoClaimPageHeaders(w http.ResponseWriter) {
+func demoClaimPageHeaders(w http.ResponseWriter, keymailOrigin string) {
+ formAction := "'self'"
+ if keymailOrigin != "" {
+ formAction += " " + keymailOrigin
+ }
w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Referrer-Policy", "origin")
- w.Header().Set("Content-Security-Policy", "default-src 'none'; script-src 'self'; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'")
+ w.Header().Set("Content-Security-Policy", "default-src 'none'; script-src 'self'; connect-src 'self'; style-src "+demoClaimStyleHash+"; form-action "+formAction+"; frame-ancestors 'none'; base-uri 'none'")
w.Header().Set("Content-Type", "text/html; charset=utf-8")
}
-func demoClaimBrowserError(w http.ResponseWriter, status int, message string) {
- demoClaimPageHeaders(w)
+func (s *Server) demoClaimBrowserError(w http.ResponseWriter, status int, message string) {
+ demoClaimPageHeaders(w, "")
w.WriteHeader(status)
- _ = demoClaimPageTemplate.ExecuteTemplate(w, "demo_claim.html", demoClaimPageData{Copy: demoClaimBrowserCopy(), Error: message})
+ _ = demoClaimPageTemplate.ExecuteTemplate(w, "demo_claim.html", demoClaimPageData{Chrome: page{Brand: s.brandName()}, Copy: demoClaimBrowserCopy(), Error: message})
}
func setDemoClaimCookie(w http.ResponseWriter, raw string, expiry time.Time) {
@@ -60,14 +83,14 @@ func (s *Server) attachDemoClaimBrowser(w http.ResponseWriter, r *http.Request,
err = s.store.attachDemoClaimBrowser(r.Context(), raw, f)
}
if err != nil {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return false
}
expiry := f.ExpiresAt
if op, err := s.store.demoClaimOpForFlow(r.Context(), f.Hash); err == nil {
expiry = demoClaimResultExpiry(op)
} else if !errors.Is(err, sql.ErrNoRows) {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return false
}
setDemoClaimCookie(w, raw, expiry)
@@ -77,9 +100,9 @@ func (s *Server) attachDemoClaimBrowser(w http.ResponseWriter, r *http.Request,
// A render may read existing work with admission off. It never proves identity,
// chooses an account, or starts a reservation, including on OAuth return.
func (s *Server) handleDemoClaimPage(w http.ResponseWriter, r *http.Request) {
- demoClaimPageHeaders(w)
+ demoClaimPageHeaders(w, s.km.Origin())
if s.cfg.HostClaim || s.store.claimGated() {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
cookie := demoClaimCookie(r)
@@ -87,13 +110,15 @@ func (s *Server) handleDemoClaimPage(w http.ResponseWriter, r *http.Request) {
var err error
cookie, err = randomToken()
if err != nil {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
setDemoClaimCookie(w, cookie, time.Now().Add(15*time.Minute))
}
address, session, _ := s.session(r)
- p := demoClaimPageData{Copy: demoClaimBrowserCopy(), Nonce: demoClaimNonce(cookie, session), CSRF: session, Address: address, State: "missing"}
+ p := demoClaimPageData{Chrome: s.basePage(r), Copy: demoClaimBrowserCopy(), Nonce: demoClaimNonce(cookie, session), CSRF: session, Address: address, State: "missing"}
+ selection, resume := s.takeDemoClaimSelection(w, r, session, p.Nonce)
+ s.chrome(&p.Chrome)
p.Copy["next"] = fmt.Sprintf(demoClaimCLINext, s.cfg.Origin)
hash, err := s.store.demoClaimBrowserHash(r.Context(), cookie, time.Now())
if err == nil {
@@ -110,7 +135,7 @@ func (s *Server) handleDemoClaimPage(w http.ResponseWriter, r *http.Request) {
p.State = "aborted"
}
} else if !errors.Is(opErr, sql.ErrNoRows) {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
} else if f, ferr := s.store.demoClaimFlowByHash(r.Context(), hash, time.Now()); ferr == nil {
p.HasIntent = true
@@ -130,14 +155,21 @@ func (s *Server) handleDemoClaimPage(w http.ResponseWriter, r *http.Request) {
var accounts []Account
accounts, err = s.store.AccountsFor(address)
if err != nil {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
for _, a := range accounts {
if demoClaimCanCreate(a) {
+ if resume && !selection.Create && selection.Account == a.Sqid {
+ p.AutoSubmit = p.CanClaim
+ p.SelectedAccount = a.Sqid
+ }
p.Accounts = append(p.Accounts, a)
}
}
+ if resume && selection.Create && len(accounts) == 0 {
+ p.AutoSubmit = p.CanClaim
+ }
if len(accounts) > 0 && len(p.Accounts) == 0 {
p.State, p.CanClaim = "no_accounts", false
}
@@ -160,14 +192,14 @@ func (s *Server) demoClaimBrowserGate(w http.ResponseWriter, r *http.Request) bo
}
r.Body = http.MaxBytesReader(w, r.Body, 4096)
if r.ParseForm() != nil {
- demoClaimBrowserError(w, 400, demoClaimBadRequest)
+ s.demoClaimBrowserError(w, 400, demoClaimBadRequest)
return false
}
cookie := demoClaimCookie(r)
_, session, _ := s.session(r)
nonce := r.PostForm.Get("nonce")
if cookie == "" || nonce == "" || subtle.ConstantTimeCompare([]byte(nonce), []byte(demoClaimNonce(cookie, session))) != 1 || (session != "" && subtle.ConstantTimeCompare([]byte(r.PostForm.Get("csrf")), []byte(session)) != 1) {
- demoClaimBrowserError(w, 403, demoClaimWrongSite)
+ s.demoClaimBrowserError(w, 403, demoClaimWrongSite)
return false
}
// Intent uses the posted demo token and rotates the cookie. Other actions
@@ -175,10 +207,10 @@ func (s *Server) demoClaimBrowserGate(w http.ResponseWriter, r *http.Request) bo
hash, err := s.store.demoClaimBrowserHash(r.Context(), cookie, time.Now())
if err == nil && r.URL.Path != "/demo/claim/intent" {
if _, err = s.store.demoClaimOpForFlow(r.Context(), hash); err == nil {
- demoClaimBrowserError(w, 401, demoClaimIntentExpired)
+ s.demoClaimBrowserError(w, 401, demoClaimIntentExpired)
return false
} else if !errors.Is(err, sql.ErrNoRows) {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return false
}
}
@@ -187,11 +219,11 @@ func (s *Server) demoClaimBrowserGate(w http.ResponseWriter, r *http.Request) bo
func (s *Server) demoClaimBrowserAdmission(w http.ResponseWriter, r *http.Request) bool {
w.Header().Set("Cache-Control", "no-store")
if !s.demoClaimEnabled() {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return false
}
if !s.demoClaimOrigin(r) {
- demoClaimBrowserError(w, 403, demoClaimWrongSite)
+ s.demoClaimBrowserError(w, 403, demoClaimWrongSite)
return false
}
return true
@@ -203,7 +235,7 @@ func (s *Server) browserDemoClaimFlow(w http.ResponseWriter, r *http.Request) (c
f, err = s.store.demoClaimFlowByHash(r.Context(), hash, time.Now())
}
if err != nil {
- demoClaimBrowserError(w, 401, demoClaimIntentExpired)
+ s.demoClaimBrowserError(w, 401, demoClaimIntentExpired)
return claimFlow{}, false
}
return f, true
@@ -218,13 +250,13 @@ func (s *Server) handleDemoClaimBrowserIntent(w http.ResponseWriter, r *http.Req
return
}
if !s.limits.submit(s.clientIP(r)) {
- demoClaimBrowserError(w, 429, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 429, demoClaimUnavailable)
return
}
// Rotate instead of rebinding an existing cookie, so old forms fail closed.
raw, err := randomToken()
if err != nil {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
var f claimFlow
@@ -252,7 +284,7 @@ func (s *Server) handleDemoClaimBrowserProof(w http.ResponseWriter, r *http.Requ
return
}
if f.Person != "" {
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
return
}
now := time.Now()
@@ -260,22 +292,22 @@ func (s *Server) handleDemoClaimBrowserProof(w http.ResponseWriter, r *http.Requ
if code := strings.TrimSpace(r.PostForm.Get("code")); code != "" {
c, ok := s.store.LiveEmailChallenge(ChallengeDemoClaim, f.Hash, now)
if !ok || c.Address != f.Address {
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
return
}
done, ok := s.limits.reserveGuess(c.Address, ip)
if !ok {
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
return
}
got, result := s.store.TakeEmailCode(c, code, now)
done(result == CodeOK)
if result != CodeOK || got.FlowHash != f.Hash || got.Purpose != ChallengeDemoClaim || got.Address != f.Address {
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
return
}
if _, err := s.proveDemoClaim(r.Context(), f, MethodEmail, got.Address, ip, now); err != nil {
- demoClaimBrowserProofError(w, err)
+ s.demoClaimBrowserProofError(w, err)
return
}
s.finishSignin(w, r, got.Address, "", MethodEmail, "/demo/claim")
@@ -283,13 +315,13 @@ func (s *Server) handleDemoClaimBrowserProof(w http.ResponseWriter, r *http.Requ
}
address, ok := canonicalAddress(r.PostForm.Get("email"))
if !ok {
- demoClaimBrowserError(w, 400, demoClaimBadRequest)
+ s.demoClaimBrowserError(w, 400, demoClaimBadRequest)
return
}
underCap := s.limits.submit(ip)
keymail := s.keymailAddress(r.Context(), address, underCap)
if !keymail && !s.mailReady(r.Context()) {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
if !underCap {
@@ -342,7 +374,7 @@ func (s *Server) handleDemoClaimBrowserProof(w http.ResponseWriter, r *http.Requ
})
mu.Unlock()
if err != nil {
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
return
}
if keymail {
@@ -377,7 +409,7 @@ func (s *Server) handleDemoClaimBrowserSelect(w http.ResponseWriter, r *http.Req
}
accounts, err := s.store.AccountsFor(person)
if err != nil {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
selected := r.PostForm.Get("accountId")
@@ -403,7 +435,7 @@ func (s *Server) handleDemoClaimBrowserSelect(w http.ResponseWriter, r *http.Req
}
f, err = s.proveDemoClaim(r.Context(), f, method, subject, s.clientIP(r), time.Now())
if err != nil {
- demoClaimBrowserProofError(w, err)
+ s.demoClaimBrowserProofError(w, err)
return
}
if f.Person != person {
@@ -413,7 +445,7 @@ func (s *Server) handleDemoClaimBrowserSelect(w http.ResponseWriter, r *http.Req
}
acct, choices, err := s.chooseDemoClaimAccountForBrowser(r.Context(), f, selected, len(accounts) == 0)
if err != nil {
- demoClaimBrowserAccountError(w, r, err)
+ s.demoClaimBrowserAccountError(w, r, err)
return
}
// A concurrent membership addition requires another explicit selection.
@@ -423,12 +455,12 @@ func (s *Server) handleDemoClaimBrowserSelect(w http.ResponseWriter, r *http.Req
}
rq, ref := s.newAppRegionReq(r, "", "")
if ref != nil {
- demoClaimBrowserError(w, ref.Status, ref.Msg)
+ s.demoClaimBrowserError(w, ref.Status, ref.Msg)
return
}
op, err := s.reserveDemoClaim(r.Context(), f, acct, rq)
if err != nil {
- demoClaimBrowserAccountError(w, r, err)
+ s.demoClaimBrowserAccountError(w, r, err)
return
}
setDemoClaimCookie(w, demoClaimCookie(r), demoClaimResultExpiry(op))
@@ -467,33 +499,33 @@ func (s *Server) demoClaimSessionIdentity(raw, person string) (string, string, b
}
func demoClaimBrowserCopy() map[string]string {
- return map[string]string{"back": demoClaimBack, "noAccounts": demoClaimNoEligibleAccount, "title": demoClaimPageTitle, "missing": demoClaimIntentExpired, "failed": demoClaimExchangeFailed, "noscript": demoClaimNeedsScript, "identity": demoClaimIdentityLabel, "email": demoClaimEmailLabel, "continue": demoClaimEmailContinue, "code": demoClaimCodeLabel, "prove": demoClaimCodeConfirm, "sent": demoClaimEmailSent, "signin": demoClaimSignin, "account": demoClaimAccountLabel, "choose": demoClaimChooseAccount, "new": demoClaimNewAccount, "confirm": demoClaimConfirm, "working": demoClaimWorking, "reload": demoClaimReload, "complete": demoClaimComplete, "app": demoClaimAppLabel, "url": demoClaimURLLabel, "aborted": demoClaimAborted, "disabled": demoClaimUnavailable}
+ return map[string]string{"resuming": demoClaimResuming, "back": demoClaimBack, "noAccounts": demoClaimNoEligibleAccount, "title": demoClaimPageTitle, "missing": demoClaimIntentExpired, "failed": demoClaimExchangeFailed, "noscript": demoClaimNeedsScript, "identity": demoClaimIdentityLabel, "email": demoClaimEmailLabel, "continue": demoClaimEmailContinue, "code": demoClaimCodeLabel, "prove": demoClaimCodeConfirm, "sent": demoClaimEmailSent, "signin": demoClaimSignin, "account": demoClaimAccountLabel, "choose": demoClaimChooseAccount, "new": demoClaimNewAccount, "confirm": demoClaimConfirm, "working": demoClaimWorking, "reload": demoClaimReload, "complete": demoClaimComplete, "app": demoClaimAppLabel, "url": demoClaimURLLabel, "aborted": demoClaimAborted, "disabled": demoClaimUnavailable}
}
func demoClaimCanCreate(a Account) bool { return a.Role == RoleOwner || a.Role == RoleMember }
-func demoClaimBrowserProofError(w http.ResponseWriter, err error) {
+func (s *Server) demoClaimBrowserProofError(w http.ResponseWriter, err error) {
if errors.Is(err, errDemoClaimSignupBusy) {
- demoClaimBrowserError(w, 429, demoClaimSignupBusy)
+ s.demoClaimBrowserError(w, 429, demoClaimSignupBusy)
return
}
- demoClaimBrowserError(w, 401, demoClaimBadProof)
+ s.demoClaimBrowserError(w, 401, demoClaimBadProof)
}
-func demoClaimBrowserAccountError(w http.ResponseWriter, r *http.Request, err error) {
+func (s *Server) demoClaimBrowserAccountError(w http.ResponseWriter, r *http.Request, err error) {
switch {
case errors.Is(err, ErrDemoToken):
- demoClaimBrowserError(w, 401, demoClaimIntentExpired)
+ s.demoClaimBrowserError(w, 401, demoClaimIntentExpired)
case errors.Is(err, errDemoClaimAccount):
http.NotFound(w, r)
case isPlanCap(err):
- demoClaimBrowserError(w, 409, demoClaimAccountCap)
+ s.demoClaimBrowserError(w, 409, demoClaimAccountCap)
case errors.Is(err, errDemoClaimPlacement):
- demoClaimBrowserError(w, 409, demoClaimPlacement)
+ s.demoClaimBrowserError(w, 409, demoClaimPlacement)
case errors.Is(err, ErrDemoBusy):
- demoClaimBrowserError(w, 409, demoClaimPending)
+ s.demoClaimBrowserError(w, 409, demoClaimPending)
default:
- demoClaimBrowserError(w, 503, demoClaimReserveFailed)
+ s.demoClaimBrowserError(w, 503, demoClaimReserveFailed)
}
}
@@ -501,7 +533,7 @@ func (s *Server) continueDemoClaimKeymail(w http.ResponseWriter, r *http.Request
// Discovery is not proof; the OAuth session supplies the actual identity.
flow := s.requestFlow(r)
if flow == "" {
- demoClaimBrowserError(w, 503, demoClaimUnavailable)
+ s.demoClaimBrowserError(w, 503, demoClaimUnavailable)
return
}
s.continueKeymailSignin(w, r, flow, "/demo/claim")
diff --git a/internal/console/demo_claim_page_test.go b/internal/console/demo_claim_page_test.go
index 31d7bb194..12d7cfb47 100644
--- a/internal/console/demo_claim_page_test.go
+++ b/internal/console/demo_claim_page_test.go
@@ -21,6 +21,7 @@ type claimBrowser struct {
t *testing.T
s *Server
cookie, session, nonce string
+ cookies map[string]*http.Cookie
}
func (b *claimBrowser) request(method, path string, form url.Values) *httptest.ResponseRecorder {
@@ -30,7 +31,12 @@ func (b *claimBrowser) request(method, path string, form url.Values) *httptest.R
if method == "POST" {
r.Header.Set("Origin", b.s.cfg.Origin)
}
- if b.cookie != "" {
+ for _, c := range b.cookies {
+ if strings.HasPrefix(r.URL.Path, c.Path) {
+ r.AddCookie(c)
+ }
+ }
+ if b.cookie != "" && strings.HasPrefix(r.URL.Path, "/demo/claim") {
r.AddCookie(&http.Cookie{Name: browserClaimCookieName, Value: b.cookie})
}
if b.session != "" {
@@ -38,7 +44,17 @@ func (b *claimBrowser) request(method, path string, form url.Values) *httptest.R
}
w := httptest.NewRecorder()
b.s.mux.ServeHTTP(w, r)
+ if b.cookies == nil {
+ b.cookies = make(map[string]*http.Cookie)
+ }
for _, c := range w.Result().Cookies() {
+ if c.Name != browserClaimCookieName && c.Name != sessionCookie {
+ if c.MaxAge < 0 {
+ delete(b.cookies, c.Name)
+ } else {
+ b.cookies[c.Name] = c
+ }
+ }
if c.Name == browserClaimCookieName {
b.cookie = c.Value
}
diff --git a/internal/console/demo_claim_resume_browser_test.go b/internal/console/demo_claim_resume_browser_test.go
new file mode 100644
index 000000000..e719702f5
--- /dev/null
+++ b/internal/console/demo_claim_resume_browser_test.go
@@ -0,0 +1,71 @@
+package console
+
+import (
+ "context"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "strings"
+ "testing"
+ "time"
+)
+
+func TestDemoClaimSelectStepUpHeadless(t *testing.T) {
+ chromium, err := exec.LookPath("chromium")
+ if err != nil {
+ t.Skip("no installed headless Chromium")
+ }
+ node, err := exec.LookPath("node")
+ if err != nil {
+ t.Skip("no installed node")
+ }
+ s, _, token := claimTestServer(t)
+ fk := claimStepUpStub(t, s)
+ s.registerRoute("GET /static/{hash}/{file...}", s.handleStatic)
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if strings.HasPrefix(r.URL.Path, "/auth/") {
+ if _, err := r.Cookie(browserClaimCookieName); err == nil {
+ t.Error("claim cookie reached auth path")
+ }
+ }
+ if r.URL.Query().Get("csp") == "before" {
+ rec := httptest.NewRecorder()
+ s.mux.ServeHTTP(rec, r)
+ for k, v := range rec.Header() {
+ w.Header()[k] = v
+ }
+ w.Header().Set("Content-Security-Policy", strings.ReplaceAll(w.Header().Get("Content-Security-Policy"), "form-action 'self' "+fk.srv.URL, "form-action 'self'"))
+ w.WriteHeader(rec.Code)
+ w.Write(rec.Body.Bytes())
+ return
+ }
+ s.mux.ServeHTTP(w, r)
+ }))
+ defer ts.Close()
+ s.cfg.Origin = ts.URL
+ s.km.origin = ts.URL
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodKeymail, false)
+ claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ a := claimAccount(t, s, 502, "claimant@example.com", RoleOwner)
+ ctx, cancel := context.WithTimeout(t.Context(), 45*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(ctx, node, "testdata/demo_claim_resume_browser.mjs", chromium, t.TempDir(), ts.URL, b.session, b.cookie, a.Sqid, os.Getenv("CARLOS_DEMO_CLAIM_SCREENSHOTS"))
+ output, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("headless: %v %s", err, output)
+ }
+ t.Log(strings.TrimSpace(string(output)))
+ if claimBrowserCount(t, s, "demo_claim_ops") != 1 {
+ t.Fatal("JS did not reserve exactly one operation")
+ }
+ hash, err := s.store.demoClaimBrowserHash(t.Context(), b.cookie, time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ op, err := s.store.demoClaimOpForFlow(t.Context(), hash)
+ if err != nil || op.Target.Sqid != a.Sqid {
+ t.Fatalf("wrong browser destination: %+v %v", op, err)
+ }
+}
diff --git a/internal/console/demo_claim_resume_test.go b/internal/console/demo_claim_resume_test.go
new file mode 100644
index 000000000..55f2c8ab3
--- /dev/null
+++ b/internal/console/demo_claim_resume_test.go
@@ -0,0 +1,347 @@
+package console
+
+import (
+ "net/http"
+ "net/http/httptest"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+)
+
+// The stub drives the browser redirect as well as the server-side exchange.
+func claimStepUpStub(t *testing.T, s *Server) *fakeKeymail {
+ t.Helper()
+ fk := newFakeKeymail(t, "claimant@example.com")
+ original := fk.srv.Config.Handler
+ fk.srv.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.Path != "/oauth/authorize" {
+ original.ServeHTTP(w, r)
+ return
+ }
+ q := r.URL.Query()
+ fk.mu.Lock()
+ fk.challenge, fk.expectCode, fk.authTime = q.Get("code_challenge"), "claim-stepup", time.Now()
+ fk.mu.Unlock()
+ http.Redirect(w, r, q.Get("redirect_uri")+"?code=claim-stepup&state="+url.QueryEscape(q.Get("state")), 303)
+ })
+ s.km = NewKeymail(fk.srv.URL, s.cfg.Origin)
+ s.km.SetSigningKey(testSigningKey(t))
+ s.registerRoute("GET /auth/stepup/callback", s.handleStepUpCallback)
+ s.registerRoute("POST /auth/email/stepup/code", s.handleStepUpEmailCode)
+ return fk
+}
+
+func claimFinishKeymail(t *testing.T, b *claimBrowser, location string) *httptest.ResponseRecorder {
+ t.Helper()
+ c := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
+ response, err := c.Get(location)
+ if err != nil {
+ t.Fatal(err)
+ }
+ response.Body.Close()
+ if response.StatusCode != 303 {
+ t.Fatalf("stub: %d", response.StatusCode)
+ }
+ callback, err := url.Parse(response.Header.Get("Location"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ return b.request("GET", callback.RequestURI(), nil)
+}
+
+func TestDemoClaimSelectStepUpRoundTrip(t *testing.T) {
+ for _, method := range []string{MethodKeymail, MethodEmail} {
+ t.Run(method, func(t *testing.T) {
+ s, m, token := claimTestServer(t)
+ fk := claimStepUpStub(t, s)
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", method, false)
+ claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ a := claimAccount(t, s, 502, "claimant@example.com", RoleOwner)
+ page := b.request("GET", "/demo/claim", nil)
+ if !strings.Contains(page.Header().Get("Content-Security-Policy"), "form-action 'self' "+fk.srv.URL+";") {
+ t.Error("rendered page CSP does not allow the configured step-up origin")
+ }
+ w := b.post("/demo/claim/select", url.Values{"accountId": {a.Sqid}})
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 || claimBrowserCount(t, s, "pending_actions") != 1 {
+ t.Fatal("select did not stop at step-up")
+ }
+ if method == MethodKeymail {
+ if w.Code != 303 {
+ t.Fatalf("step-up: %d %s", w.Code, w.Body)
+ }
+ w = claimFinishKeymail(t, b, w.Header().Get("Location"))
+ } else {
+ code, _ := claimMail(t, s, m)
+ w = b.request("POST", "/auth/email/stepup/code", url.Values{"code": {code}})
+ }
+ if w.Code != 303 || w.Header().Get("Location") != "/demo/claim" {
+ t.Fatalf("resume: %d %s", w.Code, w.Body)
+ }
+ if claimBrowserCount(t, s, "pending_actions") != 0 || claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("resume must consume stash without claiming")
+ }
+ w = b.request("GET", "/demo/claim", nil)
+ if !strings.Contains(w.Body.String(), `data-auto-submit`) || !strings.Contains(w.Body.String(), `value="`+a.Sqid+`" selected`) {
+ t.Fatalf("selected account was not resumed: %s", w.Body)
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("GET claimed")
+ }
+ if w = b.post("/demo/claim/select", url.Values{"accountId": {a.Sqid}}); w.Code != 303 {
+ t.Fatalf("auto POST: %d %s", w.Code, w.Body)
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 1 {
+ t.Fatal("want exactly one reservation")
+ }
+ hash, err := s.store.demoClaimBrowserHash(t.Context(), b.cookie, time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ op, err := s.store.demoClaimOpForFlow(t.Context(), hash)
+ if err != nil || op.Target.Sqid != a.Sqid {
+ t.Fatalf("wrong destination: %+v %v", op, err)
+ }
+ w = b.request("GET", "/demo/claim", nil)
+ if !strings.Contains(w.Body.String(), demoClaimWorking) {
+ t.Fatal("no claiming state")
+ }
+ b.post("/demo/claim/select", url.Values{"accountId": {a.Sqid}})
+ if claimBrowserCount(t, s, "demo_claim_ops") != 1 {
+ t.Fatal("duplicate reservation")
+ }
+ })
+ }
+}
+
+func claimResumeSelection(t *testing.T, b *claimBrowser, form url.Values) *http.Cookie {
+ t.Helper()
+ form.Set("nonce", b.nonce)
+ r := httptest.NewRequest("GET", "/auth/stepup/callback", nil)
+ r.AddCookie(&http.Cookie{Name: sessionCookie, Value: b.session})
+ w := httptest.NewRecorder()
+ b.s.resume(w, r, &pendingAction{Method: "POST", Path: "/demo/claim/select", Form: form.Encode()})
+ for _, c := range w.Result().Cookies() {
+ if c.Path == "/demo/claim" {
+ if !c.HttpOnly || !c.Secure || c.SameSite != http.SameSiteLaxMode || c.MaxAge != 120 || strings.Contains(c.Value, b.session) {
+ t.Fatalf("unsafe selection cookie: %+v", c)
+ }
+ b.cookies[c.Name] = c
+ return c
+ }
+ }
+ t.Fatal("resume did not set a selection cookie")
+ return nil
+}
+
+func TestDemoClaimSelectStepUpWrongDemo(t *testing.T) {
+ for _, afterMarker := range []bool{false, true} {
+ name := "beforeCallback"
+ if afterMarker {
+ name = "afterMarker"
+ }
+ t.Run(name, func(t *testing.T) {
+ s, _, tokenA := claimTestServer(t)
+ claimStepUpStub(t, s)
+ inB := demoTestAdmission(t, s.cfg.Demo)
+ if _, err := s.store.ReserveDemo(t.Context(), inB); err != nil {
+ t.Fatal(err)
+ }
+ b := newClaimBrowser(t, s, tokenA)
+ b.login("claimant@example.com", MethodKeymail, false)
+ a := claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ b.request("GET", "/demo/claim", nil)
+ staleNonce := b.nonce
+ w := b.post("/demo/claim/select", url.Values{"accountId": {a.Sqid}})
+ if w.Code != 303 || claimBrowserCount(t, s, "pending_actions") != 1 || claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatalf("demo A did not stop at step-up: %d", w.Code)
+ }
+ callback := w.Header().Get("Location")
+ finish := func() {
+ t.Helper()
+ w := claimFinishKeymail(t, b, callback)
+ if w.Code != 303 || w.Header().Get("Location") != "/demo/claim" || claimBrowserCount(t, s, "pending_actions") != 0 {
+ t.Fatalf("step-up callback: %d %s", w.Code, w.Header().Get("Location"))
+ }
+ }
+ if afterMarker {
+ finish()
+ w := b.request("GET", "/demo/claim", nil)
+ if !strings.Contains(w.Body.String(), "data-auto-submit") {
+ t.Fatal("demo A selection did not render its marker")
+ }
+ staleNonce = b.nonce
+ }
+ if w := b.post("/demo/claim/intent", url.Values{"claimToken": {inB.Identity.Token}}); w.Code != 303 {
+ t.Fatalf("demo B intent: %d %s", w.Code, w.Body)
+ }
+ if !afterMarker {
+ finish()
+ }
+ w = b.request("GET", "/demo/claim", nil)
+ if w.Code != 200 || strings.Contains(w.Body.String(), "data-auto-submit") || !strings.Contains(w.Body.String(), `action="/demo/claim/select"`) {
+ t.Fatal("demo B must retain the manual form without an auto-submit marker")
+ }
+ hash, err := s.store.demoClaimBrowserHash(t.Context(), b.cookie, time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ flow, err := s.store.demoClaimFlowByHash(t.Context(), hash, time.Now())
+ demoB, lookupErr := s.store.LookupDemoToken(t.Context(), inB.Identity.Token)
+ if err != nil || lookupErr != nil || flow.DemoID != demoB.ID || b.nonce == staleNonce {
+ t.Fatalf("manual form is not bound to demo B: %+v %v %v", flow, err, lookupErr)
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("switching demos or rendering reserved a claim")
+ }
+ if afterMarker {
+ w = b.request("POST", "/demo/claim/select", url.Values{"accountId": {a.Sqid}, "nonce": {staleNonce}, "csrf": {b.session}})
+ if w.Code != 403 || !strings.Contains(w.Body.String(), demoClaimWrongSite) || claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatalf("stale demo A form was not refused: %d", w.Code)
+ }
+ }
+ })
+ }
+}
+
+func TestDemoClaimResumedSelectionGates(t *testing.T) {
+ for _, which := range []string{"absent", "forged", "otherSession", "expired", "otherFlow", "removedAccount", "demotedAccount", "newMembership", "valid", "create", "csrf", "nonce", "staleAuth"} {
+ t.Run(which, func(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ fk := claimStepUpStub(t, s)
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodKeymail, true)
+ form := url.Values{"create": {"1"}}
+ if which != "create" && which != "newMembership" {
+ a := claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ form = url.Values{"accountId": {a.Sqid}}
+ }
+ b.request("GET", "/demo/claim", nil)
+ if which != "absent" {
+ c := claimResumeSelection(t, b, form)
+ switch which {
+ case "forged":
+ c.Value += "tampered"
+ case "otherSession":
+ b.login("claimant@example.com", MethodKeymail, true)
+ b.cookies[c.Name] = c
+ case "expired":
+ c.Value = s.demoClaimSelectionValue(b.session, form, time.Now().Add(-3*time.Minute))
+ case "otherFlow":
+ other := newClaimBrowser(t, s, token)
+ b.cookie = other.cookie
+ case "demotedAccount":
+ if _, err := s.store.db.Exec(`UPDATE memberships SET role=? WHERE account_id=501`, "viewer"); err != nil {
+ t.Fatal(err)
+ }
+ case "newMembership":
+ claimAccount(t, s, 502, "claimant@example.com", RoleOwner)
+ case "removedAccount":
+ // Preserve a different choice so the stale account cannot become create=1.
+ claimAccount(t, s, 502, "claimant@example.com", RoleOwner)
+ if _, err := s.store.db.Exec(`DELETE FROM memberships WHERE account_id=501`); err != nil {
+ t.Fatal(err)
+ }
+ }
+ }
+ w := b.request("GET", "/demo/claim", nil)
+ auto := strings.Contains(w.Body.String(), "data-auto-submit")
+ want := which == "valid" || which == "create" || which == "csrf" || which == "nonce" || which == "staleAuth"
+ if auto != want {
+ t.Fatalf("auto-submit=%v want %v", auto, want)
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("GET reserved")
+ }
+ var proved int
+ if err := s.store.db.QueryRow(`SELECT count(*) FROM demo_claim_flows WHERE person!=''`).Scan(&proved); err != nil || proved != 0 {
+ t.Fatal("GET proved identity", err)
+ }
+ if strings.Contains(b.request("GET", "/demo/claim", nil).Body.String(), "data-auto-submit") {
+ t.Fatal("reload replayed selection after cookie clear")
+ }
+ switch which {
+ case "create":
+ if w := b.post("/demo/claim/select", form); w.Code != 303 || claimBrowserCount(t, s, "demo_claim_ops") != 1 {
+ t.Fatalf("resumed create: %d %s", w.Code, w.Body)
+ }
+ case "csrf", "nonce":
+ form.Set("nonce", b.nonce)
+ form.Set("csrf", b.session)
+ form.Del(which)
+ if w := b.request("POST", "/demo/claim/select", form); w.Code != 403 {
+ t.Fatalf("missing %s: %d", which, w.Code)
+ }
+ case "removedAccount", "demotedAccount", "newMembership":
+ if w := b.post("/demo/claim/select", form); w.Code != 404 {
+ t.Fatalf("removed account: %d", w.Code)
+ }
+ case "staleAuth":
+ if err := s.store.ClearStepUp(b.session); err != nil {
+ t.Fatal(err)
+ }
+ w := b.post("/demo/claim/select", form)
+ if w.Code != 303 || !strings.HasPrefix(w.Header().Get("Location"), fk.srv.URL) {
+ t.Fatalf("stale auto POST skipped step-up: %d", w.Code)
+ }
+ if strings.Contains(b.request("GET", "/demo/claim", nil).Body.String(), "data-auto-submit") {
+ t.Fatal("automatic retry loop")
+ }
+ if claimBrowserCount(t, s, "pending_actions") != 1 {
+ t.Fatal("wrong repeated step-up count")
+ }
+ }
+ })
+ }
+}
+
+func TestDemoClaimResumedSelectionCopiedCookieReplay(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodKeymail, true)
+ a := claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ c := claimResumeSelection(t, b, url.Values{"accountId": {a.Sqid}})
+ if !strings.Contains(b.request("GET", "/demo/claim", nil).Body.String(), "data-auto-submit") {
+ t.Fatal("first use did not resume")
+ }
+ b.cookies[c.Name] = c
+ if strings.Contains(b.request("GET", "/demo/claim", nil).Body.String(), "data-auto-submit") {
+ t.Fatal("copied cookie replayed after clear")
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("GET reserved")
+ }
+}
+
+func TestDemoClaimResumedSelectionConcurrentGET(t *testing.T) {
+ s, _, token := claimTestServer(t)
+ b := newClaimBrowser(t, s, token)
+ b.login("claimant@example.com", MethodKeymail, true)
+ a := claimAccount(t, s, 501, "claimant@example.com", RoleOwner)
+ c := claimResumeSelection(t, b, url.Values{"accountId": {a.Sqid}})
+ results := make(chan bool, 2)
+ for i := 0; i < 2; i++ {
+ go func() {
+ r := httptest.NewRequest("GET", "/demo/claim", nil)
+ r.AddCookie(c)
+ r.AddCookie(&http.Cookie{Name: sessionCookie, Value: b.session})
+ r.AddCookie(&http.Cookie{Name: demoClaimBrowserCookie, Value: b.cookie})
+ w := httptest.NewRecorder()
+ s.mux.ServeHTTP(w, r)
+ results <- strings.Contains(w.Body.String(), "data-auto-submit")
+ }()
+ }
+ n := 0
+ for i := 0; i < 2; i++ {
+ if <-results {
+ n++
+ }
+ }
+ if n != 1 {
+ t.Fatalf("concurrent GETs resumed %d times", n)
+ }
+ if claimBrowserCount(t, s, "demo_claim_ops") != 0 {
+ t.Fatal("GET reserved")
+ }
+}
diff --git a/internal/console/demo_claim_selection.go b/internal/console/demo_claim_selection.go
new file mode 100644
index 000000000..d246cbbd4
--- /dev/null
+++ b/internal/console/demo_claim_selection.go
@@ -0,0 +1,110 @@
+package console
+
+import (
+ "crypto/hmac"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/json"
+ "net/http"
+ "net/url"
+ "strings"
+ "sync"
+ "time"
+)
+
+const demoClaimSelectionCookie = "carlos_demo_claim_selection"
+const demoClaimSelectionTTL = 2 * time.Minute
+
+type demoClaimSelection struct {
+ ID string `json:"id"`
+ Account string `json:"account,omitempty"`
+ Create bool `json:"create,omitempty"`
+ Nonce string `json:"nonce"`
+ Expires int64 `json:"expires"`
+}
+
+// A receipt is only a one-use rendering hint, never claim authority. Keep one
+// per session and prune expired entries on issuance; a restart loses the hint
+// and leaves the ordinary confirmation form. No durable state changes on GET.
+type demoClaimSelectionReceipts struct {
+ mu sync.Mutex
+ entries map[string]demoClaimSelectionReceipt
+}
+
+type demoClaimSelectionReceipt struct {
+ digest string
+ expires time.Time
+}
+
+func (s *Server) demoClaimSelectionMAC(session, payload string) []byte {
+ mac := hmac.New(sha256.New, s.store.codeKey)
+ mac.Write([]byte("demo-claim-selection:" + hashToken(session) + ":" + payload))
+ return mac.Sum(nil)
+}
+
+func (s *Server) demoClaimSelectionValue(session string, form url.Values, now time.Time) string {
+ id, err := randomToken()
+ if err != nil || len(s.store.codeKey) == 0 {
+ return ""
+ }
+ selection := demoClaimSelection{ID: id, Account: form.Get("accountId"), Create: form.Get("create") == "1", Nonce: form.Get("nonce"), Expires: now.Add(demoClaimSelectionTTL).Unix()}
+ if session == "" || selection.Nonce == "" || selection.Create != (selection.Account == "") {
+ return ""
+ }
+ payload, _ := json.Marshal(selection)
+ encoded := base64.RawURLEncoding.EncodeToString(payload)
+ return encoded + "." + base64.RawURLEncoding.EncodeToString(s.demoClaimSelectionMAC(session, encoded))
+}
+
+func (s *Server) setDemoClaimSelection(w http.ResponseWriter, session string, form url.Values) {
+ now := time.Now()
+ value := s.demoClaimSelectionValue(session, form, now)
+ if value == "" {
+ return
+ }
+ receipts := &s.demoClaimSelections
+ receipts.mu.Lock()
+ if receipts.entries == nil {
+ receipts.entries = make(map[string]demoClaimSelectionReceipt)
+ }
+ for key, entry := range receipts.entries {
+ if !entry.expires.After(now) {
+ delete(receipts.entries, key)
+ }
+ }
+ receipts.entries[hashToken(session)] = demoClaimSelectionReceipt{digest: hashToken(value), expires: now.Add(demoClaimSelectionTTL)}
+ receipts.mu.Unlock()
+ http.SetCookie(w, &http.Cookie{Name: demoClaimSelectionCookie, Value: value, Path: "/demo/claim", HttpOnly: true, Secure: true, SameSite: http.SameSiteLaxMode, MaxAge: 120, Expires: now.Add(demoClaimSelectionTTL)})
+}
+
+func (s *Server) takeDemoClaimSelection(w http.ResponseWriter, r *http.Request, session, nonce string) (demoClaimSelection, bool) {
+ c, err := r.Cookie(demoClaimSelectionCookie)
+ if err != nil {
+ return demoClaimSelection{}, false
+ }
+ http.SetCookie(w, &http.Cookie{Name: demoClaimSelectionCookie, Path: "/demo/claim", HttpOnly: true, Secure: true, SameSite: http.SameSiteLaxMode, MaxAge: -1, Expires: time.Unix(1, 0)})
+ payload, signature, ok := strings.Cut(c.Value, ".")
+ mac, err := base64.RawURLEncoding.DecodeString(signature)
+ if !ok || err != nil || session == "" || !hmac.Equal(mac, s.demoClaimSelectionMAC(session, payload)) {
+ return demoClaimSelection{}, false
+ }
+ raw, err := base64.RawURLEncoding.DecodeString(payload)
+ var selection demoClaimSelection
+ if err != nil || json.Unmarshal(raw, &selection) != nil {
+ return demoClaimSelection{}, false
+ }
+ now := time.Now().Unix()
+ if selection.Expires <= now || selection.Expires > now+int64(demoClaimSelectionTTL.Seconds()) || selection.Nonce != nonce || selection.Create != (selection.Account == "") {
+ return demoClaimSelection{}, false
+ }
+ receipts := &s.demoClaimSelections
+ receipts.mu.Lock()
+ defer receipts.mu.Unlock()
+ key := hashToken(session)
+ receipt, ok := receipts.entries[key]
+ if !ok || receipt.digest != hashToken(c.Value) || !receipt.expires.After(time.Now()) {
+ return demoClaimSelection{}, false
+ }
+ delete(receipts.entries, key)
+ return selection, true
+}
diff --git a/internal/console/icons_test.go b/internal/console/icons_test.go
index 61a8785f4..12fa98230 100644
--- a/internal/console/icons_test.go
+++ b/internal/console/icons_test.go
@@ -63,6 +63,7 @@ func TestSwitcherChromeIsInlineSVGNotTextGlyphs(t *testing.T) {
// origin only, through the {{asset "..."}} template func (/static/{hash}/...).
// sameOriginAssetTags is the exact shape it may use. The demo claim page
// may load only its embedded demo_claim.js through the same asset helper.
+// Its shared console styles are inline and covered by an exact CSP hash.
func TestConsoleTemplatesFetchNothingOffOrigin(t *testing.T) {
err := fs.WalkDir(tmplFS, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() {
@@ -234,6 +235,9 @@ func TestDemoClaimTemplateRefusesOtherSubresources(t *testing.T) {
`<script src="{{asset "demo_claim.js"}}" data-url="https://example.com"></script>`,
`<script src="{{asset "other.js"}}"></script>`,
`<img src="https://example.com/image.png">`,
+ `<link rel="stylesheet" href="{{asset "ops.css"}}">`,
+ `<link rel="stylesheet" href="https://example.com/theme.css">`,
+ `<link rel="preload" href="https://example.com/font.woff2">`,
} {
if got := offOriginFetches(path, allowed+tag); len(got) == 0 {
t.Errorf("allowed %s", tag)
diff --git a/internal/console/keymail.go b/internal/console/keymail.go
index 0de8cb89d..5aa2e17fc 100644
--- a/internal/console/keymail.go
+++ b/internal/console/keymail.go
@@ -27,6 +27,7 @@ import (
"fmt"
"io"
"net/http"
+ "net/netip"
"net/url"
"strconv"
"strings"
@@ -69,6 +70,39 @@ func NewKeymail(baseURL, origin string) *Keymail {
}
}
+// Origin is the configured redirect origin, including its explicit port.
+func (k *Keymail) Origin() string {
+ if k == nil {
+ return ""
+ }
+ u, err := url.Parse(k.base)
+ if err != nil || (u.Scheme != "https" && u.Scheme != "http") || u.Host == "" {
+ return ""
+ }
+ host := u.Hostname()
+ if host == "" {
+ return ""
+ }
+ if strings.HasPrefix(u.Host, "[") {
+ ip, err := netip.ParseAddr(host)
+ if err != nil || !ip.Is6() || ip.Zone() != "" {
+ return ""
+ }
+ } else {
+ for _, c := range host {
+ if !(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '-' || c == '.') {
+ return ""
+ }
+ }
+ }
+ for _, c := range u.Port() {
+ if c < '0' || c > '9' {
+ return ""
+ }
+ }
+ return u.Scheme + "://" + u.Host
+}
+
// Host is the hostname of the configured Keymail deployment (keymail.dev for
// https://keymail.dev), lowercased, no port. An address at this host is a
// Keymail address whatever a lookup says.
diff --git a/internal/console/keymail_origin_test.go b/internal/console/keymail_origin_test.go
new file mode 100644
index 000000000..0d66f5d6a
--- /dev/null
+++ b/internal/console/keymail_origin_test.go
@@ -0,0 +1,48 @@
+package console
+
+import "testing"
+
+func TestKeymailOrigin(t *testing.T) {
+ for _, tt := range []struct{ base, want string }{
+ {"https://keymail.dev", "https://keymail.dev"},
+ {"http://127.0.0.1:12345", "http://127.0.0.1:12345"},
+ {"https://mail-2.example.com:8443/path?q=1#fragment", "https://mail-2.example.com:8443"},
+ {"https://KEYMAIL.dev.", "https://KEYMAIL.dev."},
+ {"http://[::1]:12345", "http://[::1]:12345"},
+ {"https://[2001:db8::1]", "https://[2001:db8::1]"},
+ {"https://keymail.dev:", "https://keymail.dev:"},
+ {"https://*.example.com", ""},
+ {"https://*", ""},
+ {"https://keymail.dev;sandbox", ""},
+ {"https://a'b", ""},
+ {"https://a,b", ""},
+ {"https://:443", ""},
+ {"https://mail_example.com", ""},
+ {"https://[keymail.dev]", ""},
+ {"https://[127.0.0.1]", ""},
+ {"https://::1", ""},
+ {"https://[fe80::1%25eth0]", ""},
+ {"https://keymail.dev:port", ""},
+ {"https://keymail.dev:*", ""},
+ {"https://keymail.dev:12;script-src", ""},
+ {"https://keymail.dev:12:34", ""},
+ {"https://keymail.dev bad", ""},
+ {"https://keymail.dev\r\nX-Test: bad", ""},
+ {"https://%2a.example.com", ""},
+ {"https://[::1", ""},
+ {"https:///path", ""},
+ {"//keymail.dev", ""},
+ {"ftp://keymail.dev", ""},
+ {"javascript:alert(1)", ""},
+ {"", ""},
+ } {
+ t.Run(tt.base, func(t *testing.T) {
+ if got := NewKeymail(tt.base, "").Origin(); got != tt.want {
+ t.Errorf("Origin() = %q, want %q", got, tt.want)
+ }
+ })
+ }
+ if got := (*Keymail)(nil).Origin(); got != "" {
+ t.Errorf("nil Origin() = %q", got)
+ }
+}
diff --git a/internal/console/server.go b/internal/console/server.go
index 101640147..e794a6890 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -1259,6 +1259,7 @@ type Server struct {
limits emailLimits
// flowLocks serialise /auth/continue per sign-in flow (flowLock).
flowLocks [256]sync.Mutex
+ demoClaimSelections demoClaimSelectionReceipts
demoClaimBoundary func(string) error // Test-only crash injection after durable boundaries.
demoClaimTestEnabled bool // Test-only readiness bypass.
// challengeSem bounds the sign-in and step-up sends in flight
diff --git a/internal/console/static/demo_claim.js b/internal/console/static/demo_claim.js
index f25a17706..1fc375de6 100644
--- a/internal/console/static/demo_claim.js
+++ b/internal/console/static/demo_claim.js
@@ -2,7 +2,29 @@
"use strict";
let token = location.hash.slice(1);
history.replaceState(null, "", "/demo/claim");
- if (!token) return;
+ for (const form of document.querySelectorAll("form")) {
+ form.addEventListener("submit", () => {
+ for (const button of form.querySelectorAll('button[type="submit"]')) {
+ button.disabled = true;
+ }
+ });
+ }
+ if (!token) {
+ const selection = document.querySelector("form[data-auto-submit]");
+ if (selection) {
+ selection.removeAttribute("data-auto-submit");
+ const status = document.getElementById("claim-resuming");
+ try {
+ if (selection.checkValidity()) {
+ status.hidden = false;
+ selection.requestSubmit();
+ }
+ } catch (_) {
+ status.hidden = true;
+ }
+ }
+ return;
+ }
const form = new URLSearchParams({
claimToken: token,
nonce: document.querySelector('input[name="nonce"]').value,
diff --git a/internal/console/stepup.go b/internal/console/stepup.go
index b0684c7a0..8af605d43 100644
--- a/internal/console/stepup.go
+++ b/internal/console/stepup.go
@@ -464,8 +464,12 @@ func (s *Server) resume(w http.ResponseWriter, r *http.Request, p *pendingAction
return
}
// The claim-only cookie cannot reach /auth. Return to its path after
- // proof, where the person confirms with that cookie and a fresh nonce.
+ // proof with the explicit selection already confirmed before step-up.
+ // Only this consumed select stash can request a browser POST; OAuth alone cannot.
if p.Path == "/demo/claim/select" {
+ if p.Method == http.MethodPost {
+ s.setDemoClaimSelection(w, raw, form)
+ }
http.Redirect(w, r, "/demo/claim", http.StatusSeeOther)
return
}
diff --git a/internal/console/templates/console_chrome.html b/internal/console/templates/console_chrome.html
new file mode 100644
index 000000000..6c762daa3
--- /dev/null
+++ b/internal/console/templates/console_chrome.html
@@ -0,0 +1,1149 @@
+{{define "console_styles"}}
+{{template "fiesta_day" .}}
+ /* Native controls (number spinners, checkboxes, selects, scrollbars)
+ follow the theme, so they stay visible on the dark background. */
+ :root { color-scheme: light dark; }
+ :root {
+ --rst-radius: 0.6rem; --rst-radius-sm: 0.4rem;
+ --rst-bg: light-dark(#ffffff, #0c0d0f);
+ --rst-surface: light-dark(#ffffff, #141518);
+ --rst-surface-2: light-dark(#f7f7f8, #18191d);
+ --rst-line: light-dark(#e6e6ea, #26282e);
+ --rst-line-strong: light-dark(#868691, #71737c);
+ --rst-text: light-dark(#202126, #ededf0);
+ --rst-text-muted: light-dark(#60616b, #a1a1aa);
+ --rst-accent: light-dark(#6f2c65, #d7a0cd);
+ --rst-accent-strong: light-dark(#55204d, #ecc0e4);
+ --rst-accent-soft: light-dark(rgba(111, 44, 101, 0.08), rgba(215, 160, 205, 0.12));
+ --rst-accent-fill: light-dark(#6f2c65, #864078);
+ --rst-accent-fill-hover: light-dark(#5a2352, #743367);
+ --rst-accent-fill-edge: light-dark(#491b42, #52234a);
+ --rst-accent-fill-edge-hover: light-dark(#391433, #411b3a);
+ --rst-control-face: var(--rst-surface);
+ --rst-control-face-hover: light-dark(#f7f8fa, #1b1d22);
+ --rst-control-face-press: light-dark(#e6e9ee, #202329);
+ --rst-control-border: light-dark(#d0d4dc, #343843);
+ --rst-control-border-hover: light-dark(#8a8a95, #71737c);
+ --rst-depth-hl: light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.07));
+ --rst-depth-contact: light-dark(rgba(16, 24, 40, 0.12), rgba(0, 0, 0, 0.5));
+ --rst-depth-ambient: light-dark(rgba(16, 24, 40, 0.06), rgba(0, 0, 0, 0.35));
+ --rst-depth-face: 0.06;
+ --rack-edge: light-dark(#d9cde0, #392b43);
+ --panel-cool: light-dark(#faf7fb, #1c1823);
+ --wire: light-dark(#a4a4af, #686a76);
+ --field: light-dark(#fafafb, #101114);
+ --shadow-module: inset 1px 1px 0 var(--rst-depth-hl), 1px 2px 0 var(--rack-edge), 2px 5px 8px -3px var(--rst-depth-ambient);
+ --shadow-raised: inset 0 1px 0 var(--rst-depth-hl), 0 1px 0 var(--rack-edge), 0 2px 3px -1px var(--rst-depth-ambient);
+ --shadow-inset: inset 0 1px 2px var(--rst-depth-contact);
+ --bg: var(--rst-surface); --ink: var(--rst-text); --muted: var(--rst-text-muted);
+ --accent: var(--rst-accent); --accent-strong: var(--rst-accent-strong);
+ --accent-soft: var(--rst-accent-soft);
+ --rule: var(--rst-line); --bad: var(--rst-tone-negative-fg);
+ --warn: var(--rst-tone-warning-fg); --good: var(--rst-tone-positive-fg);
+ --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ --sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
+ }
+ [hidden] { display: none !important; }
+ * { margin: 0; padding: 0; box-sizing: border-box; }
+ body {
+ background: var(--rst-bg); color: var(--ink);
+ font: 400 1rem/1.6 var(--sans);
+ -webkit-font-smoothing: antialiased; padding: 0 1.25rem;
+ }
+ a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
+ code {
+ font-family: var(--mono);
+ font-size: 0.88em; background: var(--accent-soft);
+ padding: 0.1em 0.35em; border-radius: 0.25rem;
+ }
+ pre {
+ background: var(--accent-soft); border-radius: 0.5rem;
+ padding: 0.9rem 1.1rem; margin: 0 0 1rem; max-width: 40rem;
+ overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6;
+ }
+ pre code { background: none; padding: 0; }
+ /* A tag's changelog and a release's notes are prose, not code — long lines
+ should wrap inside the box rather than force the horizontal scrollbar
+ every other <pre> on this page gets for a shell command. */
+ .changelog { white-space: pre-wrap; }
+ select, input[type=text], input[type=search], input[type=email], input[type=number] {
+ font: inherit; font-family: var(--sans); font-size: 0.9rem; color: var(--ink); background: var(--field);
+ border: 1px solid var(--rst-line-strong); border-radius: var(--rst-radius-sm); padding: 0.3rem 0.5rem;
+ box-shadow: var(--shadow-inset);
+ }
+ select:disabled, input:disabled {
+ background: var(--rst-surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed;
+ }
+ /* One focus ring for every control, drawn outside the raised edge. Where a
+ scrolling box would clip it, it is drawn just inside instead. */
+ :where(a, button, .btn, select, summary, input:not([type=radio]):not([type=checkbox])):focus-visible {
+ outline: 2px solid var(--accent); outline-offset: 2px;
+ }
+ :where(input:not([type=radio]):not([type=checkbox]), select):focus-visible { outline-offset: 1px; }
+ .tablewrap :where(a, button, select, input):focus-visible,
+ .settings-nav a:focus-visible, header .switcher-menu a:focus-visible { outline-offset: -2px; }
+ td form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin: 0; }
+ /* A form living inside a sentence (the bake toggle, a rung's fast-track):
+ it must not break the line it is part of. */
+ form.inline { display: inline; margin: 0; }
+ form.inline button { vertical-align: baseline; }
+ /* A list's filter row (the Running tab): every control the same height on
+ one line, wrapping onto the next when the screen is too narrow. */
+ .toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
+ .toolbar input, .toolbar select, .toolbar button { height: 2rem; margin: 0; }
+ /* economics_accounts.html (a frozen operator page) still says listctl. */
+ .listctl { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
+ .toolbar label { display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%; font-size: 0.9rem; color: var(--muted); }
+ .toolbar select, .toolbar input[type=search], .toolbar input[type=text] { max-width: 100%; min-width: 0; }
+ #logs-filter select[name="host"] { max-width: 12rem; }
+ /* A section heading with its one action at the right end of the row. */
+ .sectionhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 0.75rem; }
+ .sectionhead h2 { margin: 0; }
+ /* Interface icons: inline SVG from internal/console/icons.go — Lucide,
+ vendored, because this page fetches nothing from anywhere. They carry no
+ width/height of their own, so they size to the text beside them and
+ inherit its colour. */
+ .icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
+ header {
+ max-width: 64rem; margin: 0 auto; padding: 1rem 0;
+ display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; row-gap: 0.5rem;
+ border-top: 3px solid var(--accent); border-bottom: 1px solid var(--rule);
+ }
+ header .brand a { font-weight: 700; color: var(--ink); text-decoration: none; }
+ header nav {
+ margin-left: auto; display: flex; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap;
+ font-size: 0.9rem;
+ }
+ /* The profile menu: a <details> like the switcher, so it works with no
+ JavaScript. Its summary is the signed-in address as an icon button;
+ the menu holds the address (a link to settings) and Sign out. */
+ header .profile { position: relative; flex: none; }
+ header .profile > summary {
+ display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem;
+ list-style: none; cursor: pointer; min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.6rem;
+ border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius-sm);
+ background-color: var(--rst-control-face); color: var(--muted); box-shadow: var(--shadow-raised);
+ font-size: 1.1rem;
+ }
+ header .profile > summary::-webkit-details-marker { display: none; }
+ header .profile > summary:hover { background-color: var(--rst-control-face-hover); color: var(--ink); }
+ header .profile[open] > summary { background-color: var(--rst-control-face-press); color: var(--ink); box-shadow: var(--shadow-inset); }
+ header .profile > summary > .icon { pointer-events: none; }
+ header .profile > summary > .icon + .icon { width: 0.7em; height: 0.7em; }
+ header .profile[open] > summary > .icon + .icon { transform: rotate(180deg); }
+ header .profile-menu {
+ position: absolute; z-index: 20; top: calc(100% + 0.5rem); right: 0;
+ width: max-content; min-width: 13rem; max-width: min(20rem, calc(100vw - 2.5rem));
+ display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem;
+ background: var(--bg); border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius);
+ padding: 0.35rem; font-size: 0.9rem;
+ box-shadow: var(--rst-shadow-pop), 1px 2px 0 var(--rack-edge);
+ }
+ header .profile-menu .addr, header .profile-menu button.linkish {
+ display: flex; align-items: center; min-height: 2.75rem; padding: 0.4rem 0.55rem;
+ border-radius: var(--rst-radius-sm); text-align: left; overflow-wrap: anywhere;
+ }
+ header .profile-menu .addr { color: var(--muted); }
+ header .profile-menu :is(.addr, button.linkish):hover { background: var(--accent-soft); }
+ header .profile-menu :is(.addr, button.linkish):focus-visible { outline-offset: -2px; }
+ header .profile-menu form { margin: 0; }
+ header .profile-menu button.linkish { width: 100%; }
+ header .mobile-root { display: none; }
+ /* The account switcher sits where the wordmark used to: a <details>
+ disclosure, so it is a real button to a screen reader, opens on
+ Enter/Space, and needs no JavaScript to work at all. The inline script
+ at the foot only adds Escape and click-away, which are enhancements. */
+ header .switcher {
+ position: relative;
+ }
+ header .switcher > summary {
+ display: inline-flex; align-items: baseline; gap: 0.4rem;
+ list-style: none; cursor: pointer;
+ padding: 0.25rem 0.6rem; border-radius: var(--rst-radius-sm);
+ background-color: var(--rst-control-face); color: var(--accent-strong);
+ border: 1px solid var(--rst-control-border); box-shadow: var(--shadow-raised);
+ }
+ header .switcher > summary .small { color: inherit; }
+ header .switcher > summary::-webkit-details-marker { display: none; }
+ header .switcher > summary:hover { background-color: var(--rst-control-face-hover); }
+ header .switcher[open] > summary {
+ background-color: var(--accent-soft);
+ box-shadow: var(--shadow-inset);
+ }
+ /* Names are free text up to 64 characters, which unbounded would shove the
+ nav off the header — truncate in the trigger, wrap in the menu. */
+ header .switcher .current-name {
+ font-weight: 700; min-width: 0; max-width: 14rem;
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+ }
+ /* The caret is an icon, not a text character: centred against a
+ baseline-aligned row and flipped while the menu is open. */
+ header .switcher > summary > .icon { color: currentColor; align-self: center; width: 0.9em; }
+ header .switcher[open] > summary > .icon { transform: rotate(180deg); }
+ header .switcher-menu {
+ position: absolute; z-index: 20; top: calc(100% + 0.5rem); left: 0;
+ /* max-content, not shrink-to-fit: the menu's containing block is the
+ narrow trigger, so shrink-to-fit pinned it at min-width and wrapped
+ any name longer than that mid-word. */
+ width: max-content; min-width: 13rem; max-width: 20rem;
+ background: var(--bg); border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius);
+ padding: 0.35rem; font-size: 0.9rem;
+ box-shadow: var(--rst-shadow-pop), 1px 2px 0 var(--rack-edge);
+ }
+ /* Someone in dozens of accounts gets a list that scrolls inside the menu
+ instead of running off the bottom of the screen. */
+ header .switcher-menu ul {
+ list-style: none; margin: 0; padding: 0;
+ max-height: min(22rem, 60vh); overflow-y: auto; overscroll-behavior: contain;
+ }
+ /* The filter box only renders past a handful of accounts, and stays
+ hidden until the script at the foot shows it: with JS off it could not
+ filter anything. */
+ header .switcher-find { display: block; width: 100%; margin: 0 0 0.35rem; }
+ header .switcher-none { padding: 0.35rem 0.55rem; color: var(--muted); }
+ header .switcher-menu a, header .switcher-menu .current {
+ display: flex; align-items: baseline; gap: 0.5rem;
+ padding: 0.35rem 0.55rem; border-radius: 0.4rem;
+ color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
+ }
+ header .switcher-menu a:hover, header .switcher-menu a:focus { background: var(--accent-soft); }
+ header .switcher-menu .current { font-weight: 600; background: var(--accent-soft); }
+ /* The mark column reserves its width on every row so the names stay in one
+ column: a check on the account you are in, hidden on the ones you are
+ not, a plus on "New account". */
+ header .switcher-menu .mark {
+ color: var(--accent); width: 0.9rem; flex: none;
+ display: flex; align-self: center;
+ }
+ header .switcher-menu a .mark { visibility: hidden; }
+ header .switcher-menu .new a .mark { visibility: visible; }
+ header .switcher-menu hr { border: 0; border-top: 1px solid var(--rule); margin: 0.35rem 0.2rem; }
+ header .switcher-menu .new a { color: var(--accent); }
+ main { max-width: 64rem; margin: 0 auto; padding: 2.5rem 0 3rem; min-height: 55vh; }
+ h1 { overflow-wrap: anywhere; font-size: 1.9rem; line-height: 1.15; margin: 0 0 1rem; color: var(--accent-strong); }
+ h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
+ h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
+ /* Settings: an input-and-button row, and the deletion section's heading
+ in the ink that says be careful. */
+ .settings-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 0 0 0.75rem; }
+ .settings-layout {
+ display: grid; grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
+ gap: 2.5rem; align-items: start;
+ }
+ .settings-nav { display: flex; flex-direction: column; gap: 0.2rem; }
+ .settings-nav a {
+ display: block; padding: 0.45rem 0.65rem; border-radius: 0.35rem;
+ color: var(--muted); text-decoration: none;
+ }
+ .settings-nav a:hover { color: var(--ink); background: var(--accent-soft); }
+ .settings-nav a[aria-current="page"] {
+ color: var(--ink); background: var(--accent-soft); font-weight: 600;
+ }
+ .settings-content {
+ min-width: 0; padding: 1.25rem 1.5rem 0.5rem; background-color: var(--bg);
+ border: 1px solid var(--rule); border-radius: var(--rst-radius); box-shadow: var(--shadow-module);
+ }
+ .settings-content :is(.tile, .tablewrap, .rung) { background-color: var(--rst-surface-2); box-shadow: none; }
+ .settings-content > h2:first-child { margin-top: 0; }
+ .danger-head { color: var(--bad); }
+ p { max-width: 40rem; margin: 0 0 1rem; }
+ .lede { font-size: 1.15rem; color: var(--muted); }
+ .small { font-size: 0.9rem; color: var(--muted); }
+ /* Present to a screen reader, absent to the eye — for labels the visual
+ design carries in placement or placeholder text alone. */
+ .visually-hidden {
+ position: absolute; width: 1px; height: 1px; overflow: hidden;
+ clip-path: inset(50%); white-space: nowrap;
+ }
+ .error { color: var(--bad); }
+ .banner {
+ background: var(--accent-soft); border-radius: 0.5rem;
+ padding: 0.6rem 0.9rem; margin: 0 0 1.5rem; max-width: 40rem;
+ }
+ :where(main) :where(ul:not([class]), ol:not([class]), ul.small, ol.small) { padding-left: 1.25rem; margin: 0 0 1rem; }
+ .tablewrap {
+ overflow-x: auto; margin: 0 0 1rem; background-color: var(--bg);
+ border: 1px solid var(--rule); border-radius: var(--rst-radius); box-shadow: var(--shadow-module);
+ }
+ .tablewrap > table:not(.packs) { margin: 0; }
+ .tablewrap > table:not(.packs) :is(th, td):first-child { padding-left: 0.9rem; }
+ .tablewrap > table:not(.packs) > :last-child > tr:last-child > :is(th, td) { border-bottom: 0; }
+ .tablewrap > table:not(.packs) tr:not(.instance-group) > th { background-color: var(--panel-cool); }
+ .tablewrap:has(> table.packs) { background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
+ .instances .instance-address { white-space: nowrap; }
+ .instances td:nth-child(2) { white-space: nowrap; }
+ .methods td:nth-child(3), .methods td:nth-child(4) { white-space: nowrap; }
+ .instance-open { display: inline-flex; padding: .25rem; }
+ .instance-group th { text-align: left; padding-top: 1rem; background: var(--accent-soft); }
+ .instance-group .small { font-weight: normal; }
+ .small a[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration-thickness: 3px; }
+ .instance-facts { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .5rem 1.5rem; margin: 1rem 0; }
+ .instance-facts dt { color: var(--muted); }
+ .instance-facts dd { margin: 0; overflow-wrap: anywhere; }
+ .instance-facts .cellspark { max-width: 24rem; }
+ /* The Logs tab (logsview.go): the pane reads as the terminal it mirrors —
+ the same line `carlos logs` prints, monospaced, one line per record, no
+ wrapping. A table wrapped every message across three rows and put the
+ eye back at the left margin for each one, which is precisely what a log
+ reader is scanning past.
+
+ Ground is the shell-command <pre>'s own fill rather than a terminal's
+ black: this page is a light document in light mode, and a black
+ rectangle down the middle of it would read as a foreign object, not as
+ the console's own output. The pane is a scrolled region in BOTH axes —
+ sideways because lines do not wrap, and down because 200 lines must not
+ turn the page itself into the scrollbar. */
+ .term {
+ background: var(--accent-soft); border-radius: 0.5rem;
+ padding: 0.8rem 0 0.8rem 1rem; margin: 0 0 1rem;
+ min-height: 16rem; max-height: 70vh; overflow: auto;
+ font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
+ }
+ /* white-space:pre belongs to the LINE, not the pane: on the pane it would
+ render the newlines BETWEEN these divs as blank lines. width:max-content
+ with min-width:100% makes each line as wide as its own text, so the
+ pane's horizontal scroll reaches the end of the longest one — and the
+ right-hand gutter is the LINE's padding, not the pane's, because a
+ scrolled-away pane padding leaves the longest line hard against the
+ edge. */
+ .tl { white-space: pre; width: max-content; min-width: 100%; padding-right: 1rem; }
+ /* Time, host and trailing k=v fields are the line's furniture; the message
+ is what the reader came for, so it alone gets full-strength ink. */
+ .tl-t, .tl-h, .tl-f { color: var(--muted); }
+ .tl-s { color: var(--accent); }
+ /* The CLI colours a level rather than printing its name (logs.go's
+ printLogRecords); the pane says it the same way, in the same two tones
+ the rest of this console uses for warn and bad. */
+ .tl-warn .tl-m { color: var(--warn, #a6790f); }
+ .tl-error .tl-m { color: var(--bad); font-weight: 600; }
+ table { border-collapse: collapse; width: 100%; margin: 0 0 1rem; font-size: 0.95rem; }
+ .tiles { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0 0 1.5rem; }
+ .tile {
+ flex: 1 1 10rem; background-color: var(--bg); border: 1px solid var(--rule);
+ border-radius: var(--rst-radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-module);
+ }
+ /* A tile that is also a link (the Overview dashboard): the tile itself is
+ the affordance, so no underline and no accent ink — hover carries it. */
+ a.tile { color: var(--ink); text-decoration: none; }
+ a.tile:hover { outline: 1px solid var(--accent); }
+ /* The dashboard's six statistics as an even grid — flex would let the
+ last row's stragglers stretch full-width. */
+ .stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
+ .tile h2 {
+ margin: 0 0 0.35rem; font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
+ letter-spacing: 0.05em; color: var(--accent-strong); font-weight: 600;
+ }
+ .tile-value { font-size: 1.6rem; font-weight: 600; margin: 0; }
+ .tile-detail { color: var(--muted); font-size: 0.8rem; margin: 0.25rem 0 0; }
+ /* .chip-stale is bordered-only, no fill — a "trust this less" flag, not
+ an outage marker, matching internal/status/assets/status.css. */
+ .chip {
+ display: inline-block; font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
+ padding: 0.15rem 0.55rem; border-radius: 999px; margin: 0.15rem 0.3rem 0.15rem 0;
+ }
+ .chip-stale { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
+ /* A canary is bordered — a fact about a route, not a warning. A canary on
+ the app's primary host is FILLED, because an unreviewed build in front of
+ every user is the one thing on this page a reader must not skim past. */
+ .chip-canary { border: 1px solid var(--accent); color: var(--accent); }
+ .chip-prod { background: var(--bad); color: var(--bg); }
+ /* An expired canary (spec §5) keeps serving — this is "trust this less",
+ the same bordered-only warning as .chip-stale, never a filled outage
+ marker like .chip-prod. */
+ .chip-expired { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
+ /* A route's bound environment — a fact, not a warning, so it is bordered
+ like .chip-canary but in a neutral tone: it sits on every route, not
+ just the ones worth a second look. */
+ .chip-env { border: 1px solid var(--rule); color: var(--muted); }
+ /* Health verdict chips. "attention" is the one filled variant here — the
+ row a reader must not skim past — in the warn tone, not .chip-prod's
+ red: a silent instance is a problem, not the unreviewed-build outage.
+ ok/notdeployed/unknown are bordered facts. */
+ .chip-health-ok { border: 1px solid var(--good); color: var(--good); }
+ .chip-health-attention { background: var(--warn, #a6790f); color: var(--bg); }
+ .chip-health-notdeployed { border: 1px solid var(--rule); color: var(--muted); }
+ .chip-health-unknown { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
+ /* A small lamp ahead of each verdict. The word carries the status; the
+ lamp is a second cue in a different shape: ok lit and round, attention a
+ solid diamond, unknown a hollow ring, not deployed an unlit dot. */
+ .chip-health-ok::before, .chip-health-attention::before,
+ .chip-health-notdeployed::before, .chip-health-unknown::before {
+ content: ""; display: inline-block; width: 0.55em; height: 0.55em;
+ margin: 0 0.4em 0.1em 0; border-radius: 50%; vertical-align: middle;
+ }
+ .chip-health-ok::before { background: var(--good); box-shadow: 0 0 0.4em color-mix(in srgb, var(--good) 55%, transparent); }
+ .chip-health-attention::before { background: var(--bg); border-radius: 1px; transform: rotate(45deg); }
+ .chip-health-unknown::before { box-shadow: inset 0 0 0 2px var(--warn, #a6790f); }
+ .chip-health-notdeployed::before { background: var(--muted); opacity: 0.45; }
+ /* /fleet/economics/accounts (Task 14): FreeTierPos chips. "inside" (all
+ usage covered by the free tier, zero revenue) is the pure-cost-sink
+ case worth a second look, so it gets the same bordered warn tone as
+ chip-stale/chip-health-unknown — a fact to watch, not yet an outage.
+ "partial" (some usage billable, some free-tier-covered — the ordinary
+ lifecycle state) is a neutral accent border, chip-canary's tone.
+ "paying" (nothing left free) is chip-health-ok's bordered good tone.
+ "pooled" (Task 5: a try/pool/"" tier account, priced at zero revenue by
+ design, drawing from the fleet pool instead) is a STATUS, not a
+ warning — chip-env's muted neutral tone, the same posture as an
+ ordinary route fact nobody needs to act on. */
+ .chip-freetier-inside { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
+ .chip-freetier-partial { border: 1px solid var(--accent); color: var(--accent); }
+ .chip-freetier-paying { border: 1px solid var(--good); color: var(--good); }
+ .chip-freetier-pooled { border: 1px solid var(--rule); color: var(--muted); }
+ /* /fleet/economics/accounts (Task 6): fleet-pool TIER chips (store.go's
+ validAccountTiers) — the operator's ASSIGNMENT, distinct from the
+ freetier chips above (a PRICED POSITION). "unassigned" (never set) and
+ "try"/"pool" (both draw from the shared pool, same as an unassigned
+ account) share chip-freetier-pooled's muted, nothing-to-act-on tone.
+ "hosted"/"fleet"/"dedicated" are individually priced, each its own
+ bordered tone so the three read apart at a glance without implying a
+ ranking between them. */
+ .chip-tier-unassigned { border: 1px solid var(--rule); color: var(--muted); }
+ .chip-tier-try { border: 1px solid var(--rule); color: var(--muted); }
+ .chip-tier-pool { border: 1px solid var(--rule); color: var(--muted); }
+ .chip-tier-hosted { border: 1px solid var(--good); color: var(--good); }
+ .chip-tier-fleet { border: 1px solid var(--accent); color: var(--accent); }
+ .chip-tier-dedicated { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
+ .chip .icon { vertical-align: -0.1em; margin-right: 0.2em; }
+ .chip-up { background: var(--accent-soft); color: var(--good); }
+ .chip-down { background: var(--accent-soft); color: var(--bad); }
+ .chips { display: flex; flex-wrap: wrap; margin: 0 0 1rem; }
+ /* /fleet/economics (Task 13): a box's utilization as a filled bar, CSS
+ width only — the initial render needs no JS, and the inline knob script
+ updates .bar-fill's width style in place on recompute. */
+ .bar { display: inline-block; width: 6rem; height: 0.5rem; border-radius: 999px; background: var(--accent-soft); vertical-align: middle; overflow: hidden; }
+ .bar-fill { display: block; height: 100%; background: var(--accent); }
+ /* The knob drawer: one row per rate-card number, label then control,
+ narrower than .settings-row's button-row spacing since these are all
+ text/number inputs with no submit button riding along on the same line. */
+ .knob-row { display: flex; gap: 0.6rem; align-items: center; margin: 0 0 0.5rem; flex-wrap: wrap; }
+ .knob-row label { min-width: 12rem; color: var(--muted); font-size: 0.9rem; }
+ .knob-row input[type=number], .knob-row input[type=text] { width: 8rem; }
+ .knob-row input[type=range] { width: 12rem; }
+ /* The app flow diagram (flow.go): the release path drawn as the pipeline it
+ is, with the addresses each channel feeds hanging under it.
+
+ The one claim the drawing makes beyond its own words is the ARROW: solid
+ and accented where a version really did travel that step, dashed and grey
+ where it did not. That is what lets "how far has my build got" be seen
+ rather than worked out by comparing three version strings, so the two
+ states have to stay visually unmistakable — and distinguishable by more
+ than colour, hence solid vs dashed. */
+ .flow { margin: 0 0 1.75rem; }
+ .flow-line {
+ --flow-y: 1.25rem;
+ display: flex; flex-wrap: wrap; gap: 1.1rem 2.6rem;
+ list-style: none; margin: 0; padding: 0;
+ }
+ .flow-stage {
+ position: relative; flex: 1 1 10rem; min-width: 9rem; padding: 0.7rem 0.85rem 0.8rem;
+ background-color: var(--bg); border: 1px solid var(--rule); border-radius: var(--rst-radius);
+ box-shadow: var(--shadow-module);
+ }
+ .flow-stage + .flow-stage::before, .flow-stage + .flow-stage::after {
+ content: ""; position: absolute; pointer-events: none;
+ }
+ .flow-stage + .flow-stage::before {
+ left: -2.05rem; top: var(--flow-y); width: 1.3rem; border-top: 1px dashed var(--wire);
+ }
+ .flow-stage + .flow-stage::after {
+ left: -0.82rem; top: var(--flow-y); transform: translateY(-50%);
+ border: 0.28rem solid transparent; border-right: 0; border-left-color: var(--wire);
+ }
+ .flow-stage.is-carried::before { border-top-style: solid; border-top-color: var(--accent); }
+ .flow-stage.is-carried::after { border-left-color: var(--accent); }
+ .flow-label {
+ margin: 0; font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase;
+ letter-spacing: 0.05em; color: var(--muted); font-weight: 600; overflow-wrap: anywhere;
+ }
+ .flow-version { margin: 0.3rem 0 0; font-size: 0.95rem; overflow-wrap: anywhere; }
+ /* Empty stages keep the same raised edge, with a neutral face. */
+ .flow-stage:not(.is-held) { background-color: var(--rst-surface-2); }
+ .flow-stage:not(.is-held) .flow-version { color: var(--muted); }
+ .flow-stage.is-held { background-color: var(--panel-cool); }
+ .flow-stage.is-held .flow-label { color: var(--accent-strong); }
+ .flow-note { margin: 0.25rem 0 0; font-size: 0.78rem; color: var(--muted); }
+ .flow-addrs {
+ list-style: none; margin: 0.6rem 0 0; padding: 0 0 0 0.7rem;
+ border-left: 1px solid var(--rule); display: grid; gap: 0.35rem;
+ }
+ .flow-addr { font-size: 0.82rem; line-height: 1.35; }
+ .flow-addr a { display: block; overflow-wrap: anywhere; }
+ .flow-region { color: var(--muted); margin-right: 0.35rem; }
+ .flow-health { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--muted); }
+ .flow-health .icon { width: 0.9em; height: 0.9em; flex: none; }
+ .flow-tone-ok .flow-health { color: var(--good); }
+ .flow-tone-wait .flow-health { color: var(--warn, #a6790f); }
+ .flow-tone-bad .flow-health { color: var(--bad); font-weight: 600; }
+ .flow-band { margin: 1.4rem 0 0.7rem; font-size: 0.9rem; color: var(--muted); }
+ .flow-caption { margin: 1.1rem 0 0; }
+ /* Narrow screens: the same path, turned down the page. The connector turns
+ with it — an arrow still pointing the way the version travels. */
+ @media (max-width: 46rem) {
+ .settings-layout { display: block; }
+ .settings-nav {
+ flex-direction: row; overflow-x: auto; margin: 0 0 1.5rem;
+ padding-bottom: 0.25rem;
+ }
+ .settings-nav a { white-space: nowrap; }
+ .settings-content { padding: 1rem 1rem 0.25rem; }
+ .flow-line { display: block; }
+ .flow-stage + .flow-stage { margin-top: 2.25rem; }
+ .flow-stage + .flow-stage::before {
+ left: 1rem; top: -1.75rem; width: 0; height: 0.85rem;
+ border-top: 0; border-left: 1px dashed var(--wire);
+ }
+ .flow-stage + .flow-stage::after {
+ left: 1rem; top: -0.9rem; transform: translateX(-50%);
+ border: 0.28rem solid transparent; border-bottom: 0; border-top-color: var(--wire);
+ border-left-color: transparent;
+ }
+ .flow-stage.is-carried::before { border-left-color: var(--accent); }
+ .flow-stage.is-carried::after { border-top-color: var(--accent); border-left-color: transparent; }
+ }
+ /* The release ladder: four rungs drawn top-down in the order the spec
+ draws them (canary first, stable at the foot), with the promotion
+ between two of them rendered as the step it is. list-style is off
+ because the rung's own name is its marker. */
+ .ladder { list-style: none; margin: 0 0 1rem; padding: 0; max-width: 40rem; }
+ .rung {
+ border: 1px solid var(--rule); border-radius: var(--rst-radius); padding: 0.8rem 1rem;
+ background-color: var(--bg); box-shadow: var(--shadow-module);
+ }
+ .rung + .rung { margin-top: 0.4rem; }
+ .rung-name {
+ font-family: var(--mono);
+ font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
+ font-weight: 600; color: var(--muted); margin: 0 0 0.3rem;
+ }
+ .rung p { margin: 0 0 0.2rem; }
+ .rung .gate { margin: 0.5rem 0 0; }
+ .rung .routes { list-style: none; margin: 0.3rem 0 0.6rem; padding: 0; font-size: 0.95rem; }
+ .rung .routes li { padding: 0.1rem 0; }
+ /* The step to the next rung is the last band of the rung it leaves: ruled
+ off, full width, so the arrow reads as "and then down to here". */
+ .step {
+ display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
+ margin: 0.7rem -1rem -0.8rem; padding: 0.5rem 1rem;
+ border-top: 1px solid var(--rule);
+ }
+ .step form { display: flex; align-items: baseline; gap: 0.5rem; margin: 0; }
+ .step > .icon { color: var(--muted); align-self: center; }
+ th {
+ font-family: var(--mono);
+ font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
+ color: var(--muted); text-align: left; font-weight: 600;
+ }
+ th, td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
+ form.signin { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1rem; }
+ form.signin input[type=text], form.signin input[type=email] { padding: 0.55rem 0.8rem; min-width: 16rem; }
+ form.signin label { flex-basis: 100%; font-weight: 600; }
+ /* A button is a small raised module: a fill, a hairline edge in its own
+ darker tone, a short lip under it that it sinks into when pressed. The
+ variants below only swap the --btn-* tones, so hover, press and busy
+ stay one set of rules. */
+ button, .btn {
+ --btn-fill: var(--rst-accent-fill); --btn-fill-hover: var(--rst-accent-fill-hover);
+ --btn-edge: var(--rst-accent-fill-edge); --btn-edge-hover: var(--rst-accent-fill-edge-hover);
+ --btn-lip: var(--btn-edge); --btn-ink: var(--rst-on-accent-fill);
+ --btn-hl: color-mix(in srgb, var(--rst-depth-hl) 30%, transparent);
+ font-size: 0.95rem; font-weight: 600; background-color: var(--btn-fill);
+ background-image: linear-gradient(rgb(255 255 255 / var(--rst-depth-face)), rgb(0 0 0 / var(--rst-depth-face)));
+ color: var(--btn-ink); border: 1px solid var(--btn-edge); border-radius: var(--rst-radius-sm);
+ padding: calc(0.6rem - 1px) calc(1.2rem - 1px); cursor: pointer;
+ text-decoration: none; display: inline-block;
+ box-shadow: inset 0 1px 0 var(--btn-hl), 0 2px 0 var(--btn-lip), 0 3px 4px -2px var(--rst-depth-contact);
+ transition: background-color 120ms ease-out, border-color 120ms ease-out, box-shadow 120ms ease-out, translate 80ms ease-out;
+ }
+ button.linkish {
+ background: none; color: var(--accent); font-weight: 400; padding: 0; border: 0; box-shadow: none;
+ border-radius: 0; text-decoration: underline; font-size: 0.9rem; cursor: pointer;
+ }
+ button:not(.linkish, .an-col):not(:disabled):hover, .btn:not([aria-disabled="true"]):hover {
+ background-color: var(--btn-fill-hover); border-color: var(--btn-edge-hover);
+ }
+ button:not(.linkish, .an-col):not(:disabled):not([aria-busy="true"]):active, .btn:not([aria-disabled="true"]):active {
+ translate: 0 var(--rst-press-drop);
+ box-shadow: inset 0 1px 2px var(--rst-depth-contact), 0 1px 0 var(--btn-lip);
+ }
+ button:disabled:not([aria-busy="true"]), .btn[aria-disabled="true"] {
+ opacity: 0.55; cursor: not-allowed; box-shadow: none;
+ }
+ button.linkish.danger { color: var(--bad); }
+ /* A button marked data-busy shows a spinner once pressed (the script at
+ the end of the page); the label stays for screen readers. */
+ button[aria-busy="true"] { position: relative; color: transparent; cursor: progress; }
+ button[aria-busy="true"]::after {
+ content: ""; position: absolute; inset: 0; margin: auto;
+ width: 1.1em; height: 1.1em; border-radius: 50%;
+ border: 2px solid var(--btn-ink, var(--bg)); border-right-color: transparent;
+ animation: busy-spin 0.7s linear infinite;
+ }
+ @keyframes busy-spin { to { transform: rotate(360deg); } }
+ @media (prefers-reduced-motion: reduce) {
+ button, .btn { transition: none; }
+ button[aria-busy="true"]::after { animation-duration: 2.4s; }
+ }
+ /* Actions that change what serves are BUTTONS, not links — small enough to
+ sit inside a table row or a ladder rung, unmistakably a button all the
+ same. Danger is filled red: rollbacks and retirements should not dress
+ like promotions. */
+ .btn-sm, button.btn-sm {
+ font-size: 0.85rem; padding: calc(0.35rem - 1px) calc(0.8rem - 1px); border-radius: var(--rst-radius-sm);
+ }
+ .btn-secondary, button.btn-secondary {
+ --btn-fill: var(--rst-control-face); --btn-fill-hover: var(--rst-control-face-hover);
+ --btn-edge: var(--rst-control-border); --btn-edge-hover: var(--rst-control-border-hover);
+ --btn-lip: var(--rack-edge); --btn-hl: var(--rst-depth-hl); --btn-ink: var(--accent);
+ }
+ button.btn-danger, .btn-danger {
+ --btn-fill: var(--rst-danger-fill); --btn-fill-hover: var(--rst-danger-fill-hover);
+ --btn-edge: var(--rst-danger-fill-edge); --btn-edge-hover: var(--rst-danger-fill-edge-hover);
+ --btn-ink: var(--rst-on-danger-fill);
+ }
+ /* The Instances table's in-cell readings: number first, then the 48h
+ shape beside it, low-contrast so the number stays the headline. */
+ td .cell-value { display: inline-block; min-width: 3.5rem; font-weight: 600; }
+ .cellspark { width: 6rem; height: 1.1rem; vertical-align: -0.2rem; color: var(--muted); }
+ .cellspark polyline { stroke-width: 2.5; }
+ /* The Overview's recent-activity strip. */
+ .feed { list-style: none; margin: 0 0 0.5rem; padding: 0; max-width: 40rem; }
+ .feed li { padding: 0.25rem 0; border-bottom: 1px solid var(--rule); }
+ .feed li:last-child { border-bottom: 0; }
+ /* The confirm interstitial: one card saying exactly what is about to
+ happen, one button that does it, one link that does not. */
+ .confirm-card {
+ border: 1px solid var(--rule); border-radius: var(--rst-radius);
+ padding: 1.25rem 1.4rem; max-width: 40rem; margin: 0 0 1rem;
+ background-color: var(--bg); box-shadow: var(--shadow-module);
+ }
+ .confirm-card .actions { display: flex; gap: 0.9rem; align-items: center; margin-top: 1rem; }
+ .confirm-card .confirm-note { margin: 0.8rem 0 0; }
+ /* /fleet/architecture: the diagram and its box cards. Colours come from
+ the same tokens as the rest of the console so it themes light and dark
+ with no second palette to keep in sync, and the SVG scrolls inside its
+ own wrapper rather than making the page scroll sideways — the drawing
+ has a minimum readable width the viewport may not have. */
+ /* Sized to main's 64rem column, and no wider: a band is at most four
+ nodes across (archLayer), 1018 units, which fits inside it. The wrapper
+ used to be sized to the viewport instead, because the single-picture
+ page drew an estate 1918 units wide and the column showed the DNS and
+ the IPs and hid every box; one picture per region is what made that
+ unnecessary, and overflow-x only has work to do on a window narrower
+ than the column. */
+ .archwrap { overflow-x: auto; margin: 0.2rem 0 1.6rem; }
+ /* The band heading. A region code is a machine string an operator reads
+ dozens of times a day, so it is set in the mono face and quietly — the
+ picture under it is the content, and a loud heading every 400px down a
+ six-region page reads as six separate documents. */
+ h4.archband {
+ border-top: 1px solid var(--rule); color: var(--muted);
+ font: 600 0.8rem var(--mono); letter-spacing: 0.02em;
+ margin: 1.5rem 0 0; padding-top: 0.5rem;
+ }
+ /* No width rule: the SVG carries its own width/height (RenderArchSVG), so
+ it renders 1:1 and .archwrap scrolls when the viewport is narrower.
+ Sizing it to the container instead would scale a 1918-unit-wide drawing
+ into a ~1024px column and take the 13px labels to ~7px. */
+ .archsvg { display: block; }
+ .archsvg rect { fill: var(--accent-soft); stroke: var(--rule); }
+ .archsvg .archnode-box rect { stroke: var(--accent); }
+ .archsvg .archtitle { fill: var(--ink); font: 600 13px var(--sans); }
+ .archsvg .archsub { fill: var(--muted); font: 400 11px var(--sans); }
+ /* The edges carry the whole meaning of the diagram — which name reaches
+ which box — so they are stroked off --muted, not --rule. --rule is the
+ 1px table-hairline token (#eae7f0 light, #2c2836 dark): correct for a
+ node's outline sitting on a filled body, invisible for a line that has
+ to be followed across the page. */
+ .archsvg .archedge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
+ /* An alarm rides the node it watches (archlayout.go): a healthy one is a
+ quiet mark, a firing one takes the bad colour so it reads at a glance
+ rather than only in the words of its hover title. */
+ .archsvg .archalarm { fill: var(--good); }
+ .archsvg .archalarm-firing { fill: var(--bad); }
+ /* 64rem, not 44rem: the resource tables below run the full width of the
+ column, and a 44rem card left the column edge stepping in and out down
+ the page (discussion #9). */
+ .archbox {
+ border: 1px solid var(--rule); border-radius: var(--rst-radius);
+ padding: 0.9rem 1.1rem; margin: 0 0 0.6rem; max-width: 64rem;
+ background-color: var(--bg); box-shadow: var(--shadow-module);
+ }
+ .archbox h3 { margin: 0 0 0.3rem; }
+ .archbox p { margin: 0 0 0.2rem; }
+ /* The box card's fact line: every fact on it is independently absent (a
+ BYO box has no instance type, an unpriced box has no size and no
+ price), so the separator is drawn between surviving neighbours rather
+ than written after each fact — no dangling middots. */
+ .archbox .fact + .fact::before { content: " · "; color: var(--muted); }
+ footer {
+ max-width: 64rem; margin: 0 auto; padding: 1.25rem 0 2rem;
+ border-top: 1px solid var(--rule);
+ font-size: 0.85rem; color: var(--muted);
+ }
+ /* Page anatomy: every page opens with a mono eyebrow naming the context,
+ an h1, and one human sentence saying what the page is for. */
+ .pagehead { margin: 0 0 1.75rem; }
+ .eyebrow {
+ font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em;
+ text-transform: uppercase; color: var(--muted); margin: 0 0 0.3rem;
+ }
+ .pagehead h1 { margin: 0 0 0.35rem; }
+ .pagehead .lede { margin: 0; font-size: 1.05rem; }
+ .version-list { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
+ .version-list code { display: inline-block; overflow-wrap: anywhere; }
+ .version-list li { min-width: 0; max-width: 100%; }
+ /* Progressive-reveal sections: a page leads with the summary strip, and
+ the deeper tables/ladder sit behind an opt-in disclosure. */
+ .reveal > summary { font-size: 1.1rem; font-weight: 600; cursor: pointer; }
+ .reveal > summary h2 { display: inline; font-size: inherit; margin: 0; }
+ /* App tab bar (Heroku-style), and the account nav's active marker.
+ aria-current carries the state; the accent underline draws it. */
+ .tabs {
+ display: flex; flex-wrap: wrap; gap: 1.25rem 0.25rem; margin: 0 0 2rem;
+ border-bottom: 1px solid var(--rule);
+ font-family: var(--mono); font-size: 0.85rem;
+ }
+ .tabs a {
+ color: var(--muted); text-decoration: none;
+ padding: 0.3rem 0.5rem 0.55rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
+ }
+ .tabs a:hover { color: var(--ink); }
+ .tabs a[aria-current] {
+ color: var(--ink); border-bottom-color: var(--accent);
+ background: var(--accent-soft); border-radius: 0.35rem 0.35rem 0 0;
+ }
+ header nav a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
+ header nav a.addr { color: var(--muted); text-decoration: none; }
+ /* The billing page (billing.html). Its price elements carry fixed class
+ lists that billing.html's own currency rules and their guard test
+ (TestBillingPagePricesFollowShownCurrency) read, so they are styled
+ here as span.price in context, never by a class of their own.
+
+ The summary is a tile: the plan's name as its value, its facts under
+ it, and what it gives the account today beside them. */
+ .billing-now {
+ display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
+ gap: 1rem 3rem; padding: 1.15rem 1.4rem 1.25rem; margin: 0 0 0.5rem;
+ }
+ .billing-now > div { min-width: 0; }
+ .billing-now .tile-value { margin: 0 0 0.3rem; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
+ .billing-facts { list-style: none; font-size: 0.9rem; color: var(--muted); }
+ .billing-includes, .plan-incl { list-style: none; display: grid; gap: 0.3rem; font-size: 0.9rem; }
+ .billing-includes { grid-template-columns: repeat(auto-fit, minmax(13rem, auto)); column-gap: 2rem; align-self: center; }
+ .billing-includes li, .plan-incl li { display: flex; align-items: flex-start; gap: 0.5rem; }
+ .billing-includes .icon, .plan-incl .icon { color: var(--accent); margin-top: 0.25em; }
+ /* The purchase form: a heading with the currency switch at its right
+ end, the plan cards, the packs, then the one button. */
+ .buy fieldset { border: 0; min-width: 0; }
+ .buy .currency { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
+ .buy .currency legend { float: left; }
+ /* A segmented control made of real radios: each radio is laid
+ transparently over its own label, so it keeps its click, its keyboard
+ arrows and its required check, and the label carries the look. */
+ .seg {
+ display: inline-flex; gap: 2px; padding: 2px; border-radius: 0.5rem;
+ background: var(--accent-soft); box-shadow: var(--shadow-inset);
+ }
+ .seg label { position: relative; display: block; }
+ .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
+ .seg label > span, .seg-fixed {
+ display: block; min-width: 3.4rem; padding: 0.4rem 0.75rem; border-radius: 0.375rem;
+ font-size: 0.82rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
+ text-align: center; color: var(--muted); line-height: 1.3;
+ transition: color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
+ }
+ .seg label:hover > span { color: var(--ink); }
+ .seg label:has(input:checked) > span, .seg-fixed {
+ background: var(--bg); color: var(--ink);
+ box-shadow: var(--shadow-raised);
+ }
+ .seg label:has(input:focus-visible) > span { outline: 2px solid var(--accent); outline-offset: 1px; }
+ /* Plan cards. The label's ::after stretches over its card, so the whole
+ card picks the plan; the checked card takes the accent. */
+ .plan-cards {
+ display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
+ gap: 1rem; margin: 0 0 2.25rem;
+ }
+ .plan-card {
+ position: relative; border: 1px solid var(--rule); border-radius: var(--rst-radius);
+ padding: 1.1rem 1.25rem 1.25rem; background-color: var(--bg); box-shadow: var(--shadow-module);
+ transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
+ }
+ .plan-card:hover { border-color: var(--muted); }
+ .plan-card:has(input:checked) {
+ border-color: var(--accent); background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
+ box-shadow: var(--shadow-module), inset 0 0 0 1px var(--accent);
+ }
+ .plan-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
+ .plan-card p { margin: 0; max-width: none; }
+ .plan-card label { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }
+ .plan-card label::after { content: ""; position: absolute; inset: 0; }
+ .plan-card input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
+ .plan-name { min-width: 0; overflow-wrap: anywhere; font-size: 1.15rem; font-weight: 650; }
+ .plan-cost { display: block; margin: 0.65rem 0 0; }
+ .plan-card span.price {
+ display: block; color: var(--ink); font-size: 1.15rem; font-weight: 650;
+ line-height: 1.3; text-wrap: balance; font-variant-numeric: tabular-nums;
+ }
+ .plan-card span.total { margin-top: 0.4rem; font-size: 0.9rem; font-weight: 500; }
+ /* No currency checked yet (a refused one): every currency's price shows,
+ so each steps down to one line's weight. */
+ .buy:not(:has(input[name=currency]:checked)) .plan-card span.price { font-size: 0.95rem; font-weight: 500; }
+ .plan-incl { margin: 1rem 0 0; padding: 0.9rem 0 0; border-top: 1px solid var(--rule); }
+ .plan-card:has(input:checked) .plan-incl { border-top-color: var(--accent-soft); }
+ /* Packs: one row each, the name and what one adds, a quantity, a price.
+ The quantity box is wide enough for its maximum and steps by one. */
+ .buy h3 { margin: 0; }
+ .buy .packs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 1rem; margin: 0 0 0.2rem; }
+ .buy .packs-head + .small { margin: 0 0 0.75rem; }
+ table.packs { margin: 0; }
+ .packs tr:first-child td { border-top: 1px solid var(--rule); }
+ .packs td { padding: 0.75rem 1.25rem 0.75rem 0; vertical-align: middle; }
+ .packs td:first-child { width: 100%; }
+ .packs td + td { white-space: nowrap; }
+ .packs td:last-child { padding-right: 0; text-align: right; }
+ .packs label { display: block; font-weight: 600; }
+ .packs td:first-child .small { display: block; }
+ .packs span.price { display: block; color: var(--ink); font-variant-numeric: tabular-nums; }
+ .packs td form { justify-content: flex-end; flex-wrap: nowrap; }
+ .packs input[type=number] {
+ width: 4.75rem; padding: 0.4rem 0.5rem; text-align: center;
+ font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums;
+ color: var(--ink); background: var(--field); accent-color: var(--accent);
+ border: 1px solid var(--muted); border-radius: var(--rst-radius-sm); box-shadow: var(--shadow-inset);
+ }
+ .packs input[type=number]:hover { border-color: var(--ink); }
+ .packs input[type=number]:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
+ /* Usage beside a limit (billingusage.go), as the plan-limits pass last
+ measured it: quiet figures in the muted ink. From 80% of the limit the
+ figure takes the ink and a warn dot; past it, the bad ink and a bad
+ dot. The weight and the dot carry it as well as the colour. */
+ .use { font-variant-numeric: tabular-nums; }
+ .use-warn, .use-over { font-weight: 600; }
+ .use-warn { color: var(--ink); }
+ .use-over { color: var(--bad); }
+ .use-warn::before, .use-over::before {
+ content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin: 0 0.4rem 0.1em 0;
+ border-radius: 50%; background: var(--warn); vertical-align: middle;
+ }
+ .use-over::before { background: var(--bad); }
+ .packs td:first-child .use { margin-top: 0.15rem; }
+ .plan-incl .use { margin-left: auto; padding-left: 0.5rem; white-space: nowrap; }
+ .usage-asof { margin: 0; }
+ .packs-head .usage-asof { font-size: 0.82rem; }
+ /* The summary's usage, when no pack row carries it: a row of figures
+ under the plan, its as-of line beneath. */
+ .billing-usage { flex: 1 1 100%; padding: 0.9rem 0 0; border-top: 1px solid var(--rule); }
+ .billing-usage dl { display: flex; flex-wrap: wrap; gap: 0.6rem 2.75rem; margin: 0 0 0.6rem; }
+ .billing-usage dt { font-size: 0.82rem; color: var(--muted); }
+ .billing-usage dd { margin: 0; font-size: 0.95rem; }
+ .billing-usage .usage-asof { font-size: 0.82rem; }
+
+ /* Analytics (app_analytics.html, and the Overview's traffic card). The
+ chart is the page's one loud element; everything around it stays in
+ text ink and hairlines. */
+ .an-off { margin: 0 0 1.5rem; }
+ .an-range { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: 0 0 1.75rem; }
+ .an-range a {
+ padding: 0.3rem 0.75rem; border-radius: 999px; color: var(--muted);
+ text-decoration: none; font-size: 0.9rem;
+ }
+ .an-range a:hover { color: var(--ink); background: var(--accent-soft); }
+ .an-range a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
+ .an-range a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
+ .an-span { margin-left: 0.75rem; color: var(--muted); font-size: 0.85rem; }
+ .an-daynav { display: inline-flex; gap: 0.25rem; margin-left: 0.5rem; }
+ .an-daynav a { font-size: 0.85rem; }
+ .an-figures { display: flex; flex-wrap: wrap; gap: 1rem 3.5rem; margin: 0 0 1.5rem; }
+ .an-figures dt { color: var(--muted); font-size: 0.9rem; }
+ .an-figures dd { margin: 0; font-size: 2.25rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
+ .an-figures dd.an-note { font-size: 0.8rem; font-weight: 400; color: var(--muted); max-width: 16rem; line-height: 1.4; margin-top: 0.3rem; letter-spacing: 0; }
+ .an-empty { color: var(--muted); padding: 2.5rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); max-width: none; }
+ .an-insights { color: var(--ink); font-size: 0.95rem; margin: 0.75rem 0 0.5rem; max-width: none; }
+ .an-quality { margin: 0 0 2rem; max-width: 48rem; }
+
+ .an-chart { margin: 0; padding-left: 2.25rem; }
+ .an-plot { position: relative; height: 14rem; }
+ .an-overview .an-plot { height: 7rem; }
+ .an-grid span {
+ position: absolute; left: 0; right: 0; height: 0;
+ border-top: 1px solid var(--rule);
+ }
+ .an-grid i {
+ position: absolute; right: calc(100% + 0.5rem); top: -0.6em;
+ font-style: normal; font-size: 0.75rem; color: var(--muted);
+ font-variant-numeric: tabular-nums; white-space: nowrap;
+ }
+ .an-cols, .an-xaxis { display: grid; grid-template-columns: repeat(var(--an-cols), minmax(0, 1fr)); }
+ .an-cols { position: absolute; inset: 0; }
+ /* A column is the hit target, full height, so a zero hour still answers
+ a hover; the bar inside it is capped at 24px and never fills the slot. */
+ button.an-col, .an-col {
+ position: relative; display: flex; align-items: flex-end; justify-content: center;
+ height: 100%; padding: 0 1px; margin: 0; border: 0; border-radius: 0.25rem;
+ background: transparent; color: inherit; font: inherit; cursor: default; box-shadow: none;
+ }
+ .an-col:not(.an-future):hover, .an-col:not(.an-future):focus-visible { background: var(--accent-soft); }
+ .an-col:not(.an-future):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
+ /* A day on a daily chart is a link to that day; it reads as the column,
+ not as underlined text. */
+ a.an-col { text-decoration: none; cursor: pointer; }
+ .an-bar {
+ position: relative; display: block; width: 100%; max-width: 24px; min-height: 0;
+ background: var(--accent); border-radius: 4px 4px 0 0;
+ }
+ .an-col:hover .an-bar, .an-col:focus-visible .an-bar { background: var(--accent-strong); }
+ /* The hour or day still being counted: the same hue, hatched, because the
+ bar will still grow. (No percentages in this sheet's own rules: the
+ metrics boundary tests read every "NN%" on an app page as a reading.) */
+ .an-partial .an-bar { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--accent-soft) 3px 6px); }
+ .an-gap::after {
+ content: ""; position: absolute; bottom: -0.55rem; left: 50%; width: 5px; height: 5px;
+ margin-left: -2.5px; border-radius: 50%; background: var(--warn);
+ }
+ .an-tip {
+ display: none; position: absolute; z-index: 2; bottom: calc(100% + 0.4rem); left: 50%;
+ transform: translateX(-50%); width: max-content; max-width: 15rem;
+ padding: 0.5rem 0.7rem; border-radius: 0.4rem; text-align: left;
+ background: var(--ink); color: var(--bg); font-size: 0.8rem; line-height: 1.45;
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); pointer-events: none;
+ }
+ .an-tip b { display: block; font-size: 0.95rem; font-weight: 600; }
+ .an-tip span { display: block; }
+ .an-tip .an-when { opacity: 0.75; margin-top: 0.15rem; }
+ .an-edge-start .an-tip { left: 0; transform: none; }
+ .an-edge-end .an-tip { left: auto; right: 0; transform: none; }
+ .an-col:hover .an-tip, .an-col:focus .an-tip { display: block; }
+ /* One tooltip at a time: while the pointer is over the chart, only the
+ column under it speaks, not one left focused by an earlier click. */
+ .an-cols:hover .an-col:focus:not(:hover) .an-tip { display: none; }
+ /* The tip is the bar's child, so it opens just above the bar's top,
+ where the eye already is, and never covers the bar it describes. */
+ .an-future { cursor: default; }
+ .an-xaxis { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
+ .an-xaxis span { justify-self: center; }
+
+ .an-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2rem 3rem; margin: 0 0 2rem; }
+ .an-card h3 { font-size: 1rem; margin: 0 0 0.6rem; }
+ .an-share { list-style: none; margin: 0 0 0.5rem; }
+ .an-share li {
+ display: grid; grid-template-columns: minmax(0, 1fr) auto 3rem; column-gap: 0.75rem;
+ align-items: baseline; padding: 0.4rem 0 0.45rem; border-bottom: 1px solid var(--rule);
+ }
+ .an-key { overflow-wrap: anywhere; }
+ .an-flag { margin-right: 0.4rem; }
+ .an-val { font-variant-numeric: tabular-nums; text-align: right; }
+ .an-pct { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); font-size: 0.85rem; }
+ .an-track { grid-column: 1 / -1; display: block; height: 3px; margin-top: 0.3rem; border-radius: 2px; background: var(--accent-soft); }
+ .an-track span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
+ .an-muted .an-key { color: var(--muted); }
+ .an-muted .an-track span { background: var(--muted); opacity: 0.5; }
+
+ .an-more { margin: 0.6rem 0 0; font-size: 0.9rem; }
+ .an-card h3.an-subhead { margin-top: 1.4rem; }
+ .an-pages { margin: 0 0 2rem; }
+ .an-pages-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 0.8rem; }
+ .an-pages-head h3 { font-size: 1rem; margin: 0; }
+ input.an-filter { width: 100%; max-width: 24rem; margin: 0 0 1rem; }
+ .an-section { border-bottom: 1px solid var(--rule); }
+ .an-section summary {
+ display: grid; grid-template-columns: minmax(0, 1fr) auto 3rem 5.5rem; column-gap: 0.75rem;
+ align-items: baseline; padding: 0.55rem 0; cursor: pointer; font-weight: 600;
+ }
+ .an-section summary .an-count { color: var(--muted); font-size: 0.85rem; font-weight: 400; text-align: right; }
+ .an-pagelist { margin: 0 0 0.75rem 1rem; }
+ .an-pagelist li { grid-template-columns: minmax(0, 1fr) 60px auto 3rem; }
+ .an-spark { width: 60px; height: 16px; align-self: center; }
+ .an-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
+ .an-overview { margin: 0 0 2rem; padding: 1.25rem 1.4rem 1.4rem; border: 1px solid var(--rule); border-radius: var(--rst-radius); background-color: var(--bg); box-shadow: var(--shadow-module); }
+ .an-overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 1rem; }
+ .an-overview-head h2 { font-size: 1rem; margin: 0; }
+ .an-overview .an-figures { gap: 0.75rem 2.5rem; margin-bottom: 1rem; }
+ .an-overview .an-figures dd:not(.an-note) { font-size: 1.6rem; }
+ .an-overview .an-empty { padding: 1.5rem 0; }
+ /* The Protection tab draws two series on the Analytics chart: the bar is
+ what was caught that day, its foot what was blocked, in ink so the two
+ read apart in either scheme. The legend keys use the same fills. */
+ .pt-blocked { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); border-radius: inherit; }
+ .pt-key { display: inline-block; width: 0.7rem; height: 0.7rem; margin: 0 0.35rem 0 0; border-radius: 2px; background: var(--accent); vertical-align: -0.05rem; }
+ .pt-key + .pt-key { margin-left: 0.75rem; }
+ .pt-key-blocked { background: var(--ink); }
+ @media (max-width: 40rem) {
+ .an-figures { gap: 1rem 2rem; }
+ .an-figures dd:not(.an-note) { font-size: 1.75rem; }
+ .an-plot { height: 11rem; }
+ .an-span { flex-basis: 100%; margin: 0.4rem 0 0 0.75rem; }
+ }
+ @media (forced-colors: active) {
+ .an-bar, .an-track span { background: CanvasText; }
+ .pt-key { background: CanvasText; }
+ .pt-blocked, .pt-key-blocked { background: Highlight; }
+ .an-tip { border: 1px solid CanvasText; }
+ }
+ .buy-foot { margin: 1.75rem 0 0; }
+ .buy-foot button { padding: 0.7rem 1.5rem; }
+ .billing-upgrades { margin-top: 1.25rem; }
+ /* The success screen after a completed purchase (billing_done.html):
+ it replaces the billing page, so it stands alone in the middle of an
+ otherwise empty page. A check that draws itself once in an accent
+ disc, the heading, the plan's room in a sentence, and its links:
+ Add packs and Upgrade go back to the billing page's sections, Go to
+ your apps is the way on. */
+ .done { max-width: 36rem; margin: clamp(1rem, 9vh, 5.5rem) auto 0; text-align: center; }
+ .done-mark {
+ display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
+ margin: 0 0 1.4rem; background: var(--accent); color: var(--bg);
+ }
+ .done-mark .icon { width: 1.6rem; height: 1.6rem; stroke-width: 2.6; }
+ .done h1 { margin: 0 0 0.8rem; font-size: clamp(1.65rem, 1.2rem + 1.6vw, 2.15rem); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; overflow-wrap: anywhere; }
+ .done-lede, .done-room { margin: 0 auto; max-width: 32rem; text-wrap: pretty; overflow-wrap: anywhere; }
+ .done-lede { font-size: 1.05rem; }
+ .done-room { margin-top: 0.5rem; color: var(--muted); }
+ .done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 2rem 0 0; }
+ .done-actions .btn { padding: 0.6rem 1.25rem; }
+ .done-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
+ /* Its links land on these headings, a little clear of the window's top. */
+ #packs-title, #upgrade { scroll-margin-top: 1.5rem; }
+ @media (prefers-reduced-motion: no-preference) {
+ .done-mark { animation: done-pop 520ms cubic-bezier(0.16, 1, 0.3, 1) both; }
+ .done-mark path { stroke-dasharray: 24; animation: done-draw 480ms 200ms cubic-bezier(0.16, 1, 0.3, 1) both; }
+ }
+ @keyframes done-pop { from { transform: scale(0.7); } }
+ @keyframes done-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
+ @media (min-width: 46rem) {
+ .billing-includes { grid-template-columns: repeat(2, auto); }
+ }
+ @media (max-width: 40rem) {
+ table.methods .added { display: none; }
+ .billing-now { padding: 1rem 1.1rem 1.1rem; }
+ .done-actions { flex-direction: column; align-items: stretch; margin-top: 1.75rem; }
+ .done-actions .btn { text-align: center; }
+ .packs tr {
+ display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
+ gap: 0.6rem 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule);
+ }
+ .packs tr:first-child { border-top: 1px solid var(--rule); }
+ .packs td, .packs tr:first-child td { display: block; width: auto; padding: 0; border: 0; }
+ .packs td:first-child { grid-column: 1 / -1; }
+ .packs td:last-child { text-align: right; }
+ .buy-foot button { width: 100%; }
+ }
+ /* Phones (800px and narrower) see an account page as Fiesta's console
+ does: an index of sections, or a page with one back link up to the
+ index it sits under (mobilenav.go). Account switching has its own
+ index on phones; the app tabs and the
+ settings sections give way to their own indexes. Wider screens never
+ see the back strip, and an index still reads as a list of links. */
+ .mobile-back, .pagehead > .mobile-title { display: none; }
+ header .account-links { display: contents; }
+ .index-nav { display: flex; flex-direction: column; max-width: 32rem; margin: 0 0 2rem; border: 1px solid var(--rule); border-radius: var(--rst-radius); background: var(--bg); box-shadow: var(--shadow-module); overflow: hidden; }
+ .index-nav a:last-child { border-bottom: 0; }
+ .index-nav a {
+ display: flex; align-items: center; box-sizing: border-box;
+ gap: 0.75rem; min-height: 3.75rem; padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--rule);
+ color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
+ }
+ .index-context { display: flex; align-items: center; gap: 0.875rem; max-width: 32rem; margin: 0.25rem 0 1.5rem; }
+ .index-context-copy { min-width: 0; }
+ .index-context h1 { margin: 0; }
+ .index-context .eyebrow { margin: 0 0 0.25rem; font-size: 0.7rem; overflow-wrap: anywhere; }
+ .index-meta { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
+ .index-meta code { font-size: 0.75rem; }
+ .app-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.6rem; font: 600 1rem/1 var(--mono); text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); box-shadow: var(--shadow-raised); }
+ .app-mark .icon { width: 1rem; height: 1rem; }
+ .index-context > .app-mark { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; }
+ .index-context-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2.75rem; height: 2.75rem; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); border-radius: 0.75rem; box-shadow: var(--shadow-raised); }
+ .index-context-icon .icon { width: 1.4rem; height: 1.4rem; }
+ .index-nav .index-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.5rem; background: light-dark(#f0e4ef, #382435); color: var(--accent-strong); box-shadow: inset 0 1px 0 var(--rst-depth-hl), 0 1px 1px var(--rst-depth-ambient); }
+ .index-nav .index-icon .icon { width: 1.125rem; height: 1.125rem; }
+ .index-label { flex: 1; min-width: 0; }
+ .index-chevron { display: flex; flex: none; color: var(--muted); opacity: 0.65; }
+ .index-chevron .icon { width: 1rem; height: 1rem; }
+ .index-nav :is(.index-key-fleet, .index-key-instances, .index-key-placement, .index-key-domains, .index-key-email) .index-icon { background: light-dark(#e4edf9, #1e3049); color: light-dark(#32629c, #9cbfee); }
+ .index-nav :is(.index-key-team, .index-key-availability, .index-key-protection, .index-key-storage) .index-icon { background: light-dark(#e1f0ed, #1b3833); color: light-dark(#28685e, #99d2c5); }
+ .index-nav :is(.index-key-settings, .index-key-general, .index-key-logs, .index-key-environments) .index-icon { background: light-dark(#ececf0, #2c2d34); color: var(--muted); }
+ .index-nav .index-key-delete .index-icon { background: light-dark(#f7e9e8, #3b2425); color: var(--bad); }
+ /* The box clips to its rounded corners, so the end rows take the same
+ curve (their background and focus ring follow it) and the ring sits
+ 3px inside, where the clip cannot reach it. */
+ .index-nav a:first-child { border-top-left-radius: calc(var(--rst-radius) - 1px); border-top-right-radius: calc(var(--rst-radius) - 1px); }
+ .index-nav a:last-child { border-bottom-left-radius: calc(var(--rst-radius) - 1px); border-bottom-right-radius: calc(var(--rst-radius) - 1px); }
+ .index-nav a:hover, .index-nav a:target { background: var(--accent-soft); }
+ .index-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
+ @media (forced-colors: active) { .index-nav a:focus-visible { outline-color: Highlight; } }
+ @media (max-width: 800px) {
+ body[data-view] header :is(.switcher, .brand, .account-links) { display: none; }
+ body[data-view] header {
+ position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; gap: 0.75rem;
+ max-width: none; margin: 0 -1.25rem; padding: 0.375rem 0.5rem; border-top: 0;
+ background: var(--rst-bg);
+ }
+ body[data-view] header nav { flex: none; margin-left: auto; flex-wrap: nowrap; gap: 0; }
+ body[data-view] header .mobile-back, body[data-view] header .mobile-root { display: flex; align-items: center; flex: 1; min-width: 0; }
+ body[data-view] header .mobile-root { font-weight: 500; min-height: 2.75rem; padding: 0.35rem 0.75rem; }
+ body[data-view="page"] .tabs, body[data-view="page"] .settings-nav { display: none; }
+ body[data-view] { border-top: 3px solid var(--accent); }
+ body[data-view] .pagehead > .eyebrow { display: none; }
+ body[data-view] main { padding-top: 1.25rem; }
+ .mobile-back a {
+ display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; min-width: 2.75rem;
+ box-sizing: border-box; padding: 0.35rem 0.75rem; font-weight: 500; text-decoration: none;
+ overflow-wrap: anywhere;
+ }
+ .mobile-back a::before {
+ content: ""; flex: none; width: 0.55rem; height: 0.55rem;
+ border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(-45deg);
+ }
+ .mobile-back a:focus-visible { outline-offset: -2px; }
+ :root:has(body[data-view]) { scroll-padding-top: calc(3.5rem + 1px); }
+ .pagehead > h1:has(+ .mobile-title) { display: none; }
+ .pagehead > .mobile-title { display: block; overflow-wrap: anywhere; }
+ .index-nav { max-width: none; }
+
+ }
+{{end}}
+
+{{define "console_header"}}<header>
+ {{if .Account}}
+ <details class="switcher" id="switcher">
+ <summary>
+ <span class="small">Account</span>
+ <span class="current-name">{{.Account.Name}}</span>
+ {{icon "chevron-down"}}
+ </summary>
+ <div class="switcher-menu">
+ {{if gt (len .Accounts) 7}}<input type="search" class="switcher-find" placeholder="Find an account" aria-label="Find an account" autocomplete="off" spellcheck="false" hidden>
+ <p class="switcher-none" hidden>No account matches that.</p>{{end}}
+ <ul>
+ {{range .Accounts}}<li>{{if eq .Sqid $.Account.Sqid}}
+ <span class="current" aria-current="true"><span class="mark">{{icon "check"}}</span>{{.Name}}</span>
+ {{else}}
+ <a href="/a/{{.Seg}}/"><span class="mark">{{icon "check"}}</span>{{.Name}}</a>
+ {{end}}</li>
+ {{end}}
+ </ul>
+ <hr>
+ <div class="new"><a href="/accounts/new"><span class="mark">{{icon "plus"}}</span>New account</a></div>
+ </div>
+ </details>
+ {{else}}
+ <div class="brand"><a href="/">{{.Brand}}</a></div>
+ {{end}}
+ {{with .MobileBack}}<div class="mobile-back"><a href="{{.Href}}" rel="up">{{.Label}}</a></div>
+ {{end}}{{if eq .IndexOf "accounts"}}<span class="mobile-root" aria-hidden="true">Accounts</span>
+ {{end}}{{if .Address}}<nav>
+ <span class="account-links">{{range .AccountLinks}}<a href="{{.Href}}"{{if .Current}} aria-current="page"{{end}}>{{.Label}}</a>
+ {{end}}</span>
+ <details class="profile" id="profile">
+ <summary aria-label="{{.Address}}">{{icon "user-round"}}{{icon "chevron-down"}}</summary>
+ <div class="profile-menu">
+ <a class="addr" href="/settings">{{.Address}}</a>
+ <form method="post" action="/auth/signout">
+ <input type="hidden" name="csrf" value="{{.CSRF}}">
+ <button class="linkish" type="submit">Sign out</button>
+ </form>
+ </div>
+ </details>
+ </nav>{{end}}
+</header>{{end}}
diff --git a/internal/console/templates/demo_claim.html b/internal/console/templates/demo_claim.html
index 2d5631065..93bc684a1 100644
--- a/internal/console/templates/demo_claim.html
+++ b/internal/console/templates/demo_claim.html
@@ -5,8 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="origin">
<title>{{.Copy.title}}</title>
+<style>{{template "console_styles" .}}</style>
</head>
<body>
+{{template "console_header" .Chrome}}
<main id="claim" data-failed="{{.Copy.failed}}">
<h1>{{.Copy.title}}</h1>
{{if .Error}}<p role="alert">{{.Error}}</p><p><a href="/demo/claim">{{.Copy.back}}</a></p>{{end}}
@@ -26,15 +28,16 @@
{{if and .HasIntent .CanClaim}}
{{if .Address}}
<p>{{.Copy.identity}} <strong>{{.Address}}</strong></p>
-<form method="post" action="/demo/claim/select">
+<form method="post" action="/demo/claim/select"{{if .AutoSubmit}} data-auto-submit{{end}}>
<input type="hidden" name="nonce" value="{{.Nonce}}"><input type="hidden" name="csrf" value="{{.CSRF}}">
{{if .Accounts}}
<label for="account">{{.Copy.account}}</label>
<select id="account" name="accountId" required>
-{{if gt (len .Accounts) 1}}<option value="" selected disabled>{{.Copy.choose}}</option>{{end}}
-{{range .Accounts}}<option value="{{.Sqid}}">{{.Name}} ({{.Sqid}})</option>{{end}}
+{{if gt (len .Accounts) 1}}<option value=""{{if not .SelectedAccount}} selected{{end}} disabled>{{.Copy.choose}}</option>{{end}}
+{{range .Accounts}}<option value="{{.Sqid}}"{{if eq .Sqid $.SelectedAccount}} selected{{end}}>{{.Name}} ({{.Sqid}})</option>{{end}}
</select>
{{else}}<p>{{.Copy.new}}</p><input type="hidden" name="create" value="1">{{end}}
+<p id="claim-resuming" role="status" hidden>{{.Copy.resuming}}</p>
<button type="submit">{{.Copy.confirm}}</button>
</form>
{{else}}
@@ -47,7 +50,7 @@
<p>{{.Copy.sent}}</p>
<form method="post" action="/demo/claim/prove">
<input type="hidden" name="nonce" value="{{.Nonce}}"><input type="hidden" name="csrf" value="{{.CSRF}}">
-<label for="code">{{.Copy.code}}</label><input id="code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" required>
+<label for="code">{{.Copy.code}}</label><input type="text" id="code" name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" required>
<button type="submit">{{.Copy.prove}}</button>
</form>
{{end}}
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html
index 777b334a0..cb26374a9 100644
--- a/internal/console/templates/layout.html
+++ b/internal/console/templates/layout.html
@@ -4,1156 +4,10 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Title}} · {{.Brand}}</title>
-<style>
-{{template "fiesta_day" .}}
- /* Native controls (number spinners, checkboxes, selects, scrollbars)
- follow the theme, so they stay visible on the dark background. */
- :root { color-scheme: light dark; }
- :root {
- --rst-radius: 0.6rem; --rst-radius-sm: 0.4rem;
- --rst-bg: light-dark(#ffffff, #0c0d0f);
- --rst-surface: light-dark(#ffffff, #141518);
- --rst-surface-2: light-dark(#f7f7f8, #18191d);
- --rst-line: light-dark(#e6e6ea, #26282e);
- --rst-line-strong: light-dark(#868691, #71737c);
- --rst-text: light-dark(#202126, #ededf0);
- --rst-text-muted: light-dark(#60616b, #a1a1aa);
- --rst-accent: light-dark(#6f2c65, #d7a0cd);
- --rst-accent-strong: light-dark(#55204d, #ecc0e4);
- --rst-accent-soft: light-dark(rgba(111, 44, 101, 0.08), rgba(215, 160, 205, 0.12));
- --rst-accent-fill: light-dark(#6f2c65, #864078);
- --rst-accent-fill-hover: light-dark(#5a2352, #743367);
- --rst-accent-fill-edge: light-dark(#491b42, #52234a);
- --rst-accent-fill-edge-hover: light-dark(#391433, #411b3a);
- --rst-control-face: var(--rst-surface);
- --rst-control-face-hover: light-dark(#f7f8fa, #1b1d22);
- --rst-control-face-press: light-dark(#e6e9ee, #202329);
- --rst-control-border: light-dark(#d0d4dc, #343843);
- --rst-control-border-hover: light-dark(#8a8a95, #71737c);
- --rst-depth-hl: light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.07));
- --rst-depth-contact: light-dark(rgba(16, 24, 40, 0.12), rgba(0, 0, 0, 0.5));
- --rst-depth-ambient: light-dark(rgba(16, 24, 40, 0.06), rgba(0, 0, 0, 0.35));
- --rst-depth-face: 0.06;
- --rack-edge: light-dark(#d9cde0, #392b43);
- --panel-cool: light-dark(#faf7fb, #1c1823);
- --wire: light-dark(#a4a4af, #686a76);
- --field: light-dark(#fafafb, #101114);
- --shadow-module: inset 1px 1px 0 var(--rst-depth-hl), 1px 2px 0 var(--rack-edge), 2px 5px 8px -3px var(--rst-depth-ambient);
- --shadow-raised: inset 0 1px 0 var(--rst-depth-hl), 0 1px 0 var(--rack-edge), 0 2px 3px -1px var(--rst-depth-ambient);
- --shadow-inset: inset 0 1px 2px var(--rst-depth-contact);
- --bg: var(--rst-surface); --ink: var(--rst-text); --muted: var(--rst-text-muted);
- --accent: var(--rst-accent); --accent-strong: var(--rst-accent-strong);
- --accent-soft: var(--rst-accent-soft);
- --rule: var(--rst-line); --bad: var(--rst-tone-negative-fg);
- --warn: var(--rst-tone-warning-fg); --good: var(--rst-tone-positive-fg);
- --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
- --sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
- }
- [hidden] { display: none !important; }
- * { margin: 0; padding: 0; box-sizing: border-box; }
- body {
- background: var(--rst-bg); color: var(--ink);
- font: 400 1rem/1.6 var(--sans);
- -webkit-font-smoothing: antialiased; padding: 0 1.25rem;
- }
- a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
- code {
- font-family: var(--mono);
- font-size: 0.88em; background: var(--accent-soft);
- padding: 0.1em 0.35em; border-radius: 0.25rem;
- }
- pre {
- background: var(--accent-soft); border-radius: 0.5rem;
- padding: 0.9rem 1.1rem; margin: 0 0 1rem; max-width: 40rem;
- overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.6;
- }
- pre code { background: none; padding: 0; }
- /* A tag's changelog and a release's notes are prose, not code — long lines
- should wrap inside the box rather than force the horizontal scrollbar
- every other <pre> on this page gets for a shell command. */
- .changelog { white-space: pre-wrap; }
- select, input[type=text], input[type=search], input[type=email], input[type=number] {
- font: inherit; font-family: var(--sans); font-size: 0.9rem; color: var(--ink); background: var(--field);
- border: 1px solid var(--rst-line-strong); border-radius: var(--rst-radius-sm); padding: 0.3rem 0.5rem;
- box-shadow: var(--shadow-inset);
- }
- select:disabled, input:disabled {
- background: var(--rst-surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed;
- }
- /* One focus ring for every control, drawn outside the raised edge. Where a
- scrolling box would clip it, it is drawn just inside instead. */
- :where(a, button, .btn, select, summary, input:not([type=radio]):not([type=checkbox])):focus-visible {
- outline: 2px solid var(--accent); outline-offset: 2px;
- }
- :where(input:not([type=radio]):not([type=checkbox]), select):focus-visible { outline-offset: 1px; }
- .tablewrap :where(a, button, select, input):focus-visible,
- .settings-nav a:focus-visible, header .switcher-menu a:focus-visible { outline-offset: -2px; }
- td form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin: 0; }
- /* A form living inside a sentence (the bake toggle, a rung's fast-track):
- it must not break the line it is part of. */
- form.inline { display: inline; margin: 0; }
- form.inline button { vertical-align: baseline; }
- /* A list's filter row (the Running tab): every control the same height on
- one line, wrapping onto the next when the screen is too narrow. */
- .toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
- .toolbar input, .toolbar select, .toolbar button { height: 2rem; margin: 0; }
- /* economics_accounts.html (a frozen operator page) still says listctl. */
- .listctl { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
- .toolbar label { display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%; font-size: 0.9rem; color: var(--muted); }
- .toolbar select, .toolbar input[type=search], .toolbar input[type=text] { max-width: 100%; min-width: 0; }
- #logs-filter select[name="host"] { max-width: 12rem; }
- /* A section heading with its one action at the right end of the row. */
- .sectionhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 0.75rem; }
- .sectionhead h2 { margin: 0; }
- /* Interface icons: inline SVG from internal/console/icons.go — Lucide,
- vendored, because this page fetches nothing from anywhere. They carry no
- width/height of their own, so they size to the text beside them and
- inherit its colour. */
- .icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
- header {
- max-width: 64rem; margin: 0 auto; padding: 1rem 0;
- display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; row-gap: 0.5rem;
- border-top: 3px solid var(--accent); border-bottom: 1px solid var(--rule);
- }
- header .brand a { font-weight: 700; color: var(--ink); text-decoration: none; }
- header nav {
- margin-left: auto; display: flex; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap;
- font-size: 0.9rem;
- }
- /* The profile menu: a <details> like the switcher, so it works with no
- JavaScript. Its summary is the signed-in address as an icon button;
- the menu holds the address (a link to settings) and Sign out. */
- header .profile { position: relative; flex: none; }
- header .profile > summary {
- display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem;
- list-style: none; cursor: pointer; min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.6rem;
- border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius-sm);
- background-color: var(--rst-control-face); color: var(--muted); box-shadow: var(--shadow-raised);
- font-size: 1.1rem;
- }
- header .profile > summary::-webkit-details-marker { display: none; }
- header .profile > summary:hover { background-color: var(--rst-control-face-hover); color: var(--ink); }
- header .profile[open] > summary { background-color: var(--rst-control-face-press); color: var(--ink); box-shadow: var(--shadow-inset); }
- header .profile > summary > .icon { pointer-events: none; }
- header .profile > summary > .icon + .icon { width: 0.7em; height: 0.7em; }
- header .profile[open] > summary > .icon + .icon { transform: rotate(180deg); }
- header .profile-menu {
- position: absolute; z-index: 20; top: calc(100% + 0.5rem); right: 0;
- width: max-content; min-width: 13rem; max-width: min(20rem, calc(100vw - 2.5rem));
- display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem;
- background: var(--bg); border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius);
- padding: 0.35rem; font-size: 0.9rem;
- box-shadow: var(--rst-shadow-pop), 1px 2px 0 var(--rack-edge);
- }
- header .profile-menu .addr, header .profile-menu button.linkish {
- display: flex; align-items: center; min-height: 2.75rem; padding: 0.4rem 0.55rem;
- border-radius: var(--rst-radius-sm); text-align: left; overflow-wrap: anywhere;
- }
- header .profile-menu .addr { color: var(--muted); }
- header .profile-menu :is(.addr, button.linkish):hover { background: var(--accent-soft); }
- header .profile-menu :is(.addr, button.linkish):focus-visible { outline-offset: -2px; }
- header .profile-menu form { margin: 0; }
- header .profile-menu button.linkish { width: 100%; }
- header .mobile-root { display: none; }
- /* The account switcher sits where the wordmark used to: a <details>
- disclosure, so it is a real button to a screen reader, opens on
- Enter/Space, and needs no JavaScript to work at all. The inline script
- at the foot only adds Escape and click-away, which are enhancements. */
- header .switcher {
- position: relative;
- }
- header .switcher > summary {
- display: inline-flex; align-items: baseline; gap: 0.4rem;
- list-style: none; cursor: pointer;
- padding: 0.25rem 0.6rem; border-radius: var(--rst-radius-sm);
- background-color: var(--rst-control-face); color: var(--accent-strong);
- border: 1px solid var(--rst-control-border); box-shadow: var(--shadow-raised);
- }
- header .switcher > summary .small { color: inherit; }
- header .switcher > summary::-webkit-details-marker { display: none; }
- header .switcher > summary:hover { background-color: var(--rst-control-face-hover); }
- header .switcher[open] > summary {
- background-color: var(--accent-soft);
- box-shadow: var(--shadow-inset);
- }
- /* Names are free text up to 64 characters, which unbounded would shove the
- nav off the header — truncate in the trigger, wrap in the menu. */
- header .switcher .current-name {
- font-weight: 700; min-width: 0; max-width: 14rem;
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
- }
- /* The caret is an icon, not a text character: centred against a
- baseline-aligned row and flipped while the menu is open. */
- header .switcher > summary > .icon { color: currentColor; align-self: center; width: 0.9em; }
- header .switcher[open] > summary > .icon { transform: rotate(180deg); }
- header .switcher-menu {
- position: absolute; z-index: 20; top: calc(100% + 0.5rem); left: 0;
- /* max-content, not shrink-to-fit: the menu's containing block is the
- narrow trigger, so shrink-to-fit pinned it at min-width and wrapped
- any name longer than that mid-word. */
- width: max-content; min-width: 13rem; max-width: 20rem;
- background: var(--bg); border: 1px solid var(--rst-control-border); border-radius: var(--rst-radius);
- padding: 0.35rem; font-size: 0.9rem;
- box-shadow: var(--rst-shadow-pop), 1px 2px 0 var(--rack-edge);
- }
- /* Someone in dozens of accounts gets a list that scrolls inside the menu
- instead of running off the bottom of the screen. */
- header .switcher-menu ul {
- list-style: none; margin: 0; padding: 0;
- max-height: min(22rem, 60vh); overflow-y: auto; overscroll-behavior: contain;
- }
- /* The filter box only renders past a handful of accounts, and stays
- hidden until the script at the foot shows it: with JS off it could not
- filter anything. */
- header .switcher-find { display: block; width: 100%; margin: 0 0 0.35rem; }
- header .switcher-none { padding: 0.35rem 0.55rem; color: var(--muted); }
- header .switcher-menu a, header .switcher-menu .current {
- display: flex; align-items: baseline; gap: 0.5rem;
- padding: 0.35rem 0.55rem; border-radius: 0.4rem;
- color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
- }
- header .switcher-menu a:hover, header .switcher-menu a:focus { background: var(--accent-soft); }
- header .switcher-menu .current { font-weight: 600; background: var(--accent-soft); }
- /* The mark column reserves its width on every row so the names stay in one
- column: a check on the account you are in, hidden on the ones you are
- not, a plus on "New account". */
- header .switcher-menu .mark {
- color: var(--accent); width: 0.9rem; flex: none;
- display: flex; align-self: center;
- }
- header .switcher-menu a .mark { visibility: hidden; }
- header .switcher-menu .new a .mark { visibility: visible; }
- header .switcher-menu hr { border: 0; border-top: 1px solid var(--rule); margin: 0.35rem 0.2rem; }
- header .switcher-menu .new a { color: var(--accent); }
- main { max-width: 64rem; margin: 0 auto; padding: 2.5rem 0 3rem; min-height: 55vh; }
- h1 { overflow-wrap: anywhere; font-size: 1.9rem; line-height: 1.15; margin: 0 0 1rem; color: var(--accent-strong); }
- h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
- h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
- /* Settings: an input-and-button row, and the deletion section's heading
- in the ink that says be careful. */
- .settings-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 0 0 0.75rem; }
- .settings-layout {
- display: grid; grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
- gap: 2.5rem; align-items: start;
- }
- .settings-nav { display: flex; flex-direction: column; gap: 0.2rem; }
- .settings-nav a {
- display: block; padding: 0.45rem 0.65rem; border-radius: 0.35rem;
- color: var(--muted); text-decoration: none;
- }
- .settings-nav a:hover { color: var(--ink); background: var(--accent-soft); }
- .settings-nav a[aria-current="page"] {
- color: var(--ink); background: var(--accent-soft); font-weight: 600;
- }
- .settings-content {
- min-width: 0; padding: 1.25rem 1.5rem 0.5rem; background-color: var(--bg);
- border: 1px solid var(--rule); border-radius: var(--rst-radius); box-shadow: var(--shadow-module);
- }
- .settings-content :is(.tile, .tablewrap, .rung) { background-color: var(--rst-surface-2); box-shadow: none; }
- .settings-content > h2:first-child { margin-top: 0; }
- .danger-head { color: var(--bad); }
- p { max-width: 40rem; margin: 0 0 1rem; }
- .lede { font-size: 1.15rem; color: var(--muted); }
- .small { font-size: 0.9rem; color: var(--muted); }
- /* Present to a screen reader, absent to the eye — for labels the visual
- design carries in placement or placeholder text alone. */
- .visually-hidden {
- position: absolute; width: 1px; height: 1px; overflow: hidden;
- clip-path: inset(50%); white-space: nowrap;
- }
- .error { color: var(--bad); }
- .banner {
- background: var(--accent-soft); border-radius: 0.5rem;
- padding: 0.6rem 0.9rem; margin: 0 0 1.5rem; max-width: 40rem;
- }
- :where(main) :where(ul:not([class]), ol:not([class]), ul.small, ol.small) { padding-left: 1.25rem; margin: 0 0 1rem; }
- .tablewrap {
- overflow-x: auto; margin: 0 0 1rem; background-color: var(--bg);
- border: 1px solid var(--rule); border-radius: var(--rst-radius); box-shadow: var(--shadow-module);
- }
- .tablewrap > table:not(.packs) { margin: 0; }
- .tablewrap > table:not(.packs) :is(th, td):first-child { padding-left: 0.9rem; }
- .tablewrap > table:not(.packs) > :last-child > tr:last-child > :is(th, td) { border-bottom: 0; }
- .tablewrap > table:not(.packs) tr:not(.instance-group) > th { background-color: var(--panel-cool); }
- .tablewrap:has(> table.packs) { background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
- .instances .instance-address { white-space: nowrap; }
- .instances td:nth-child(2) { white-space: nowrap; }
- .methods td:nth-child(3), .methods td:nth-child(4) { white-space: nowrap; }
- .instance-open { display: inline-flex; padding: .25rem; }
- .instance-group th { text-align: left; padding-top: 1rem; background: var(--accent-soft); }
- .instance-group .small { font-weight: normal; }
- .small a[aria-current="true"] { color: var(--ink); font-weight: 700; text-decoration-thickness: 3px; }
- .instance-facts { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .5rem 1.5rem; margin: 1rem 0; }
- .instance-facts dt { color: var(--muted); }
- .instance-facts dd { margin: 0; overflow-wrap: anywhere; }
- .instance-facts .cellspark { max-width: 24rem; }
- /* The Logs tab (logsview.go): the pane reads as the terminal it mirrors —
- the same line `carlos logs` prints, monospaced, one line per record, no
- wrapping. A table wrapped every message across three rows and put the
- eye back at the left margin for each one, which is precisely what a log
- reader is scanning past.
-
- Ground is the shell-command <pre>'s own fill rather than a terminal's
- black: this page is a light document in light mode, and a black
- rectangle down the middle of it would read as a foreign object, not as
- the console's own output. The pane is a scrolled region in BOTH axes —
- sideways because lines do not wrap, and down because 200 lines must not
- turn the page itself into the scrollbar. */
- .term {
- background: var(--accent-soft); border-radius: 0.5rem;
- padding: 0.8rem 0 0.8rem 1rem; margin: 0 0 1rem;
- min-height: 16rem; max-height: 70vh; overflow: auto;
- font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
- }
- /* white-space:pre belongs to the LINE, not the pane: on the pane it would
- render the newlines BETWEEN these divs as blank lines. width:max-content
- with min-width:100% makes each line as wide as its own text, so the
- pane's horizontal scroll reaches the end of the longest one — and the
- right-hand gutter is the LINE's padding, not the pane's, because a
- scrolled-away pane padding leaves the longest line hard against the
- edge. */
- .tl { white-space: pre; width: max-content; min-width: 100%; padding-right: 1rem; }
- /* Time, host and trailing k=v fields are the line's furniture; the message
- is what the reader came for, so it alone gets full-strength ink. */
- .tl-t, .tl-h, .tl-f { color: var(--muted); }
- .tl-s { color: var(--accent); }
- /* The CLI colours a level rather than printing its name (logs.go's
- printLogRecords); the pane says it the same way, in the same two tones
- the rest of this console uses for warn and bad. */
- .tl-warn .tl-m { color: var(--warn, #a6790f); }
- .tl-error .tl-m { color: var(--bad); font-weight: 600; }
- table { border-collapse: collapse; width: 100%; margin: 0 0 1rem; font-size: 0.95rem; }
- .tiles { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0 0 1.5rem; }
- .tile {
- flex: 1 1 10rem; background-color: var(--bg); border: 1px solid var(--rule);
- border-radius: var(--rst-radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-module);
- }
- /* A tile that is also a link (the Overview dashboard): the tile itself is
- the affordance, so no underline and no accent ink — hover carries it. */
- a.tile { color: var(--ink); text-decoration: none; }
- a.tile:hover { outline: 1px solid var(--accent); }
- /* The dashboard's six statistics as an even grid — flex would let the
- last row's stragglers stretch full-width. */
- .stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
- .tile h2 {
- margin: 0 0 0.35rem; font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
- letter-spacing: 0.05em; color: var(--accent-strong); font-weight: 600;
- }
- .tile-value { font-size: 1.6rem; font-weight: 600; margin: 0; }
- .tile-detail { color: var(--muted); font-size: 0.8rem; margin: 0.25rem 0 0; }
- /* .chip-stale is bordered-only, no fill — a "trust this less" flag, not
- an outage marker, matching internal/status/assets/status.css. */
- .chip {
- display: inline-block; font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
- padding: 0.15rem 0.55rem; border-radius: 999px; margin: 0.15rem 0.3rem 0.15rem 0;
- }
- .chip-stale { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
- /* A canary is bordered — a fact about a route, not a warning. A canary on
- the app's primary host is FILLED, because an unreviewed build in front of
- every user is the one thing on this page a reader must not skim past. */
- .chip-canary { border: 1px solid var(--accent); color: var(--accent); }
- .chip-prod { background: var(--bad); color: var(--bg); }
- /* An expired canary (spec §5) keeps serving — this is "trust this less",
- the same bordered-only warning as .chip-stale, never a filled outage
- marker like .chip-prod. */
- .chip-expired { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
- /* A route's bound environment — a fact, not a warning, so it is bordered
- like .chip-canary but in a neutral tone: it sits on every route, not
- just the ones worth a second look. */
- .chip-env { border: 1px solid var(--rule); color: var(--muted); }
- /* Health verdict chips. "attention" is the one filled variant here — the
- row a reader must not skim past — in the warn tone, not .chip-prod's
- red: a silent instance is a problem, not the unreviewed-build outage.
- ok/notdeployed/unknown are bordered facts. */
- .chip-health-ok { border: 1px solid var(--good); color: var(--good); }
- .chip-health-attention { background: var(--warn, #a6790f); color: var(--bg); }
- .chip-health-notdeployed { border: 1px solid var(--rule); color: var(--muted); }
- .chip-health-unknown { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
- /* A small lamp ahead of each verdict. The word carries the status; the
- lamp is a second cue in a different shape: ok lit and round, attention a
- solid diamond, unknown a hollow ring, not deployed an unlit dot. */
- .chip-health-ok::before, .chip-health-attention::before,
- .chip-health-notdeployed::before, .chip-health-unknown::before {
- content: ""; display: inline-block; width: 0.55em; height: 0.55em;
- margin: 0 0.4em 0.1em 0; border-radius: 50%; vertical-align: middle;
- }
- .chip-health-ok::before { background: var(--good); box-shadow: 0 0 0.4em color-mix(in srgb, var(--good) 55%, transparent); }
- .chip-health-attention::before { background: var(--bg); border-radius: 1px; transform: rotate(45deg); }
- .chip-health-unknown::before { box-shadow: inset 0 0 0 2px var(--warn, #a6790f); }
- .chip-health-notdeployed::before { background: var(--muted); opacity: 0.45; }
- /* /fleet/economics/accounts (Task 14): FreeTierPos chips. "inside" (all
- usage covered by the free tier, zero revenue) is the pure-cost-sink
- case worth a second look, so it gets the same bordered warn tone as
- chip-stale/chip-health-unknown — a fact to watch, not yet an outage.
- "partial" (some usage billable, some free-tier-covered — the ordinary
- lifecycle state) is a neutral accent border, chip-canary's tone.
- "paying" (nothing left free) is chip-health-ok's bordered good tone.
- "pooled" (Task 5: a try/pool/"" tier account, priced at zero revenue by
- design, drawing from the fleet pool instead) is a STATUS, not a
- warning — chip-env's muted neutral tone, the same posture as an
- ordinary route fact nobody needs to act on. */
- .chip-freetier-inside { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
- .chip-freetier-partial { border: 1px solid var(--accent); color: var(--accent); }
- .chip-freetier-paying { border: 1px solid var(--good); color: var(--good); }
- .chip-freetier-pooled { border: 1px solid var(--rule); color: var(--muted); }
- /* /fleet/economics/accounts (Task 6): fleet-pool TIER chips (store.go's
- validAccountTiers) — the operator's ASSIGNMENT, distinct from the
- freetier chips above (a PRICED POSITION). "unassigned" (never set) and
- "try"/"pool" (both draw from the shared pool, same as an unassigned
- account) share chip-freetier-pooled's muted, nothing-to-act-on tone.
- "hosted"/"fleet"/"dedicated" are individually priced, each its own
- bordered tone so the three read apart at a glance without implying a
- ranking between them. */
- .chip-tier-unassigned { border: 1px solid var(--rule); color: var(--muted); }
- .chip-tier-try { border: 1px solid var(--rule); color: var(--muted); }
- .chip-tier-pool { border: 1px solid var(--rule); color: var(--muted); }
- .chip-tier-hosted { border: 1px solid var(--good); color: var(--good); }
- .chip-tier-fleet { border: 1px solid var(--accent); color: var(--accent); }
- .chip-tier-dedicated { border: 1px solid var(--warn, #a6790f); color: var(--warn, #a6790f); }
- .chip .icon { vertical-align: -0.1em; margin-right: 0.2em; }
- .chip-up { background: var(--accent-soft); color: var(--good); }
- .chip-down { background: var(--accent-soft); color: var(--bad); }
- .chips { display: flex; flex-wrap: wrap; margin: 0 0 1rem; }
- /* /fleet/economics (Task 13): a box's utilization as a filled bar, CSS
- width only — the initial render needs no JS, and the inline knob script
- updates .bar-fill's width style in place on recompute. */
- .bar { display: inline-block; width: 6rem; height: 0.5rem; border-radius: 999px; background: var(--accent-soft); vertical-align: middle; overflow: hidden; }
- .bar-fill { display: block; height: 100%; background: var(--accent); }
- /* The knob drawer: one row per rate-card number, label then control,
- narrower than .settings-row's button-row spacing since these are all
- text/number inputs with no submit button riding along on the same line. */
- .knob-row { display: flex; gap: 0.6rem; align-items: center; margin: 0 0 0.5rem; flex-wrap: wrap; }
- .knob-row label { min-width: 12rem; color: var(--muted); font-size: 0.9rem; }
- .knob-row input[type=number], .knob-row input[type=text] { width: 8rem; }
- .knob-row input[type=range] { width: 12rem; }
- /* The app flow diagram (flow.go): the release path drawn as the pipeline it
- is, with the addresses each channel feeds hanging under it.
-
- The one claim the drawing makes beyond its own words is the ARROW: solid
- and accented where a version really did travel that step, dashed and grey
- where it did not. That is what lets "how far has my build got" be seen
- rather than worked out by comparing three version strings, so the two
- states have to stay visually unmistakable — and distinguishable by more
- than colour, hence solid vs dashed. */
- .flow { margin: 0 0 1.75rem; }
- .flow-line {
- --flow-y: 1.25rem;
- display: flex; flex-wrap: wrap; gap: 1.1rem 2.6rem;
- list-style: none; margin: 0; padding: 0;
- }
- .flow-stage {
- position: relative; flex: 1 1 10rem; min-width: 9rem; padding: 0.7rem 0.85rem 0.8rem;
- background-color: var(--bg); border: 1px solid var(--rule); border-radius: var(--rst-radius);
- box-shadow: var(--shadow-module);
- }
- .flow-stage + .flow-stage::before, .flow-stage + .flow-stage::after {
- content: ""; position: absolute; pointer-events: none;
- }
- .flow-stage + .flow-stage::before {
- left: -2.05rem; top: var(--flow-y); width: 1.3rem; border-top: 1px dashed var(--wire);
- }
- .flow-stage + .flow-stage::after {
- left: -0.82rem; top: var(--flow-y); transform: translateY(-50%);
- border: 0.28rem solid transparent; border-right: 0; border-left-color: var(--wire);
- }
- .flow-stage.is-carried::before { border-top-style: solid; border-top-color: var(--accent); }
- .flow-stage.is-carried::after { border-left-color: var(--accent); }
- .flow-label {
- margin: 0; font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase;
- letter-spacing: 0.05em; color: var(--muted); font-weight: 600; overflow-wrap: anywhere;
- }
- .flow-version { margin: 0.3rem 0 0; font-size: 0.95rem; overflow-wrap: anywhere; }
- /* Empty stages keep the same raised edge, with a neutral face. */
- .flow-stage:not(.is-held) { background-color: var(--rst-surface-2); }
- .flow-stage:not(.is-held) .flow-version { color: var(--muted); }
- .flow-stage.is-held { background-color: var(--panel-cool); }
- .flow-stage.is-held .flow-label { color: var(--accent-strong); }
- .flow-note { margin: 0.25rem 0 0; font-size: 0.78rem; color: var(--muted); }
- .flow-addrs {
- list-style: none; margin: 0.6rem 0 0; padding: 0 0 0 0.7rem;
- border-left: 1px solid var(--rule); display: grid; gap: 0.35rem;
- }
- .flow-addr { font-size: 0.82rem; line-height: 1.35; }
- .flow-addr a { display: block; overflow-wrap: anywhere; }
- .flow-region { color: var(--muted); margin-right: 0.35rem; }
- .flow-health { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--muted); }
- .flow-health .icon { width: 0.9em; height: 0.9em; flex: none; }
- .flow-tone-ok .flow-health { color: var(--good); }
- .flow-tone-wait .flow-health { color: var(--warn, #a6790f); }
- .flow-tone-bad .flow-health { color: var(--bad); font-weight: 600; }
- .flow-band { margin: 1.4rem 0 0.7rem; font-size: 0.9rem; color: var(--muted); }
- .flow-caption { margin: 1.1rem 0 0; }
- /* Narrow screens: the same path, turned down the page. The connector turns
- with it — an arrow still pointing the way the version travels. */
- @media (max-width: 46rem) {
- .settings-layout { display: block; }
- .settings-nav {
- flex-direction: row; overflow-x: auto; margin: 0 0 1.5rem;
- padding-bottom: 0.25rem;
- }
- .settings-nav a { white-space: nowrap; }
- .settings-content { padding: 1rem 1rem 0.25rem; }
- .flow-line { display: block; }
- .flow-stage + .flow-stage { margin-top: 2.25rem; }
- .flow-stage + .flow-stage::before {
- left: 1rem; top: -1.75rem; width: 0; height: 0.85rem;
- border-top: 0; border-left: 1px dashed var(--wire);
- }
- .flow-stage + .flow-stage::after {
- left: 1rem; top: -0.9rem; transform: translateX(-50%);
- border: 0.28rem solid transparent; border-bottom: 0; border-top-color: var(--wire);
- border-left-color: transparent;
- }
- .flow-stage.is-carried::before { border-left-color: var(--accent); }
- .flow-stage.is-carried::after { border-top-color: var(--accent); border-left-color: transparent; }
- }
- /* The release ladder: four rungs drawn top-down in the order the spec
- draws them (canary first, stable at the foot), with the promotion
- between two of them rendered as the step it is. list-style is off
- because the rung's own name is its marker. */
- .ladder { list-style: none; margin: 0 0 1rem; padding: 0; max-width: 40rem; }
- .rung {
- border: 1px solid var(--rule); border-radius: var(--rst-radius); padding: 0.8rem 1rem;
- background-color: var(--bg); box-shadow: var(--shadow-module);
- }
- .rung + .rung { margin-top: 0.4rem; }
- .rung-name {
- font-family: var(--mono);
- font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
- font-weight: 600; color: var(--muted); margin: 0 0 0.3rem;
- }
- .rung p { margin: 0 0 0.2rem; }
- .rung .gate { margin: 0.5rem 0 0; }
- .rung .routes { list-style: none; margin: 0.3rem 0 0.6rem; padding: 0; font-size: 0.95rem; }
- .rung .routes li { padding: 0.1rem 0; }
- /* The step to the next rung is the last band of the rung it leaves: ruled
- off, full width, so the arrow reads as "and then down to here". */
- .step {
- display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
- margin: 0.7rem -1rem -0.8rem; padding: 0.5rem 1rem;
- border-top: 1px solid var(--rule);
- }
- .step form { display: flex; align-items: baseline; gap: 0.5rem; margin: 0; }
- .step > .icon { color: var(--muted); align-self: center; }
- th {
- font-family: var(--mono);
- font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
- color: var(--muted); text-align: left; font-weight: 600;
- }
- th, td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
- form.signin { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1rem; }
- form.signin input[type=text], form.signin input[type=email] { padding: 0.55rem 0.8rem; min-width: 16rem; }
- form.signin label { flex-basis: 100%; font-weight: 600; }
- /* A button is a small raised module: a fill, a hairline edge in its own
- darker tone, a short lip under it that it sinks into when pressed. The
- variants below only swap the --btn-* tones, so hover, press and busy
- stay one set of rules. */
- button, .btn {
- --btn-fill: var(--rst-accent-fill); --btn-fill-hover: var(--rst-accent-fill-hover);
- --btn-edge: var(--rst-accent-fill-edge); --btn-edge-hover: var(--rst-accent-fill-edge-hover);
- --btn-lip: var(--btn-edge); --btn-ink: var(--rst-on-accent-fill);
- --btn-hl: color-mix(in srgb, var(--rst-depth-hl) 30%, transparent);
- font-size: 0.95rem; font-weight: 600; background-color: var(--btn-fill);
- background-image: linear-gradient(rgb(255 255 255 / var(--rst-depth-face)), rgb(0 0 0 / var(--rst-depth-face)));
- color: var(--btn-ink); border: 1px solid var(--btn-edge); border-radius: var(--rst-radius-sm);
- padding: calc(0.6rem - 1px) calc(1.2rem - 1px); cursor: pointer;
- text-decoration: none; display: inline-block;
- box-shadow: inset 0 1px 0 var(--btn-hl), 0 2px 0 var(--btn-lip), 0 3px 4px -2px var(--rst-depth-contact);
- transition: background-color 120ms ease-out, border-color 120ms ease-out, box-shadow 120ms ease-out, translate 80ms ease-out;
- }
- button.linkish {
- background: none; color: var(--accent); font-weight: 400; padding: 0; border: 0; box-shadow: none;
- border-radius: 0; text-decoration: underline; font-size: 0.9rem; cursor: pointer;
- }
- button:not(.linkish, .an-col):not(:disabled):hover, .btn:not([aria-disabled="true"]):hover {
- background-color: var(--btn-fill-hover); border-color: var(--btn-edge-hover);
- }
- button:not(.linkish, .an-col):not(:disabled):not([aria-busy="true"]):active, .btn:not([aria-disabled="true"]):active {
- translate: 0 var(--rst-press-drop);
- box-shadow: inset 0 1px 2px var(--rst-depth-contact), 0 1px 0 var(--btn-lip);
- }
- button:disabled:not([aria-busy="true"]), .btn[aria-disabled="true"] {
- opacity: 0.55; cursor: not-allowed; box-shadow: none;
- }
- button.linkish.danger { color: var(--bad); }
- /* A button marked data-busy shows a spinner once pressed (the script at
- the end of the page); the label stays for screen readers. */
- button[aria-busy="true"] { position: relative; color: transparent; cursor: progress; }
- button[aria-busy="true"]::after {
- content: ""; position: absolute; inset: 0; margin: auto;
- width: 1.1em; height: 1.1em; border-radius: 50%;
- border: 2px solid var(--btn-ink, var(--bg)); border-right-color: transparent;
- animation: busy-spin 0.7s linear infinite;
- }
- @keyframes busy-spin { to { transform: rotate(360deg); } }
- @media (prefers-reduced-motion: reduce) {
- button, .btn { transition: none; }
- button[aria-busy="true"]::after { animation-duration: 2.4s; }
- }
- /* Actions that change what serves are BUTTONS, not links — small enough to
- sit inside a table row or a ladder rung, unmistakably a button all the
- same. Danger is filled red: rollbacks and retirements should not dress
- like promotions. */
- .btn-sm, button.btn-sm {
- font-size: 0.85rem; padding: calc(0.35rem - 1px) calc(0.8rem - 1px); border-radius: var(--rst-radius-sm);
- }
- .btn-secondary, button.btn-secondary {
- --btn-fill: var(--rst-control-face); --btn-fill-hover: var(--rst-control-face-hover);
- --btn-edge: var(--rst-control-border); --btn-edge-hover: var(--rst-control-border-hover);
- --btn-lip: var(--rack-edge); --btn-hl: var(--rst-depth-hl); --btn-ink: var(--accent);
- }
- button.btn-danger, .btn-danger {
- --btn-fill: var(--rst-danger-fill); --btn-fill-hover: var(--rst-danger-fill-hover);
- --btn-edge: var(--rst-danger-fill-edge); --btn-edge-hover: var(--rst-danger-fill-edge-hover);
- --btn-ink: var(--rst-on-danger-fill);
- }
- /* The Instances table's in-cell readings: number first, then the 48h
- shape beside it, low-contrast so the number stays the headline. */
- td .cell-value { display: inline-block; min-width: 3.5rem; font-weight: 600; }
- .cellspark { width: 6rem; height: 1.1rem; vertical-align: -0.2rem; color: var(--muted); }
- .cellspark polyline { stroke-width: 2.5; }
- /* The Overview's recent-activity strip. */
- .feed { list-style: none; margin: 0 0 0.5rem; padding: 0; max-width: 40rem; }
- .feed li { padding: 0.25rem 0; border-bottom: 1px solid var(--rule); }
- .feed li:last-child { border-bottom: 0; }
- /* The confirm interstitial: one card saying exactly what is about to
- happen, one button that does it, one link that does not. */
- .confirm-card {
- border: 1px solid var(--rule); border-radius: var(--rst-radius);
- padding: 1.25rem 1.4rem; max-width: 40rem; margin: 0 0 1rem;
- background-color: var(--bg); box-shadow: var(--shadow-module);
- }
- .confirm-card .actions { display: flex; gap: 0.9rem; align-items: center; margin-top: 1rem; }
- .confirm-card .confirm-note { margin: 0.8rem 0 0; }
- /* /fleet/architecture: the diagram and its box cards. Colours come from
- the same tokens as the rest of the console so it themes light and dark
- with no second palette to keep in sync, and the SVG scrolls inside its
- own wrapper rather than making the page scroll sideways — the drawing
- has a minimum readable width the viewport may not have. */
- /* Sized to main's 64rem column, and no wider: a band is at most four
- nodes across (archLayer), 1018 units, which fits inside it. The wrapper
- used to be sized to the viewport instead, because the single-picture
- page drew an estate 1918 units wide and the column showed the DNS and
- the IPs and hid every box; one picture per region is what made that
- unnecessary, and overflow-x only has work to do on a window narrower
- than the column. */
- .archwrap { overflow-x: auto; margin: 0.2rem 0 1.6rem; }
- /* The band heading. A region code is a machine string an operator reads
- dozens of times a day, so it is set in the mono face and quietly — the
- picture under it is the content, and a loud heading every 400px down a
- six-region page reads as six separate documents. */
- h4.archband {
- border-top: 1px solid var(--rule); color: var(--muted);
- font: 600 0.8rem var(--mono); letter-spacing: 0.02em;
- margin: 1.5rem 0 0; padding-top: 0.5rem;
- }
- /* No width rule: the SVG carries its own width/height (RenderArchSVG), so
- it renders 1:1 and .archwrap scrolls when the viewport is narrower.
- Sizing it to the container instead would scale a 1918-unit-wide drawing
- into a ~1024px column and take the 13px labels to ~7px. */
- .archsvg { display: block; }
- .archsvg rect { fill: var(--accent-soft); stroke: var(--rule); }
- .archsvg .archnode-box rect { stroke: var(--accent); }
- .archsvg .archtitle { fill: var(--ink); font: 600 13px var(--sans); }
- .archsvg .archsub { fill: var(--muted); font: 400 11px var(--sans); }
- /* The edges carry the whole meaning of the diagram — which name reaches
- which box — so they are stroked off --muted, not --rule. --rule is the
- 1px table-hairline token (#eae7f0 light, #2c2836 dark): correct for a
- node's outline sitting on a filled body, invisible for a line that has
- to be followed across the page. */
- .archsvg .archedge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
- /* An alarm rides the node it watches (archlayout.go): a healthy one is a
- quiet mark, a firing one takes the bad colour so it reads at a glance
- rather than only in the words of its hover title. */
- .archsvg .archalarm { fill: var(--good); }
- .archsvg .archalarm-firing { fill: var(--bad); }
- /* 64rem, not 44rem: the resource tables below run the full width of the
- column, and a 44rem card left the column edge stepping in and out down
- the page (discussion #9). */
- .archbox {
- border: 1px solid var(--rule); border-radius: var(--rst-radius);
- padding: 0.9rem 1.1rem; margin: 0 0 0.6rem; max-width: 64rem;
- background-color: var(--bg); box-shadow: var(--shadow-module);
- }
- .archbox h3 { margin: 0 0 0.3rem; }
- .archbox p { margin: 0 0 0.2rem; }
- /* The box card's fact line: every fact on it is independently absent (a
- BYO box has no instance type, an unpriced box has no size and no
- price), so the separator is drawn between surviving neighbours rather
- than written after each fact — no dangling middots. */
- .archbox .fact + .fact::before { content: " · "; color: var(--muted); }
- footer {
- max-width: 64rem; margin: 0 auto; padding: 1.25rem 0 2rem;
- border-top: 1px solid var(--rule);
- font-size: 0.85rem; color: var(--muted);
- }
- /* Page anatomy: every page opens with a mono eyebrow naming the context,
- an h1, and one human sentence saying what the page is for. */
- .pagehead { margin: 0 0 1.75rem; }
- .eyebrow {
- font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em;
- text-transform: uppercase; color: var(--muted); margin: 0 0 0.3rem;
- }
- .pagehead h1 { margin: 0 0 0.35rem; }
- .pagehead .lede { margin: 0; font-size: 1.05rem; }
- .version-list { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
- .version-list code { display: inline-block; overflow-wrap: anywhere; }
- .version-list li { min-width: 0; max-width: 100%; }
- /* Progressive-reveal sections: a page leads with the summary strip, and
- the deeper tables/ladder sit behind an opt-in disclosure. */
- .reveal > summary { font-size: 1.1rem; font-weight: 600; cursor: pointer; }
- .reveal > summary h2 { display: inline; font-size: inherit; margin: 0; }
- /* App tab bar (Heroku-style), and the account nav's active marker.
- aria-current carries the state; the accent underline draws it. */
- .tabs {
- display: flex; flex-wrap: wrap; gap: 1.25rem 0.25rem; margin: 0 0 2rem;
- border-bottom: 1px solid var(--rule);
- font-family: var(--mono); font-size: 0.85rem;
- }
- .tabs a {
- color: var(--muted); text-decoration: none;
- padding: 0.3rem 0.5rem 0.55rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
- }
- .tabs a:hover { color: var(--ink); }
- .tabs a[aria-current] {
- color: var(--ink); border-bottom-color: var(--accent);
- background: var(--accent-soft); border-radius: 0.35rem 0.35rem 0 0;
- }
- header nav a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
- header nav a.addr { color: var(--muted); text-decoration: none; }
- /* The billing page (billing.html). Its price elements carry fixed class
- lists that billing.html's own currency rules and their guard test
- (TestBillingPagePricesFollowShownCurrency) read, so they are styled
- here as span.price in context, never by a class of their own.
-
- The summary is a tile: the plan's name as its value, its facts under
- it, and what it gives the account today beside them. */
- .billing-now {
- display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
- gap: 1rem 3rem; padding: 1.15rem 1.4rem 1.25rem; margin: 0 0 0.5rem;
- }
- .billing-now > div { min-width: 0; }
- .billing-now .tile-value { margin: 0 0 0.3rem; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
- .billing-facts { list-style: none; font-size: 0.9rem; color: var(--muted); }
- .billing-includes, .plan-incl { list-style: none; display: grid; gap: 0.3rem; font-size: 0.9rem; }
- .billing-includes { grid-template-columns: repeat(auto-fit, minmax(13rem, auto)); column-gap: 2rem; align-self: center; }
- .billing-includes li, .plan-incl li { display: flex; align-items: flex-start; gap: 0.5rem; }
- .billing-includes .icon, .plan-incl .icon { color: var(--accent); margin-top: 0.25em; }
- /* The purchase form: a heading with the currency switch at its right
- end, the plan cards, the packs, then the one button. */
- .buy fieldset { border: 0; min-width: 0; }
- .buy .currency { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
- .buy .currency legend { float: left; }
- /* A segmented control made of real radios: each radio is laid
- transparently over its own label, so it keeps its click, its keyboard
- arrows and its required check, and the label carries the look. */
- .seg {
- display: inline-flex; gap: 2px; padding: 2px; border-radius: 0.5rem;
- background: var(--accent-soft); box-shadow: var(--shadow-inset);
- }
- .seg label { position: relative; display: block; }
- .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
- .seg label > span, .seg-fixed {
- display: block; min-width: 3.4rem; padding: 0.4rem 0.75rem; border-radius: 0.375rem;
- font-size: 0.82rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
- text-align: center; color: var(--muted); line-height: 1.3;
- transition: color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
- }
- .seg label:hover > span { color: var(--ink); }
- .seg label:has(input:checked) > span, .seg-fixed {
- background: var(--bg); color: var(--ink);
- box-shadow: var(--shadow-raised);
- }
- .seg label:has(input:focus-visible) > span { outline: 2px solid var(--accent); outline-offset: 1px; }
- /* Plan cards. The label's ::after stretches over its card, so the whole
- card picks the plan; the checked card takes the accent. */
- .plan-cards {
- display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
- gap: 1rem; margin: 0 0 2.25rem;
- }
- .plan-card {
- position: relative; border: 1px solid var(--rule); border-radius: var(--rst-radius);
- padding: 1.1rem 1.25rem 1.25rem; background-color: var(--bg); box-shadow: var(--shadow-module);
- transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
- }
- .plan-card:hover { border-color: var(--muted); }
- .plan-card:has(input:checked) {
- border-color: var(--accent); background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
- box-shadow: var(--shadow-module), inset 0 0 0 1px var(--accent);
- }
- .plan-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
- .plan-card p { margin: 0; max-width: none; }
- .plan-card label { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; }
- .plan-card label::after { content: ""; position: absolute; inset: 0; }
- .plan-card input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
- .plan-name { min-width: 0; overflow-wrap: anywhere; font-size: 1.15rem; font-weight: 650; }
- .plan-cost { display: block; margin: 0.65rem 0 0; }
- .plan-card span.price {
- display: block; color: var(--ink); font-size: 1.15rem; font-weight: 650;
- line-height: 1.3; text-wrap: balance; font-variant-numeric: tabular-nums;
- }
- .plan-card span.total { margin-top: 0.4rem; font-size: 0.9rem; font-weight: 500; }
- /* No currency checked yet (a refused one): every currency's price shows,
- so each steps down to one line's weight. */
- .buy:not(:has(input[name=currency]:checked)) .plan-card span.price { font-size: 0.95rem; font-weight: 500; }
- .plan-incl { margin: 1rem 0 0; padding: 0.9rem 0 0; border-top: 1px solid var(--rule); }
- .plan-card:has(input:checked) .plan-incl { border-top-color: var(--accent-soft); }
- /* Packs: one row each, the name and what one adds, a quantity, a price.
- The quantity box is wide enough for its maximum and steps by one. */
- .buy h3 { margin: 0; }
- .buy .packs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 1rem; margin: 0 0 0.2rem; }
- .buy .packs-head + .small { margin: 0 0 0.75rem; }
- table.packs { margin: 0; }
- .packs tr:first-child td { border-top: 1px solid var(--rule); }
- .packs td { padding: 0.75rem 1.25rem 0.75rem 0; vertical-align: middle; }
- .packs td:first-child { width: 100%; }
- .packs td + td { white-space: nowrap; }
- .packs td:last-child { padding-right: 0; text-align: right; }
- .packs label { display: block; font-weight: 600; }
- .packs td:first-child .small { display: block; }
- .packs span.price { display: block; color: var(--ink); font-variant-numeric: tabular-nums; }
- .packs td form { justify-content: flex-end; flex-wrap: nowrap; }
- .packs input[type=number] {
- width: 4.75rem; padding: 0.4rem 0.5rem; text-align: center;
- font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums;
- color: var(--ink); background: var(--field); accent-color: var(--accent);
- border: 1px solid var(--muted); border-radius: var(--rst-radius-sm); box-shadow: var(--shadow-inset);
- }
- .packs input[type=number]:hover { border-color: var(--ink); }
- .packs input[type=number]:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
- /* Usage beside a limit (billingusage.go), as the plan-limits pass last
- measured it: quiet figures in the muted ink. From 80% of the limit the
- figure takes the ink and a warn dot; past it, the bad ink and a bad
- dot. The weight and the dot carry it as well as the colour. */
- .use { font-variant-numeric: tabular-nums; }
- .use-warn, .use-over { font-weight: 600; }
- .use-warn { color: var(--ink); }
- .use-over { color: var(--bad); }
- .use-warn::before, .use-over::before {
- content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin: 0 0.4rem 0.1em 0;
- border-radius: 50%; background: var(--warn); vertical-align: middle;
- }
- .use-over::before { background: var(--bad); }
- .packs td:first-child .use { margin-top: 0.15rem; }
- .plan-incl .use { margin-left: auto; padding-left: 0.5rem; white-space: nowrap; }
- .usage-asof { margin: 0; }
- .packs-head .usage-asof { font-size: 0.82rem; }
- /* The summary's usage, when no pack row carries it: a row of figures
- under the plan, its as-of line beneath. */
- .billing-usage { flex: 1 1 100%; padding: 0.9rem 0 0; border-top: 1px solid var(--rule); }
- .billing-usage dl { display: flex; flex-wrap: wrap; gap: 0.6rem 2.75rem; margin: 0 0 0.6rem; }
- .billing-usage dt { font-size: 0.82rem; color: var(--muted); }
- .billing-usage dd { margin: 0; font-size: 0.95rem; }
- .billing-usage .usage-asof { font-size: 0.82rem; }
-
- /* Analytics (app_analytics.html, and the Overview's traffic card). The
- chart is the page's one loud element; everything around it stays in
- text ink and hairlines. */
- .an-off { margin: 0 0 1.5rem; }
- .an-range { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: 0 0 1.75rem; }
- .an-range a {
- padding: 0.3rem 0.75rem; border-radius: 999px; color: var(--muted);
- text-decoration: none; font-size: 0.9rem;
- }
- .an-range a:hover { color: var(--ink); background: var(--accent-soft); }
- .an-range a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
- .an-range a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
- .an-span { margin-left: 0.75rem; color: var(--muted); font-size: 0.85rem; }
- .an-daynav { display: inline-flex; gap: 0.25rem; margin-left: 0.5rem; }
- .an-daynav a { font-size: 0.85rem; }
- .an-figures { display: flex; flex-wrap: wrap; gap: 1rem 3.5rem; margin: 0 0 1.5rem; }
- .an-figures dt { color: var(--muted); font-size: 0.9rem; }
- .an-figures dd { margin: 0; font-size: 2.25rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
- .an-figures dd.an-note { font-size: 0.8rem; font-weight: 400; color: var(--muted); max-width: 16rem; line-height: 1.4; margin-top: 0.3rem; letter-spacing: 0; }
- .an-empty { color: var(--muted); padding: 2.5rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); max-width: none; }
- .an-insights { color: var(--ink); font-size: 0.95rem; margin: 0.75rem 0 0.5rem; max-width: none; }
- .an-quality { margin: 0 0 2rem; max-width: 48rem; }
-
- .an-chart { margin: 0; padding-left: 2.25rem; }
- .an-plot { position: relative; height: 14rem; }
- .an-overview .an-plot { height: 7rem; }
- .an-grid span {
- position: absolute; left: 0; right: 0; height: 0;
- border-top: 1px solid var(--rule);
- }
- .an-grid i {
- position: absolute; right: calc(100% + 0.5rem); top: -0.6em;
- font-style: normal; font-size: 0.75rem; color: var(--muted);
- font-variant-numeric: tabular-nums; white-space: nowrap;
- }
- .an-cols, .an-xaxis { display: grid; grid-template-columns: repeat(var(--an-cols), minmax(0, 1fr)); }
- .an-cols { position: absolute; inset: 0; }
- /* A column is the hit target, full height, so a zero hour still answers
- a hover; the bar inside it is capped at 24px and never fills the slot. */
- button.an-col, .an-col {
- position: relative; display: flex; align-items: flex-end; justify-content: center;
- height: 100%; padding: 0 1px; margin: 0; border: 0; border-radius: 0.25rem;
- background: transparent; color: inherit; font: inherit; cursor: default; box-shadow: none;
- }
- .an-col:not(.an-future):hover, .an-col:not(.an-future):focus-visible { background: var(--accent-soft); }
- .an-col:not(.an-future):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
- /* A day on a daily chart is a link to that day; it reads as the column,
- not as underlined text. */
- a.an-col { text-decoration: none; cursor: pointer; }
- .an-bar {
- position: relative; display: block; width: 100%; max-width: 24px; min-height: 0;
- background: var(--accent); border-radius: 4px 4px 0 0;
- }
- .an-col:hover .an-bar, .an-col:focus-visible .an-bar { background: var(--accent-strong); }
- /* The hour or day still being counted: the same hue, hatched, because the
- bar will still grow. (No percentages in this sheet's own rules: the
- metrics boundary tests read every "NN%" on an app page as a reading.) */
- .an-partial .an-bar { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--accent-soft) 3px 6px); }
- .an-gap::after {
- content: ""; position: absolute; bottom: -0.55rem; left: 50%; width: 5px; height: 5px;
- margin-left: -2.5px; border-radius: 50%; background: var(--warn);
- }
- .an-tip {
- display: none; position: absolute; z-index: 2; bottom: calc(100% + 0.4rem); left: 50%;
- transform: translateX(-50%); width: max-content; max-width: 15rem;
- padding: 0.5rem 0.7rem; border-radius: 0.4rem; text-align: left;
- background: var(--ink); color: var(--bg); font-size: 0.8rem; line-height: 1.45;
- box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); pointer-events: none;
- }
- .an-tip b { display: block; font-size: 0.95rem; font-weight: 600; }
- .an-tip span { display: block; }
- .an-tip .an-when { opacity: 0.75; margin-top: 0.15rem; }
- .an-edge-start .an-tip { left: 0; transform: none; }
- .an-edge-end .an-tip { left: auto; right: 0; transform: none; }
- .an-col:hover .an-tip, .an-col:focus .an-tip { display: block; }
- /* One tooltip at a time: while the pointer is over the chart, only the
- column under it speaks, not one left focused by an earlier click. */
- .an-cols:hover .an-col:focus:not(:hover) .an-tip { display: none; }
- /* The tip is the bar's child, so it opens just above the bar's top,
- where the eye already is, and never covers the bar it describes. */
- .an-future { cursor: default; }
- .an-xaxis { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
- .an-xaxis span { justify-self: center; }
-
- .an-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2rem 3rem; margin: 0 0 2rem; }
- .an-card h3 { font-size: 1rem; margin: 0 0 0.6rem; }
- .an-share { list-style: none; margin: 0 0 0.5rem; }
- .an-share li {
- display: grid; grid-template-columns: minmax(0, 1fr) auto 3rem; column-gap: 0.75rem;
- align-items: baseline; padding: 0.4rem 0 0.45rem; border-bottom: 1px solid var(--rule);
- }
- .an-key { overflow-wrap: anywhere; }
- .an-flag { margin-right: 0.4rem; }
- .an-val { font-variant-numeric: tabular-nums; text-align: right; }
- .an-pct { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); font-size: 0.85rem; }
- .an-track { grid-column: 1 / -1; display: block; height: 3px; margin-top: 0.3rem; border-radius: 2px; background: var(--accent-soft); }
- .an-track span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
- .an-muted .an-key { color: var(--muted); }
- .an-muted .an-track span { background: var(--muted); opacity: 0.5; }
-
- .an-more { margin: 0.6rem 0 0; font-size: 0.9rem; }
- .an-card h3.an-subhead { margin-top: 1.4rem; }
- .an-pages { margin: 0 0 2rem; }
- .an-pages-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 0.8rem; }
- .an-pages-head h3 { font-size: 1rem; margin: 0; }
- input.an-filter { width: 100%; max-width: 24rem; margin: 0 0 1rem; }
- .an-section { border-bottom: 1px solid var(--rule); }
- .an-section summary {
- display: grid; grid-template-columns: minmax(0, 1fr) auto 3rem 5.5rem; column-gap: 0.75rem;
- align-items: baseline; padding: 0.55rem 0; cursor: pointer; font-weight: 600;
- }
- .an-section summary .an-count { color: var(--muted); font-size: 0.85rem; font-weight: 400; text-align: right; }
- .an-pagelist { margin: 0 0 0.75rem 1rem; }
- .an-pagelist li { grid-template-columns: minmax(0, 1fr) 60px auto 3rem; }
- .an-spark { width: 60px; height: 16px; align-self: center; }
- .an-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
- .an-overview { margin: 0 0 2rem; padding: 1.25rem 1.4rem 1.4rem; border: 1px solid var(--rule); border-radius: var(--rst-radius); background-color: var(--bg); box-shadow: var(--shadow-module); }
- .an-overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0 0 1rem; }
- .an-overview-head h2 { font-size: 1rem; margin: 0; }
- .an-overview .an-figures { gap: 0.75rem 2.5rem; margin-bottom: 1rem; }
- .an-overview .an-figures dd:not(.an-note) { font-size: 1.6rem; }
- .an-overview .an-empty { padding: 1.5rem 0; }
- /* The Protection tab draws two series on the Analytics chart: the bar is
- what was caught that day, its foot what was blocked, in ink so the two
- read apart in either scheme. The legend keys use the same fills. */
- .pt-blocked { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); border-radius: inherit; }
- .pt-key { display: inline-block; width: 0.7rem; height: 0.7rem; margin: 0 0.35rem 0 0; border-radius: 2px; background: var(--accent); vertical-align: -0.05rem; }
- .pt-key + .pt-key { margin-left: 0.75rem; }
- .pt-key-blocked { background: var(--ink); }
- @media (max-width: 40rem) {
- .an-figures { gap: 1rem 2rem; }
- .an-figures dd:not(.an-note) { font-size: 1.75rem; }
- .an-plot { height: 11rem; }
- .an-span { flex-basis: 100%; margin: 0.4rem 0 0 0.75rem; }
- }
- @media (forced-colors: active) {
- .an-bar, .an-track span { background: CanvasText; }
- .pt-key { background: CanvasText; }
- .pt-blocked, .pt-key-blocked { background: Highlight; }
- .an-tip { border: 1px solid CanvasText; }
- }
- .buy-foot { margin: 1.75rem 0 0; }
- .buy-foot button { padding: 0.7rem 1.5rem; }
- .billing-upgrades { margin-top: 1.25rem; }
- /* The success screen after a completed purchase (billing_done.html):
- it replaces the billing page, so it stands alone in the middle of an
- otherwise empty page. A check that draws itself once in an accent
- disc, the heading, the plan's room in a sentence, and its links:
- Add packs and Upgrade go back to the billing page's sections, Go to
- your apps is the way on. */
- .done { max-width: 36rem; margin: clamp(1rem, 9vh, 5.5rem) auto 0; text-align: center; }
- .done-mark {
- display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
- margin: 0 0 1.4rem; background: var(--accent); color: var(--bg);
- }
- .done-mark .icon { width: 1.6rem; height: 1.6rem; stroke-width: 2.6; }
- .done h1 { margin: 0 0 0.8rem; font-size: clamp(1.65rem, 1.2rem + 1.6vw, 2.15rem); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; overflow-wrap: anywhere; }
- .done-lede, .done-room { margin: 0 auto; max-width: 32rem; text-wrap: pretty; overflow-wrap: anywhere; }
- .done-lede { font-size: 1.05rem; }
- .done-room { margin-top: 0.5rem; color: var(--muted); }
- .done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 2rem 0 0; }
- .done-actions .btn { padding: 0.6rem 1.25rem; }
- .done-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
- /* Its links land on these headings, a little clear of the window's top. */
- #packs-title, #upgrade { scroll-margin-top: 1.5rem; }
- @media (prefers-reduced-motion: no-preference) {
- .done-mark { animation: done-pop 520ms cubic-bezier(0.16, 1, 0.3, 1) both; }
- .done-mark path { stroke-dasharray: 24; animation: done-draw 480ms 200ms cubic-bezier(0.16, 1, 0.3, 1) both; }
- }
- @keyframes done-pop { from { transform: scale(0.7); } }
- @keyframes done-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
- @media (min-width: 46rem) {
- .billing-includes { grid-template-columns: repeat(2, auto); }
- }
- @media (max-width: 40rem) {
- table.methods .added { display: none; }
- .billing-now { padding: 1rem 1.1rem 1.1rem; }
- .done-actions { flex-direction: column; align-items: stretch; margin-top: 1.75rem; }
- .done-actions .btn { text-align: center; }
- .packs tr {
- display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
- gap: 0.6rem 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule);
- }
- .packs tr:first-child { border-top: 1px solid var(--rule); }
- .packs td, .packs tr:first-child td { display: block; width: auto; padding: 0; border: 0; }
- .packs td:first-child { grid-column: 1 / -1; }
- .packs td:last-child { text-align: right; }
- .buy-foot button { width: 100%; }
- }
- /* Phones (800px and narrower) see an account page as Fiesta's console
- does: an index of sections, or a page with one back link up to the
- index it sits under (mobilenav.go). Account switching has its own
- index on phones; the app tabs and the
- settings sections give way to their own indexes. Wider screens never
- see the back strip, and an index still reads as a list of links. */
- .mobile-back, .pagehead > .mobile-title { display: none; }
- header .account-links { display: contents; }
- .index-nav { display: flex; flex-direction: column; max-width: 32rem; margin: 0 0 2rem; border: 1px solid var(--rule); border-radius: var(--rst-radius); background: var(--bg); box-shadow: var(--shadow-module); overflow: hidden; }
- .index-nav a:last-child { border-bottom: 0; }
- .index-nav a {
- display: flex; align-items: center; box-sizing: border-box;
- gap: 0.75rem; min-height: 3.75rem; padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--rule);
- color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
- }
- .index-context { display: flex; align-items: center; gap: 0.875rem; max-width: 32rem; margin: 0.25rem 0 1.5rem; }
- .index-context-copy { min-width: 0; }
- .index-context h1 { margin: 0; }
- .index-context .eyebrow { margin: 0 0 0.25rem; font-size: 0.7rem; overflow-wrap: anywhere; }
- .index-meta { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
- .index-meta code { font-size: 0.75rem; }
- .app-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.6rem; font: 600 1rem/1 var(--mono); text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); box-shadow: var(--shadow-raised); }
- .app-mark .icon { width: 1rem; height: 1rem; }
- .index-context > .app-mark { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; }
- .index-context-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2.75rem; height: 2.75rem; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); border-radius: 0.75rem; box-shadow: var(--shadow-raised); }
- .index-context-icon .icon { width: 1.4rem; height: 1.4rem; }
- .index-nav .index-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.5rem; background: light-dark(#f0e4ef, #382435); color: var(--accent-strong); box-shadow: inset 0 1px 0 var(--rst-depth-hl), 0 1px 1px var(--rst-depth-ambient); }
- .index-nav .index-icon .icon { width: 1.125rem; height: 1.125rem; }
- .index-label { flex: 1; min-width: 0; }
- .index-chevron { display: flex; flex: none; color: var(--muted); opacity: 0.65; }
- .index-chevron .icon { width: 1rem; height: 1rem; }
- .index-nav :is(.index-key-fleet, .index-key-instances, .index-key-placement, .index-key-domains, .index-key-email) .index-icon { background: light-dark(#e4edf9, #1e3049); color: light-dark(#32629c, #9cbfee); }
- .index-nav :is(.index-key-team, .index-key-availability, .index-key-protection, .index-key-storage) .index-icon { background: light-dark(#e1f0ed, #1b3833); color: light-dark(#28685e, #99d2c5); }
- .index-nav :is(.index-key-settings, .index-key-general, .index-key-logs, .index-key-environments) .index-icon { background: light-dark(#ececf0, #2c2d34); color: var(--muted); }
- .index-nav .index-key-delete .index-icon { background: light-dark(#f7e9e8, #3b2425); color: var(--bad); }
- /* The box clips to its rounded corners, so the end rows take the same
- curve (their background and focus ring follow it) and the ring sits
- 3px inside, where the clip cannot reach it. */
- .index-nav a:first-child { border-top-left-radius: calc(var(--rst-radius) - 1px); border-top-right-radius: calc(var(--rst-radius) - 1px); }
- .index-nav a:last-child { border-bottom-left-radius: calc(var(--rst-radius) - 1px); border-bottom-right-radius: calc(var(--rst-radius) - 1px); }
- .index-nav a:hover, .index-nav a:target { background: var(--accent-soft); }
- .index-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
- @media (forced-colors: active) { .index-nav a:focus-visible { outline-color: Highlight; } }
- @media (max-width: 800px) {
- body[data-view] header :is(.switcher, .brand, .account-links) { display: none; }
- body[data-view] header {
- position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; gap: 0.75rem;
- max-width: none; margin: 0 -1.25rem; padding: 0.375rem 0.5rem; border-top: 0;
- background: var(--rst-bg);
- }
- body[data-view] header nav { flex: none; margin-left: auto; flex-wrap: nowrap; gap: 0; }
- body[data-view] header .mobile-back, body[data-view] header .mobile-root { display: flex; align-items: center; flex: 1; min-width: 0; }
- body[data-view] header .mobile-root { font-weight: 500; min-height: 2.75rem; padding: 0.35rem 0.75rem; }
- body[data-view="page"] .tabs, body[data-view="page"] .settings-nav { display: none; }
- body[data-view] { border-top: 3px solid var(--accent); }
- body[data-view] .pagehead > .eyebrow { display: none; }
- body[data-view] main { padding-top: 1.25rem; }
- .mobile-back a {
- display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; min-width: 2.75rem;
- box-sizing: border-box; padding: 0.35rem 0.75rem; font-weight: 500; text-decoration: none;
- overflow-wrap: anywhere;
- }
- .mobile-back a::before {
- content: ""; flex: none; width: 0.55rem; height: 0.55rem;
- border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(-45deg);
- }
- .mobile-back a:focus-visible { outline-offset: -2px; }
- :root:has(body[data-view]) { scroll-padding-top: calc(3.5rem + 1px); }
- .pagehead > h1:has(+ .mobile-title) { display: none; }
- .pagehead > .mobile-title { display: block; overflow-wrap: anywhere; }
- .index-nav { max-width: none; }
-
- }
-</style>
+<style>{{template "console_styles" .}}</style>
</head>
<body{{with .MobileView}} data-view="{{.}}"{{end}}>
-<header>
- {{if .Account}}
- <details class="switcher" id="switcher">
- <summary>
- <span class="small">Account</span>
- <span class="current-name">{{.Account.Name}}</span>
- {{icon "chevron-down"}}
- </summary>
- <div class="switcher-menu">
- {{if gt (len .Accounts) 7}}<input type="search" class="switcher-find" placeholder="Find an account" aria-label="Find an account" autocomplete="off" spellcheck="false" hidden>
- <p class="switcher-none" hidden>No account matches that.</p>{{end}}
- <ul>
- {{range .Accounts}}<li>{{if eq .Sqid $.Account.Sqid}}
- <span class="current" aria-current="true"><span class="mark">{{icon "check"}}</span>{{.Name}}</span>
- {{else}}
- <a href="/a/{{.Seg}}/"><span class="mark">{{icon "check"}}</span>{{.Name}}</a>
- {{end}}</li>
- {{end}}
- </ul>
- <hr>
- <div class="new"><a href="/accounts/new"><span class="mark">{{icon "plus"}}</span>New account</a></div>
- </div>
- </details>
- {{else}}
- <div class="brand"><a href="/">{{.Brand}}</a></div>
- {{end}}
- {{with .MobileBack}}<div class="mobile-back"><a href="{{.Href}}" rel="up">{{.Label}}</a></div>
- {{end}}{{if eq .IndexOf "accounts"}}<span class="mobile-root" aria-hidden="true">Accounts</span>
- {{end}}{{if .Address}}<nav>
- <span class="account-links">{{range .AccountLinks}}<a href="{{.Href}}"{{if .Current}} aria-current="page"{{end}}>{{.Label}}</a>
- {{end}}</span>
- <details class="profile" id="profile">
- <summary aria-label="{{.Address}}">{{icon "user-round"}}{{icon "chevron-down"}}</summary>
- <div class="profile-menu">
- <a class="addr" href="/settings">{{.Address}}</a>
- <form method="post" action="/auth/signout">
- <input type="hidden" name="csrf" value="{{.CSRF}}">
- <button class="linkish" type="submit">Sign out</button>
- </form>
- </div>
- </details>
- </nav>{{end}}
-</header>
+{{template "console_header" .}}
<main>
{{range .PlanNotices}}<p class="banner">{{.}}</p>
{{end}}{{if .PlanKeepURL}}<p class="banner"><a href="{{.PlanKeepURL}}">{{.PlanKeepLink}}</a></p>
diff --git a/internal/console/testdata/demo_claim_resume_browser.mjs b/internal/console/testdata/demo_claim_resume_browser.mjs
new file mode 100644
index 000000000..37411e6a2
--- /dev/null
+++ b/internal/console/testdata/demo_claim_resume_browser.mjs
@@ -0,0 +1,119 @@
+import {spawn} from 'node:child_process';
+import assert from 'node:assert/strict';
+import {writeFile} from 'node:fs/promises';
+
+const [binary, profile, target, sessionToken, flowCookie, account, screenshots] = process.argv.slice(2);
+const chrome = spawn(binary, ['--headless', '--no-sandbox', '--disable-gpu',
+ '--disable-dev-shm-usage', '--disable-background-networking', '--disable-component-update',
+ '--disable-default-apps', '--disable-extensions', '--disable-sync', '--no-proxy-server',
+ '--no-first-run', '--no-default-browser-check', '--remote-debugging-pipe',
+ '--user-data-dir=' + profile], {stdio: ['ignore', 'ignore', 'ignore', 'pipe', 'pipe']});
+let sequence = 0, buffered = '', session;
+const pending = new Map();
+let security = [];
+const submissions = [];
+
+chrome.stdio[4].on('data', bytes => {
+ buffered += bytes.toString();
+ let end;
+ while ((end = buffered.indexOf('\0')) !== -1) {
+ const message = JSON.parse(buffered.slice(0, end));
+ buffered = buffered.slice(end + 1);
+ if (message.method === 'Log.entryAdded' && message.params.entry.source === 'security') security.push(message.params.entry.text);
+ if (message.method === 'Runtime.bindingCalled' && message.params.name === 'claimSubmitted') submissions.push(JSON.parse(message.params.payload));
+ const resolve = pending.get(message.id);
+ if (resolve) { pending.delete(message.id); resolve(message); }
+ }
+});
+async function call(method, params = {}, attached = true) {
+ const id = ++sequence;
+ const result = new Promise(resolve => pending.set(id, resolve));
+ chrome.stdio[3].write(JSON.stringify({id, method, params, ...(attached && session ? {sessionId:session} : {})}) + '\0');
+ const message = await result;
+ assert.equal(message.error, undefined, JSON.stringify(message.error));
+ return message.result;
+}
+async function evaluate(expression) {
+ const result = await call('Runtime.evaluate', {expression, returnByValue:true});
+ assert.equal(result.exceptionDetails, undefined);
+ return result.result.value;
+}
+async function until(expression) {
+ for (let i = 0; i < 150; i++) {
+ if (await evaluate(expression)) return;
+ await new Promise(resolve => setTimeout(resolve, 100));
+ }
+ throw Error('browser_condition_timeout: ' + await evaluate('JSON.stringify({text:document.body.innerText,email:document.getElementById("email")?.value,focus:document.activeElement.tagName,valid:document.querySelector("form")?.checkValidity()})'));
+}
+async function key(key, code, number) {
+ await call('Input.dispatchKeyEvent', {type:key === 'Enter' ? 'keyDown' : 'rawKeyDown', key, code, windowsVirtualKeyCode:number, ...(key === 'Enter' ? {text:'\r', unmodifiedText:'\r'} : {})});
+ await call('Input.dispatchKeyEvent', {type:'keyUp', key, code, windowsVirtualKeyCode:number});
+}
+const timer = setTimeout(() => { chrome.kill('SIGKILL'); process.exitCode = 1; }, 35000);
+try {
+ const created = await call('Target.createTarget', {url:'about:blank'}, false);
+ session = (await call('Target.attachToTarget', {targetId:created.targetId, flatten:true}, false)).sessionId;
+ await call('Page.enable');
+ await call('Runtime.enable');
+ await call('Log.enable');
+ await call('Network.enable');
+ await call('Runtime.addBinding', {name:'claimSubmitted'});
+ await call('Page.addScriptToEvaluateOnNewDocument', {source:`
+ window.addEventListener('submit', event => {
+ const form = event.target;
+ if (form.getAttribute('action') !== '/demo/claim/select') return;
+ claimSubmitted(JSON.stringify({
+ disabled:form.querySelector('button[type=submit]').disabled,
+ visible:form.getBoundingClientRect().height > 0,
+ auto:!document.getElementById('claim-resuming').hidden,
+ account:new FormData(form).get('accountId')
+ }));
+ });
+ `});
+ await call('Network.setCookies', {cookies:[
+ {name:'carlos_console_session',value:sessionToken,url:target,path:'/',httpOnly:true,sameSite:'Lax'},
+ {name:'carlos_demo_claim_flow',value:flowCookie,url:target,path:'/demo/claim',httpOnly:true,secure:true,sameSite:'Lax'}
+ ]});
+ await call('Network.setBlockedURLs', {urls:['*demo_claim.js*']});
+ await call('Page.navigate', {url:target+'/demo/claim'});
+ await until('document.readyState === "complete" && !!document.querySelector("select[name=accountId]")');
+ assert.equal(await evaluate('document.querySelector("button[type=submit]").disabled'),false,'script failure disabled the manual fallback');
+ assert.equal(await evaluate('document.querySelector("form").getBoundingClientRect().height > 0'),true,'script failure hid the form');
+ await call('Network.setBlockedURLs', {urls:[]});
+ await call('Page.navigate', {url:target+'/demo/claim?csp=before'});
+ await until('!!document.querySelector("select[name=accountId]")');
+ await evaluate(`document.querySelector('select').value = ${JSON.stringify(account)}; document.querySelector('form[action="/demo/claim/select"]').requestSubmit()`);
+ for (let i=0; i<50 && !security.some(s=>s.includes('form-action')); i++) await new Promise(r=>setTimeout(r,100));
+ assert(security.some(s=>s.includes('form-action')), 'Chromium did not reproduce redirect CSP block: '+JSON.stringify(security));
+ assert.equal(await evaluate('location.origin'), target);
+ process.stdout.write('before: Chromium blocked the cross-port Keymail redirect\n');
+ security = [];
+ submissions.length = 0;
+ await call('Page.navigate', {url:target+'/demo/claim'});
+ await until('!!document.querySelector("select[name=accountId]")');
+ await evaluate(`document.querySelector('select').value = ${JSON.stringify(account)}`);
+ assert.equal(await evaluate('document.querySelectorAll("script").length'),1);
+ if (screenshots) {
+ for (const scheme of ['light','dark']) {
+ await call('Emulation.setEmulatedMedia',{features:[{name:'prefers-color-scheme',value:scheme}]});
+ await new Promise(r=>setTimeout(r,150));
+ const shot = await call('Page.captureScreenshot',{format:'png',captureBeyondViewport:true});
+ await writeFile(screenshots+'/'+scheme+'.png',Buffer.from(shot.data,'base64'));
+ }
+ }
+ await evaluate(`const button = document.querySelector('form[action="/demo/claim/select"] button'); button.click(); button.click()`);
+ await until(`!!document.querySelector("p[role=status]") && !document.querySelector('form[action="/demo/claim/select"]')`);
+ assert.equal(await evaluate('location.pathname'),'/demo/claim');
+ assert.equal(await evaluate('location.hash'),'');
+ assert.equal(security.length,0,JSON.stringify(security));
+ assert.deepEqual(submissions, [
+ {disabled:true,visible:true,auto:false,account},
+ {disabled:true,visible:true,auto:true,account}
+ ],'manual and automatic submissions must disable the button, retain the form and preserve the selected account');
+ process.stdout.write('after: redirect, callback, JS auto-submit, claiming state; no CSP violations\n');
+} finally {
+ clearTimeout(timer);
+ const closed = new Promise(resolve => chrome.once('exit',resolve));
+ chrome.kill('SIGTERM');
+ await closed;
+}