/* * @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; }