mirror of
https://github.com/bitbaum/accountkit.git
synced 2026-12-03 19:18:43 +01:00
As an inline box it sat at the left edge in a product whose form is a plain block stack (Loki's sign-in, live 2026-11-14). It is now a full-width row with its words centred. Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq Co-authored-by: Claude <noreply@anthropic.com>
604 lines
15 KiB
CSS
604 lines
15 KiB
CSS
/*
|
||
* @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; where the trigger is
|
||
* not the last control in its row, the menu measures the open panel and
|
||
* moves it back inside (--acct-shift).
|
||
* - 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;
|
||
}
|
||
|
||
/*
|
||
* AccountControl's other two states, in the trigger's slot. While the session
|
||
* is being asked: an empty box the trigger's exact size, so nothing moves
|
||
* when the answer arrives. Signed out: one "Sign in" link, the trigger's
|
||
* height, quiet (the accent is for the action that brings someone in).
|
||
*/
|
||
.acct-pending {
|
||
display: inline-flex;
|
||
flex-shrink: 0;
|
||
inline-size: var(--acct-target);
|
||
block-size: var(--acct-target);
|
||
border: 1px solid var(--acct-line);
|
||
border-radius: 999px;
|
||
background: var(--acct-trigger-bg);
|
||
box-sizing: border-box;
|
||
}
|
||
.acct-signin {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
block-size: var(--acct-target);
|
||
min-inline-size: var(--acct-target);
|
||
padding: 0 1rem;
|
||
border: 1px solid var(--acct-line-2);
|
||
border-radius: 999px;
|
||
background: transparent;
|
||
color: var(--acct-fg);
|
||
font-family: var(--acct-font);
|
||
font-size: 0.9375rem;
|
||
font-weight: 600;
|
||
line-height: 1;
|
||
white-space: nowrap;
|
||
text-decoration: none;
|
||
box-sizing: border-box;
|
||
}
|
||
.acct-signin:hover {
|
||
border-color: var(--acct-fg-3);
|
||
background: var(--acct-hover);
|
||
}
|
||
.acct-signin: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-shift is set by the menu only when the panel would cross the
|
||
screen's edge (the trigger is not the last control in its row); otherwise
|
||
nothing moves. It offsets the edge the panel is pinned by, in layout. With
|
||
a transform the panel sat on screen while the page still scrolled sideways
|
||
by the distance it had moved (Chromium 156). */
|
||
.acct[data-align="end"] .acct-panel {
|
||
inset-inline-end: var(--acct-shift, 0px);
|
||
}
|
||
.acct[data-align="start"] .acct-panel {
|
||
inset-inline-start: var(--acct-shift, 0px);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
/* `shown: "narrow"`: a row the header itself shows from 768px up (a theme
|
||
toggle) is only in the menu below it. A media query, not a width read in
|
||
script, so the first paint and the server render are already right. 768px
|
||
is the md breakpoint the fleet's headers switch at. Hidden, a group must
|
||
not leave its divider behind: the first group still shown after the
|
||
identity block draws no line of its own (that block's edge is the line).
|
||
The second selector is a complex :not() (Selectors 4; Chrome 88, Safari 9,
|
||
Firefox 84). */
|
||
@media (min-width: 768px) {
|
||
.acct-panel .acct-narrow {
|
||
display: none;
|
||
}
|
||
.acct-group:not(.acct-group:not(.acct-narrow) ~ *) {
|
||
border-block-start: 0;
|
||
}
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
/*
|
||
* The other accounts a person can become. A row is a face, a name and one
|
||
* line under it; the name and the line each keep to one line, so a long
|
||
* handle never pushes the panel wider than a phone.
|
||
*/
|
||
.acct-heading {
|
||
margin: 0;
|
||
padding: 0.375rem 0.75rem 0.125rem;
|
||
font-size: 0.75rem;
|
||
font-weight: 600;
|
||
color: var(--acct-fg-3);
|
||
}
|
||
.acct-account {
|
||
padding-block: 0.375rem;
|
||
}
|
||
.acct-face {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
inline-size: 2rem;
|
||
block-size: 2rem;
|
||
overflow: hidden;
|
||
border: 1px solid var(--acct-line);
|
||
border-radius: 999px;
|
||
background: var(--acct-trigger-bg);
|
||
color: var(--acct-fg-2);
|
||
font-size: 0.75rem;
|
||
font-weight: 600;
|
||
}
|
||
.acct-face img {
|
||
inline-size: 100%;
|
||
block-size: 100%;
|
||
object-fit: cover;
|
||
}
|
||
.acct-account-text {
|
||
display: flex;
|
||
flex-direction: column;
|
||
/* Takes the row, so a count sits at its end and a long name truncates
|
||
before it instead of pushing it off. */
|
||
flex: 1 1 auto;
|
||
min-inline-size: 0;
|
||
}
|
||
/*
|
||
* Something waits in another account. The count sits at the end of its row;
|
||
* the dot on the trigger says so before the menu is opened. Both are the text
|
||
* colour, inverted: the strongest contrast the menu has, and not the accent,
|
||
* which the fleet keeps for Bitcoin and for the action that brings someone in.
|
||
*/
|
||
.acct-waiting {
|
||
flex-shrink: 0;
|
||
min-inline-size: 1.375rem;
|
||
padding: 0.0625rem 0.375rem;
|
||
border-radius: 999px;
|
||
background: var(--acct-fg);
|
||
color: var(--acct-panel);
|
||
font-size: 0.75rem;
|
||
font-weight: 600;
|
||
line-height: 1.25rem;
|
||
text-align: center;
|
||
box-sizing: border-box;
|
||
}
|
||
.acct-trigger-dot {
|
||
position: absolute;
|
||
pointer-events: none;
|
||
inset-block-start: 0;
|
||
inset-inline-end: 0;
|
||
inline-size: 0.625rem;
|
||
block-size: 0.625rem;
|
||
border: 2px solid var(--acct-panel);
|
||
border-radius: 999px;
|
||
background: var(--acct-fg);
|
||
box-sizing: border-box;
|
||
}
|
||
.acct-account-name,
|
||
.acct-account-line {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
.acct-account-name {
|
||
font-weight: 600;
|
||
}
|
||
.acct-account-line {
|
||
font-size: 0.8125rem;
|
||
color: var(--acct-fg-3);
|
||
}
|
||
|
||
.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;
|
||
}
|
||
/* Any input in the box, so a product that styles the input itself still clears the eye. */
|
||
.acct-auth-input-wrap > 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;
|
||
}
|
||
a.acct-auth-button,
|
||
a.acct-auth-button-quiet {
|
||
text-decoration: none;
|
||
}
|
||
.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);
|
||
}
|
||
/* A way round the form, not its action: text the size of a target, no box.
|
||
Nine outlined boxes of equal weight on Loki's sign-in (2026-11-13) left
|
||
the filled "Sign in" as one of many; these two read as what they are. */
|
||
/* A full-width row with the words in its middle: centred whatever the form's
|
||
own layout is (a grid, a flex column, or a plain block stack like Loki's,
|
||
where an inline box sat at the left edge). */
|
||
.acct-auth-text-action {
|
||
display: flex;
|
||
width: 100%;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: var(--acct-target);
|
||
padding: 0 0.5rem;
|
||
font: 500 0.9375rem/1.3 var(--acct-font);
|
||
color: var(--acct-fg-2);
|
||
background: none;
|
||
border: 0;
|
||
text-decoration: underline;
|
||
text-underline-offset: 4px;
|
||
cursor: pointer;
|
||
}
|
||
.acct-auth-text-action:hover {
|
||
color: var(--acct-fg);
|
||
}
|
||
.acct-auth-text-action:focus-visible {
|
||
outline: 2px solid var(--acct-focus);
|
||
outline-offset: 2px;
|
||
border-radius: var(--acct-radius-sm);
|
||
}
|
||
.acct-auth-text-action:disabled {
|
||
opacity: 0.6;
|
||
cursor: default;
|
||
}
|
||
.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);
|
||
}
|