Files
accountkit/styles.css
T
CatoandClaude 5dcc30d7c7 feat(auth): one password field at sign-up, with the eye inside it (#29)
0.7.2 asked for the password twice and put a full-width 'Show password'
bar between the fields and the button, which read as a third action. The
owner asked for sign-up without friction (2026-10-26). Seeing what you
typed is what the repeat field was for: the show/hide control is now an
eye inside the password field (two new class slots, inputWrap and
reveal, styled on --acct-* tokens, a 44px target), and sign-up has one
password field. Password reset keeps its repeat field, where a typo
locks the person out.


Claude-Session: https://claude.ai/code/session_01YK5nTo2tfxq8V8mKtuRGJH

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-26 21:38:22 +01:00

409 lines
9.8 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* @bitbaum/accountkit — the look of the one account menu.
*
* Every colour, radius and face is an --acct-* variable. By default they read
* @bitbaum/design-tokens' HSL-triplet variables, so apps on those tokens match
* without doing anything. An app whose variables are full colours (loki's are
* OKLCH under the same names) maps them once — `:root { --acct-panel:
* var(--surface-overlay); … }` — exactly as it does for chatkit's --ck-*.
* The BEHAVIOUR is shared and is not configurable.
*
* Non-negotiable, and why:
* - 44px touch targets on the trigger and every row (WCAG 2.5.8). Loki's
* trigger was 36px.
* - The panel never runs off a 320–390px screen: its width is capped by the
* viewport, and it aligns to the trigger's inside edge.
* - Sign-out is the last row and is never hidden behind a scroll.
*/
:where(:root) {
/* Zero specificity: an app's own :root rule setting --acct-* always wins. */
--acct-panel: hsl(var(--surface-overlay, 0 0% 100%));
--acct-hover: hsl(var(--surface-hover, 0 0% 95%));
--acct-trigger-bg: hsl(var(--surface-raised, 0 0% 96%));
--acct-fg: hsl(var(--text-primary, 0 0% 10%));
--acct-fg-2: hsl(var(--text-secondary, 0 0% 30%));
--acct-fg-3: hsl(var(--text-tertiary, 0 0% 42%));
--acct-line: hsl(var(--border-subtle, 0 0% 90%));
--acct-line-2: hsl(var(--border-default, 0 0% 82%));
--acct-focus: var(--accent-primary, #ff5c00);
--acct-action: var(--accent-primary, #ff5c00);
--acct-on-action: hsl(var(--on-accent, 0 0% 100%));
--acct-danger: hsl(var(--status-negative, 0 65% 50%));
--acct-radius: var(--radius-surface, 0.75rem);
--acct-radius-sm: var(--radius-control, 0.5rem);
--acct-font: var(
--font-sans,
system-ui,
-apple-system,
"Segoe UI",
sans-serif
);
--acct-target: 2.75rem;
--acct-shadow:
0 12px 32px -12px rgb(0 0 0 / 0.28), 0 2px 6px -2px rgb(0 0 0 / 0.12);
--acct-z: 50;
}
.acct {
position: relative;
display: inline-flex;
font-family: var(--acct-font);
}
.acct-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
inline-size: var(--acct-target);
block-size: var(--acct-target);
min-inline-size: var(--acct-target);
padding: 0;
border: 1px solid var(--acct-line);
border-radius: 999px;
background: var(--acct-trigger-bg);
color: var(--acct-fg-2);
cursor: pointer;
overflow: hidden;
}
.acct-trigger:hover {
border-color: var(--acct-line-2);
color: var(--acct-fg);
}
.acct-trigger:focus-visible,
.acct-row:focus-visible {
outline: 2px solid var(--acct-focus);
outline-offset: 2px;
}
.acct-avatar {
inline-size: 100%;
block-size: 100%;
object-fit: cover;
}
.acct-initials {
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.02em;
}
.acct-panel {
position: absolute;
inset-block-start: calc(100% + 0.5rem);
z-index: var(--acct-z);
inline-size: min(18rem, calc(100vw - 2rem));
padding: 0.375rem;
border: 1px solid var(--acct-line);
border-radius: var(--acct-radius);
background: var(--acct-panel);
color: var(--acct-fg);
box-shadow: var(--acct-shadow);
}
.acct[data-align="end"] .acct-panel {
inset-inline-end: 0;
}
.acct[data-align="start"] .acct-panel {
inset-inline-start: 0;
}
.acct-identity {
padding: 0.625rem 0.75rem 0.75rem;
border-block-end: 1px solid var(--acct-line);
min-inline-size: 0;
}
.acct-name,
.acct-secondary {
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.acct-name {
font-size: 0.9375rem;
font-weight: 600;
}
.acct-secondary {
margin-block-start: 0.125rem;
font-size: 0.8125rem;
color: var(--acct-fg-3);
}
.acct-group {
padding-block: 0.25rem;
}
.acct-group + .acct-group {
border-block-start: 1px solid var(--acct-line);
}
.acct-row {
display: flex;
align-items: center;
gap: 0.625rem;
inline-size: 100%;
min-block-size: var(--acct-target);
padding: 0 0.75rem;
border: 0;
border-radius: var(--acct-radius-sm);
background: transparent;
color: var(--acct-fg);
font: inherit;
font-size: 0.9375rem;
text-align: start;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
}
.acct-row:hover,
.acct-row:focus-visible {
background: var(--acct-hover);
}
.acct-row[disabled] {
cursor: progress;
opacity: 0.7;
}
.acct-icon {
display: inline-flex;
flex-shrink: 0;
color: var(--acct-fg-2);
}
.acct-extra {
padding-inline: 0.75rem;
font-size: 0.9375rem;
}
.acct-error {
margin: 0.25rem 0.75rem 0.375rem;
font-size: 0.8125rem;
color: var(--acct-danger);
}
/*
* The sign-in error screen. "Try again" is the primary action and restarts
* sign-in; "Back to the start" is a plain link. 44px targets, readable at
* 320px, no colour of its own beyond the --acct-* variables.
*/
.acct-signin-error {
max-inline-size: 28rem;
margin-inline: auto;
padding-block: 4rem;
font-family: var(--acct-font);
color: var(--acct-fg);
}
.acct-signin-kicker {
margin: 0;
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--acct-fg-3);
}
.acct-signin-title {
margin: 0.75rem 0 0;
font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
font-weight: 600;
line-height: 1.15;
letter-spacing: -0.02em;
text-wrap: balance;
}
.acct-signin-body {
margin: 1rem 0 0;
font-size: 1.0625rem;
line-height: 1.55;
color: var(--acct-fg-2);
}
.acct-signin-actions {
display: grid;
gap: 0.75rem;
margin-top: 2.5rem;
}
.acct-signin-actions > form {
display: contents;
}
.acct-signin-button {
display: inline-flex;
align-items: center;
justify-content: center;
inline-size: 100%;
min-block-size: var(--acct-target);
padding: 0 1.25rem;
border: 1px solid transparent;
border-radius: var(--acct-radius-sm);
background: var(--acct-action);
color: var(--acct-on-action);
font: inherit;
font-weight: 600;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
}
.acct-signin-button:hover {
filter: brightness(0.95);
}
.acct-signin-button.is-secondary {
border-color: var(--acct-line-2);
background: transparent;
color: var(--acct-fg);
}
.acct-signin-home {
display: inline-flex;
align-items: center;
justify-content: center;
min-block-size: var(--acct-target);
font-size: 0.9375rem;
font-weight: 600;
color: var(--acct-fg-2);
text-underline-offset: 0.25em;
}
.acct-signin-home:hover {
color: var(--acct-fg);
}
.acct-signin-button:focus-visible,
.acct-signin-home:focus-visible {
outline: 2px solid var(--acct-focus);
outline-offset: 2px;
}
/* ── Account screens (@bitbaum/accountkit/auth/react) ─────────────────────
Used only when a product passes no `classes` of its own. */
.acct-auth-stack {
display: grid;
gap: 1rem;
}
.acct-auth-field {
display: grid;
gap: 0.375rem;
}
.acct-auth-label {
font: 500 0.875rem/1.4 var(--acct-font);
color: var(--acct-fg);
}
.acct-auth-hint {
font: 400 0.875rem/1.5 var(--acct-font);
color: var(--acct-fg-2);
margin: 0;
}
.acct-auth-input {
min-height: var(--acct-target);
width: 100%;
box-sizing: border-box;
padding: 0 0.75rem;
font: 400 1rem/1.4 var(--acct-font);
color: var(--acct-fg);
background: var(--acct-trigger-bg);
border: 1px solid var(--acct-line-2);
border-radius: var(--acct-radius-sm);
}
/* A password field with its eye inside: the field keeps its full width and
the text stops short of the button. */
.acct-auth-input-wrap {
position: relative;
}
.acct-auth-input-wrap .acct-auth-input {
padding-right: calc(var(--acct-target) + 0.25rem);
}
.acct-auth-reveal {
position: absolute;
inset-block: 0;
right: 0;
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--acct-target);
min-height: var(--acct-target);
padding: 0;
border: 0;
border-radius: var(--acct-radius-sm);
background: none;
color: var(--acct-fg-2, var(--acct-fg));
cursor: pointer;
}
.acct-auth-reveal:focus-visible,
.acct-auth-input:focus-visible,
.acct-auth-button:focus-visible,
.acct-auth-button-quiet:focus-visible {
outline: 2px solid var(--acct-focus);
outline-offset: 2px;
}
.acct-auth-button,
.acct-auth-button-quiet {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: var(--acct-target);
padding: 0 1.25rem;
font: 500 1rem/1.3 var(--acct-font);
border-radius: var(--acct-radius-sm);
cursor: pointer;
}
.acct-auth-button {
background: var(--acct-action);
color: var(--acct-on-action);
border: 0;
}
.acct-auth-button-quiet {
background: transparent;
color: var(--acct-fg);
border: 1px solid var(--acct-line-2);
}
.acct-auth-button:disabled,
.acct-auth-button-quiet:disabled {
opacity: 0.6;
cursor: default;
}
.acct-auth-notice {
margin: 0;
padding: 0.75rem 1rem;
font: 400 0.875rem/1.5 var(--acct-font);
color: var(--acct-fg-2);
border: 1px solid var(--acct-line);
border-radius: var(--acct-radius-sm);
}
.acct-auth-error {
margin: 0;
font: 400 0.875rem/1.5 var(--acct-font);
color: var(--acct-danger);
}
.acct-auth-section {
display: grid;
gap: 1rem;
padding: 1.25rem;
border: 1px solid var(--acct-line);
border-radius: var(--acct-radius);
}
.acct-auth-section-title {
margin: 0;
font: 600 1.125rem/1.3 var(--acct-font);
color: var(--acct-fg);
}
.acct-auth-divider {
display: flex;
align-items: center;
gap: 0.75rem;
font: 500 0.75rem/1 var(--acct-font);
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--acct-fg-3);
}
.acct-auth-divider::before,
.acct-auth-divider::after {
content: "";
flex: 1;
height: 1px;
background: var(--acct-line);
}
.acct-auth-link {
color: var(--acct-fg);
text-decoration: underline;
text-underline-offset: 4px;
word-break: break-all;
}
.acct-auth-check {
display: flex;
align-items: center;
gap: 0.75rem;
min-height: var(--acct-target);
font: 400 0.875rem/1.4 var(--acct-font);
color: var(--acct-fg-2);
}