Redirect grant refusals to the client; style consent and connections

A signed-in person with no active team got a raw JSON access_denied page.
Once client_id and redirect_uri are validated, authorize and approve now
send refusals back to the registered redirect with error and state
(RFC 6749 4.1.2.1), as Cancel already did. Untrusted clients, redirects,
bad tickets and replays still get JSON/400 with no redirect.

The consent page and /connections now use the sign-in card look from a
same-origin /static/grant.css (CSP gains style-src 'self' only). The
only team is pre-selected. Wording is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 202371fe2b0202f602765678c9747a2026d02199 parent f08bfc1
4 files changed, +298 −26
  • grant/manage.go +2 −2
  • grant/redirect_test.go +148 −0
  • grant/server.go +63 −24
  • grant/static/grant.css +85 −0

CI passed — run details

CI log
=== ci ===
go vet ./...
go test -race ./...
ok  	amadan.net/oficina/agent-access.git	(cached)
ok  	amadan.net/oficina/agent-access.git/client	(cached)
?   	amadan.net/oficina/agent-access.git/cmd/oficina	[no test files]
ok  	amadan.net/oficina/agent-access.git/cmd/oficina-connect	5.521s
ok  	amadan.net/oficina/agent-access.git/connection	1.391s
ok  	amadan.net/oficina/agent-access.git/grant	1.776s
diff --git a/grant/manage.go b/grant/manage.go
index c8263f1..e116a2a 100644
--- a/grant/manage.go
+++ b/grant/manage.go
@@ -81,7 +81,7 @@ func (s *Server) manage(w http.ResponseWriter, r *http.Request) {
}
http.SetCookie(w, &http.Cookie{Name: "__Host-oficina-consent", Value: t.Nonce, Path: "/", Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode, MaxAge: 300})
}
- w.Header().Set("Content-Security-Policy", "default-src 'none'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'")
+ w.Header().Set("Content-Security-Policy", pageCSP)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_ = connectionsPage.Execute(w, map[string]any{"Connections": connections, "Ticket": encoded})
}
@@ -129,4 +129,4 @@ func (s *Server) disconnect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/connections", 303)
}
-var connectionsPage = template.Must(template.New("connections").Parse(`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Oficina connections</title><main><h1>Your connections</h1><p>Connected clients can act within the permissions you approved and your current app access. Disconnecting stops future requests across all apps.</p>{{range .Connections}}<section><h2>{{.Client}}</h2><p>Teams: {{range .Teams}}{{.}} {{end}}</p><ul>{{range .Scopes}}<li>{{.}}</li>{{end}}</ul><p>Expires {{.Expires.Format "2 January 2006"}}</p><form method="post" action="/connections/revoke"><input type="hidden" name="ticket" value="{{$.Ticket}}"><input type="hidden" name="id" value="{{.ID}}"><button>Disconnect {{.Client}}</button></form></section>{{else}}<p>You have no active connections. Connect from your agent app or the Oficina CLI.</p>{{end}}</main></html>`))
+var connectionsPage = template.Must(template.New("connections").Parse(pageHead + `<title>Oficina connections</title><main>` + brandMark + `<h1>Your connections</h1><p>Connected clients can act within the permissions you approved and your current app access. Disconnecting stops future requests across all apps.</p>{{range .Connections}}<section><h2>{{.Client}}</h2><p>Teams: {{range .Teams}}{{.}} {{end}}</p><ul>{{range .Scopes}}<li>{{.}}</li>{{end}}</ul><p>Expires {{.Expires.Format "2 January 2006"}}</p><form method="post" action="/connections/revoke"><input type="hidden" name="ticket" value="{{$.Ticket}}"><input type="hidden" name="id" value="{{.ID}}"><button>Disconnect {{.Client}}</button></form></section>{{else}}<p>You have no active connections. Connect from your agent app or the Oficina CLI.</p>{{end}}</main></html>`))
diff --git a/grant/redirect_test.go b/grant/redirect_test.go
new file mode 100644
index 0000000..292fb16
--- /dev/null
+++ b/grant/redirect_test.go
@@ -0,0 +1,148 @@
+package grant
+
+import (
+ "io"
+ "net/http"
+ "net/url"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+const testState = "0123456789abcdefghij"
+
+func authorizeURL(base string, extra url.Values) string {
+ q := url.Values{"client_id": {"oficina-cli"}, "redirect_uri": {"http://127.0.0.1:4567/callback"}, "response_type": {"code"}, "code_challenge": {"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"}, "code_challenge_method": {"S256"}, "resource": {base + "/mcp"}, "scope": {"notes:write"}, "state": {testState}}
+ for k, v := range extra {
+ q[k] = v
+ }
+ return base + "/oauth/authorize?" + q.Encode()
+}
+
+func get(t *testing.T, ts interface{ Client() *http.Client }, raw, session string) (*http.Response, string) {
+ t.Helper()
+ c := *ts.Client()
+ c.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }
+ req, _ := http.NewRequest("GET", raw, nil)
+ if session != "" {
+ req.Header.Set("Test-Session", session)
+ }
+ resp, err := c.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ body, _ := io.ReadAll(resp.Body)
+ return resp, string(body)
+}
+
+func wantErrorRedirect(t *testing.T, resp *http.Response, code string) {
+ t.Helper()
+ if resp.StatusCode != 303 {
+ t.Fatalf("status %d, want redirect", resp.StatusCode)
+ }
+ loc, err := url.Parse(resp.Header.Get("Location"))
+ if err != nil || loc.Host != "127.0.0.1:4567" || loc.Path != "/callback" {
+ t.Fatalf("redirected to %q", resp.Header.Get("Location"))
+ }
+ q := loc.Query()
+ if q.Get("error") != code || q.Get("state") != testState || q.Get("code") != "" {
+ t.Fatalf("redirect query %v", q)
+ }
+}
+
+func TestNoTeamRedirectsToClientWithAccessDenied(t *testing.T) {
+ _, ts, admitted := setup(t)
+ *admitted = false
+ resp, _ := get(t, ts, authorizeURL(ts.URL, nil), "signed-in")
+ wantErrorRedirect(t, resp, "access_denied")
+}
+
+func TestPostValidationAuthorizeErrorsRedirect(t *testing.T) {
+ _, ts, _ := setup(t)
+ resp, _ := get(t, ts, authorizeURL(ts.URL, url.Values{"scope": {"nonsense"}}), "signed-in")
+ wantErrorRedirect(t, resp, "invalid_scope")
+ resp, _ = get(t, ts, authorizeURL(ts.URL, url.Values{"code_challenge_method": {"plain"}}), "signed-in")
+ wantErrorRedirect(t, resp, "invalid_request")
+}
+
+func TestUntrustedClientOrRedirectNeverRedirects(t *testing.T) {
+ _, ts, admitted := setup(t)
+ *admitted = false
+ for _, extra := range []url.Values{{"client_id": {"nope"}}, {"redirect_uri": {"https://evil.example/callback"}}, {"redirect_uri": {"http://localhost:4567/callback"}}} {
+ resp, _ := get(t, ts, authorizeURL(ts.URL, extra), "signed-in")
+ if resp.StatusCode != 400 || resp.Header.Get("Location") != "" {
+ t.Fatalf("%v: %d %q", extra, resp.StatusCode, resp.Header.Get("Location"))
+ }
+ }
+}
+
+func TestConsentPageIsStyledWithUnchangedWords(t *testing.T) {
+ _, ts, _ := setup(t)
+ resp, body := get(t, ts, authorizeURL(ts.URL, nil), "signed-in")
+ csp := resp.Header.Get("Content-Security-Policy")
+ if resp.StatusCode != 200 || !strings.Contains(csp, "style-src 'self'") || strings.Contains(csp, "unsafe-inline") {
+ t.Fatalf("%d csp %q", resp.StatusCode, csp)
+ }
+ if !strings.Contains(body, `rel="stylesheet" href="/static/grant.css"`) || strings.Contains(body, "<style") {
+ t.Fatal("stylesheet not linked")
+ }
+ for _, words := range []string{"Connect to Oficina", "Connect Oficina CLI to Oficina", "This client will receive the content it reads and can act within the permissions you approve.", "Choose teams", "Allow access", "Cancel", "<li>Create and edit notes</li>"} {
+ if !strings.Contains(body, words) {
+ t.Fatalf("missing %q", words)
+ }
+ }
+ if !strings.Contains(body, `value="acme" checked`) {
+ t.Fatal("the only team is not pre-selected")
+ }
+ css, cssBody := get(t, ts, ts.URL+"/static/grant.css", "")
+ if css.StatusCode != 200 || !strings.HasPrefix(css.Header.Get("Content-Type"), "text/css") || !strings.Contains(cssBody, "system-ui") {
+ t.Fatalf("stylesheet %d %s", css.StatusCode, css.Header.Get("Content-Type"))
+ }
+}
+
+func TestConnectionsPageIsStyled(t *testing.T) {
+ _, ts, _ := setup(t)
+ resp, body := get(t, ts, ts.URL+"/connections", "signed-in")
+ if !strings.Contains(resp.Header.Get("Content-Security-Policy"), "style-src 'self'") || !strings.Contains(body, `href="/static/grant.css"`) || !strings.Contains(body, "Your connections") {
+ t.Fatalf("connections not styled: %s", body)
+ }
+}
+
+func TestApproveRefusalRedirectsWithStateButReplayDoesNot(t *testing.T) {
+ _, ts, _ := setup(t)
+ page, body := get(t, ts, authorizeURL(ts.URL, nil), "signed-in")
+ m := regexp.MustCompile(`name="ticket" value="([^"]+)"`).FindStringSubmatch(body)
+ if len(m) != 2 {
+ t.Fatal("no ticket")
+ }
+ post := func(team string) *http.Response {
+ form := url.Values{"ticket": {m[1]}, "decision": {"approve"}}
+ if team != "" {
+ form.Set("team", team)
+ }
+ req, _ := http.NewRequest("POST", ts.URL+"/oauth/authorize", strings.NewReader(form.Encode()))
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ req.Header.Set("Origin", ts.URL)
+ req.Header.Set("Test-Session", "signed-in")
+ for _, c := range page.Cookies() {
+ req.AddCookie(c)
+ }
+ c := *ts.Client()
+ c.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }
+ resp, err := c.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ resp.Body.Close()
+ return resp
+ }
+ wantErrorRedirect(t, post("not-my-team"), "access_denied")
+ wantErrorRedirect(t, post(""), "access_denied")
+ if resp := post("acme"); resp.StatusCode != 303 || !strings.Contains(resp.Header.Get("Location"), "code=") {
+ t.Fatalf("approve %d", resp.StatusCode)
+ }
+ if resp := post("acme"); resp.StatusCode != 400 || resp.Header.Get("Location") != "" {
+ t.Fatalf("replay %d %q", resp.StatusCode, resp.Header.Get("Location"))
+ }
+}
diff --git a/grant/server.go b/grant/server.go
index 17e620c..dee33e1 100644
--- a/grant/server.go
+++ b/grant/server.go
@@ -6,6 +6,7 @@ import (
"crypto/cipher"
"crypto/rand"
"crypto/subtle"
+ _ "embed"
"encoding/base64"
"encoding/json"
"errors"
@@ -152,6 +153,10 @@ func (s *Server) Handler() http.Handler {
mux.HandleFunc("GET /.well-known/oauth-protected-resource", s.resourceMetadata)
mux.HandleFunc("GET /oauth/authorize", s.authorize)
mux.HandleFunc("POST /oauth/authorize", s.approve)
+ mux.HandleFunc("GET /static/grant.css", func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "text/css; charset=utf-8")
+ _, _ = w.Write(grantCSS)
+ })
mux.HandleFunc("POST /oauth/token", s.token)
mux.HandleFunc("POST /oauth/revoke", s.revoke)
mux.HandleFunc("POST /api/v1/credential", s.credential)
@@ -201,6 +206,27 @@ func single(values url.Values) bool {
}
return true
}
+
+// pageCSP lets the grant pages load their own stylesheet and nothing else.
+const pageCSP = "default-src 'none'; style-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'"
+
+// refuse sends a trusted client back to its registered redirect with an OAuth
+// error. Callers must have validated the client and redirect already.
+func (s *Server) refuse(w http.ResponseWriter, r *http.Request, redirect, state, code string) {
+ dest, err := url.Parse(redirect)
+ if err != nil {
+ fail(w, 400, "invalid_request")
+ return
+ }
+ q := dest.Query()
+ q.Set("error", code)
+ if state != "" {
+ q.Set("state", state)
+ }
+ q.Set("iss", s.cfg.Origin)
+ dest.RawQuery = q.Encode()
+ http.Redirect(w, r, dest.String(), 303)
+}
func (s *Server) authorize(w http.ResponseWriter, r *http.Request) {
if len(r.URL.RawQuery) > 8192 {
fail(w, 400, "invalid_request")
@@ -216,20 +242,24 @@ func (s *Server) authorize(w http.ResponseWriter, r *http.Request) {
fail(w, 400, "invalid_request")
return
}
+
+ // The client and redirect are now trusted: later refusals go back to the
+ // client (RFC 6749 section 4.1.2.1) instead of a bare JSON page.
+ redirect, state := q.Get("redirect_uri"), q.Get("state")
challenge, err := base64.RawURLEncoding.DecodeString(q.Get("code_challenge"))
if err != nil || len(challenge) != 32 || q.Get("code_challenge_method") != "S256" || q.Get("response_type") != "code" || q.Get("resource") != s.cfg.Resource || len(q.Get("state")) < 16 {
- fail(w, 400, "invalid_request")
+ s.refuse(w, r, redirect, state, "invalid_request")
return
}
scopes := strings.Fields(q.Get("scope"))
if len(scopes) == 0 {
- fail(w, 400, "invalid_scope")
+ s.refuse(w, r, redirect, state, "invalid_scope")
return
}
seen := map[string]bool{}
for _, scope := range scopes {
if _, ok := s.cfg.Scopes[scope]; !ok || seen[scope] {
- fail(w, 400, "invalid_scope")
+ s.refuse(w, r, redirect, state, "invalid_scope")
return
}
seen[scope] = true
@@ -245,21 +275,21 @@ func (s *Server) authorize(w http.ResponseWriter, r *http.Request) {
}
teams, err := s.cfg.Teams(r.Context(), subject)
if err != nil {
- fail(w, 503, "temporarily_unavailable")
+ s.refuse(w, r, redirect, state, "temporarily_unavailable")
return
}
if len(teams) == 0 {
- fail(w, 403, "access_denied")
+ s.refuse(w, r, redirect, state, "access_denied")
return
}
t := ticket{Purpose: "authorize", Client: client.ID, Redirect: q.Get("redirect_uri"), Resource: s.cfg.Resource, Challenge: q.Get("code_challenge"), State: q.Get("state"), Subject: subject, Nonce: random(), Scopes: scopes, Expires: s.cfg.Store.Now().Add(5 * time.Minute).Unix()}
encoded, err := s.seal(t)
if err != nil {
- fail(w, 500, "server_error")
+ s.refuse(w, r, redirect, state, "server_error")
return
}
if _, err = s.cfg.Store.DB.ExecContext(r.Context(), `INSERT INTO agent_pending(hash,expires) VALUES(?,?)`, hash(t.Nonce), t.Expires); err != nil {
- fail(w, 503, "temporarily_unavailable")
+ s.refuse(w, r, redirect, state, "temporarily_unavailable")
return
}
http.SetCookie(w, &http.Cookie{Name: "__Host-oficina-consent", Value: t.Nonce, Path: "/", Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode, MaxAge: 300})
@@ -267,12 +297,19 @@ func (s *Server) authorize(w http.ResponseWriter, r *http.Request) {
for _, scope := range scopes {
labels = append(labels, s.cfg.Scopes[scope])
}
- w.Header().Set("Content-Security-Policy", "default-src 'none'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'")
+ w.Header().Set("Content-Security-Policy", pageCSP)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
- _ = consent.Execute(w, map[string]any{"Client": client.Name, "Ticket": encoded, "Teams": teams, "Scopes": labels})
+ _ = consent.Execute(w, map[string]any{"Client": client.Name, "Ticket": encoded, "Teams": teams, "Only": len(teams) == 1, "Scopes": labels})
}
-var consent = template.Must(template.New("consent").Parse(`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Connect to Oficina</title><main><h1>Connect {{.Client}} to Oficina</h1><p>This client will receive the content it reads and can act within the permissions you approve.</p><ul>{{range .Scopes}}<li>{{.}}</li>{{end}}</ul><form method="post" action="/oauth/authorize"><input type="hidden" name="ticket" value="{{.Ticket}}"><fieldset><legend>Choose teams</legend>{{range .Teams}}<label><input type="checkbox" name="team" value="{{.ID}}">{{.Name}}</label><br>{{end}}</fieldset><button name="decision" value="approve">Allow access</button><button name="decision" value="deny">Cancel</button></form></main></html>`))
+//go:embed static/grant.css
+var grantCSS []byte
+
+// pageHead and brandMark give every grant page the sign-in card look.
+const pageHead = `<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/static/grant.css">`
+const brandMark = `<p class="brand"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" aria-hidden="true"><rect width="1024" height="1024" fill="#303642"/><g transform="translate(153.6 153.6) scale(29.8667)" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/></g></svg>Oficina</p>`
+
+var consent = template.Must(template.New("consent").Parse(pageHead + `<title>Connect to Oficina</title><main>` + brandMark + `<h1>Connect {{.Client}} to Oficina</h1><p>This client will receive the content it reads and can act within the permissions you approve.</p><ul>{{range .Scopes}}<li>{{.}}</li>{{end}}</ul><form method="post" action="/oauth/authorize"><input type="hidden" name="ticket" value="{{.Ticket}}"><fieldset><legend>Choose teams</legend>{{range .Teams}}<label><input type="checkbox" name="team" value="{{.ID}}"{{if $.Only}} checked{{end}}>{{.Name}}</label>{{end}}</fieldset><div class="actions"><button name="decision" value="approve">Allow access</button><button name="decision" value="deny">Cancel</button></div></form></main></html>`))
func (s *Server) approve(w http.ResponseWriter, r *http.Request) {
if len(r.Header.Values("Origin")) != 1 || r.Header.Get("Origin") != s.cfg.Origin {
@@ -292,12 +329,12 @@ func (s *Server) approve(w http.ResponseWriter, r *http.Request) {
}
decision := r.PostForm.Get("decision")
if decision != "approve" && decision != "deny" {
- fail(w, 400, "invalid_request")
+ s.refuse(w, r, t.Redirect, t.State, "invalid_request")
return
}
teams, err := s.cfg.Teams(r.Context(), t.Subject)
if err != nil {
- fail(w, 503, "temporarily_unavailable")
+ s.refuse(w, r, t.Redirect, t.State, "temporarily_unavailable")
return
}
allowed := map[string]bool{}
@@ -308,18 +345,18 @@ func (s *Server) approve(w http.ResponseWriter, r *http.Request) {
seen := map[string]bool{}
for _, team := range selected {
if !allowed[team] || seen[team] {
- fail(w, 403, "access_denied")
+ s.refuse(w, r, t.Redirect, t.State, "access_denied")
return
}
seen[team] = true
}
if decision == "approve" && len(selected) == 0 {
- fail(w, 400, "invalid_request")
+ s.refuse(w, r, t.Redirect, t.State, "access_denied")
return
}
result, err := s.cfg.Store.DB.ExecContext(r.Context(), `DELETE FROM agent_pending WHERE hash=? AND expires>?`, hash(t.Nonce), s.cfg.Store.Now().Unix())
if err != nil {
- fail(w, 503, "temporarily_unavailable")
+ s.refuse(w, r, t.Redirect, t.State, "temporarily_unavailable")
return
}
n, _ := result.RowsAffected()
@@ -328,22 +365,24 @@ func (s *Server) approve(w http.ResponseWriter, r *http.Request) {
return
}
http.SetCookie(w, &http.Cookie{Name: "__Host-oficina-consent", Path: "/", Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode, MaxAge: -1})
- dest, _ := url.Parse(t.Redirect)
- q := dest.Query()
- q.Set("state", t.State)
- q.Set("iss", s.cfg.Origin)
if decision == "deny" {
- q.Set("error", "access_denied")
- } else {
+ s.refuse(w, r, t.Redirect, t.State, "access_denied")
+ return
+ }
+ {
+ dest, _ := url.Parse(t.Redirect)
+ q := dest.Query()
+ q.Set("state", t.State)
+ q.Set("iss", s.cfg.Origin)
code, err := s.cfg.Store.CreateCode(r.Context(), Grant{Subject: t.Subject, ClientID: t.Client, Teams: selected, Scopes: t.Scopes}, Code{t.Redirect, t.Challenge, t.Resource})
if err != nil {
- fail(w, 503, "temporarily_unavailable")
+ s.refuse(w, r, t.Redirect, t.State, "temporarily_unavailable")
return
}
q.Set("code", code)
+ dest.RawQuery = q.Encode()
+ http.Redirect(w, r, dest.String(), 303)
}
- dest.RawQuery = q.Encode()
- http.Redirect(w, r, dest.String(), 303)
}
func form(w http.ResponseWriter, r *http.Request) bool {
r.Body = http.MaxBytesReader(w, r.Body, 16384)
diff --git a/grant/static/grant.css b/grant/static/grant.css
new file mode 100644
index 0000000..022e9bb
--- /dev/null
+++ b/grant/static/grant.css
@@ -0,0 +1,85 @@
+/* Oficina grant pages: the sign-in card look. Tokens follow estilo's theme. */
+:root {
+ color-scheme: light dark;
+ --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
+ --page: light-dark(#eef3fe, #0e1118);
+ --card: light-dark(#ffffff, #1a1f26);
+ --line: light-dark(#e5e7eb, #2a3038);
+ --line-strong: light-dark(#7f8792, #79828e);
+ --text: light-dark(#1a1d21, #e8eaed);
+ --muted: light-dark(#4b5563, #a8b0ba);
+ --accent: light-dark(#2464e0, #7ba7ff);
+ --accent-strong: light-dark(#1a4fc0, #a3c0ff);
+ --on-accent: light-dark(#ffffff, #0b1220);
+ --soft: light-dark(#f6f7f8, #15191f);
+}
+* { box-sizing: border-box; }
+html { background: var(--page); }
+body {
+ margin: 0;
+ min-height: 100dvh;
+ display: flex;
+ align-items: flex-start;
+ justify-content: center;
+ padding: 1rem;
+ font: 1rem/1.5 var(--font);
+ color: var(--text);
+ background: linear-gradient(180deg, var(--page), light-dark(#e3ebfb, #121826));
+}
+main {
+ width: 100%;
+ max-width: 26rem;
+ margin-block: max(1rem, 6vh);
+ padding: 1.5rem 1.25rem;
+ background: var(--card);
+ border: 1px solid var(--line);
+ border-radius: 12px;
+ box-shadow: 0 8px 24px light-dark(rgba(36, 60, 120, .10), rgba(0, 0, 0, .5));
+}
+.brand { color: var(--text); display: flex; align-items: center; gap: .625rem; margin: 0 0 1.25rem; font-weight: 650; font-size: 1.125rem; letter-spacing: -.01em; }
+.brand svg { width: 2rem; height: 2rem; border-radius: 21%; flex-shrink: 0; }
+h1 { margin: 0 0 .75rem; font-size: 1.375rem; line-height: 1.25; letter-spacing: -.01em; }
+h2 { margin: 0 0 .5rem; font-size: 1.0625rem; }
+p { margin: 0 0 1rem; color: var(--muted); }
+ul { margin: 0 0 1.25rem; padding-left: 1.25rem; }
+li { margin-block: .25rem; }
+fieldset { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
+legend { padding: 0; margin-bottom: .5rem; font-weight: 600; }
+label {
+ display: flex;
+ align-items: center;
+ gap: .75rem;
+ min-height: 2.75rem;
+ padding: .5rem .75rem;
+ margin-bottom: .5rem;
+ border: 1px solid var(--line-strong);
+ border-radius: 8px;
+ cursor: pointer;
+}
+label:has(input:checked) { border-color: var(--accent); background: var(--soft); }
+input[type=checkbox] { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
+button {
+ font: inherit;
+ font-weight: 600;
+ min-height: 2.75rem;
+ padding: .5rem 1rem;
+ border-radius: 8px;
+ border: 1px solid var(--line-strong);
+ background: transparent;
+ color: var(--text);
+ cursor: pointer;
+}
+button:hover { background: var(--soft); }
+button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
+button[value=approve] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
+button[value=approve]:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
+.actions { display: flex; flex-direction: column; gap: .625rem; }
+.actions button { width: 100%; }
+section { padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); }
+section form button { width: 100%; }
+@media (min-width: 30rem) {
+ body { align-items: center; }
+ main { padding: 2rem; margin-block: 1rem; }
+ .actions { flex-direction: row-reverse; }
+ .actions button { width: auto; flex: 1; }
+}