/* (C)2026 Badger Commerce Limited, a subsidiary of Kedos Consulting Limited */

/*
 * The auth portal's one stylesheet. Every auth page links it through the layout fragment
 * (templates/auth/fragment/layout.html); no page carries its own <style>, :root or raw colour.
 * Design rules and the reason for each token: docs/developers/design/auth-portal.md.
 *
 * Two skins, set on <body data-skin="shop|badger"> by the controller from the page's audience.
 * A skin changes tokens only, never markup. Page-specific layouts live at the end, one section per
 * page, headed "--- page: <name> ---", built from these tokens.
 */

/* --- font: Inter, served by the portal (OFL, see /fonts/OFL.txt) --- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- tokens --- */
:root {
    color-scheme: light;

    /* Surface */
    --auth-page: #F4F5F7;
    --auth-surface: #FFFFFF;
    --auth-surface-alt: #F6F7F9;
    --auth-border: #E4E7EC;
    --auth-border-strong: #CDD3DC;
    --auth-input-border: #6B7280;

    /* Text: nothing lighter than --auth-text-subtle (4.5:1 on the card and the page) */
    --auth-text: #171B22;
    --auth-text-muted: #525A67;
    --auth-text-subtle: #646D7A;

    /* Accent: the shop skin's neutral ink, overridden by the Badger skin below */
    --auth-accent: #171B22;
    --auth-accent-hover: #000000;
    --auth-on-accent: #FFFFFF;
    --auth-accent-soft: #F1F2F4;
    --auth-accent-text: #171B22;
    --auth-focus-color: #171B22;

    /* Status: the strong set, each on its soft fill */
    --auth-error: #B91C1C;
    --auth-error-soft: #FEF2F2;
    --auth-success: #047857;
    --auth-success-soft: #ECFDF5;
    --auth-warning: #A85B00;
    --auth-warning-soft: #FFF1DB;
    --auth-info: #2563EB;
    --auth-info-soft: #E8F0FE;

    /* Space, on the 4px grid */
    --auth-space-1: 4px;
    --auth-space-2: 8px;
    --auth-space-3: 12px;
    --auth-space-4: 16px;
    --auth-space-5: 20px;
    --auth-space-6: 24px;
    --auth-space-7: 32px;
    --auth-space-8: 40px;

    /* Radius and shadow */
    --auth-radius-sm: 6px;
    --auth-radius-md: 8px;
    --auth-radius-lg: 16px;
    --auth-radius-pill: 999px;
    --auth-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06), 0 0 0 1px rgba(16, 24, 40, 0.03);
    --auth-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 1px rgba(16, 24, 40, 0.04);

    /* Type */
    --auth-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --auth-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --auth-text-xs: 12px;
    --auth-text-sm: 13px;
    --auth-text-base: 14px;
    --auth-text-md: 15px;
    --auth-text-input: 16px;
    --auth-text-lg: 18px;
    --auth-text-title: 24px;
    --auth-text-title-wide: 28px;

    /* Layout */
    --auth-card-width: 440px;
    --auth-card-width-wide: 760px;
    --auth-card-pad-y: 40px;
    --auth-card-pad-x: 32px;
    --auth-gutter: 24px;
    --auth-control-height: 48px;
    --auth-control-height-sm: 40px;
}

/* The Badger skin: staff and prospect pages. Values from badger-brand-tokens.json. */
[data-skin="badger"] {
    --auth-accent: #FF8A00;
    --auth-accent-hover: #E87C00;
    --auth-on-accent: #2B1700;
    --auth-accent-soft: #FFF3E0;
    --auth-accent-text: #A85300;
    --auth-focus-color: #A85300;
}

@media (max-width: 479px) {
    :root {
        --auth-card-pad-y: 24px;
        --auth-card-pad-x: 20px;
        --auth-gutter: 16px;
    }
}

/* --- base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--auth-font);
    font-size: var(--auth-text-md);
    line-height: 1.5;
    color: var(--auth-text);
    background: var(--auth-page);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; }
fieldset { border: 0; padding: 0; min-width: 0; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--auth-accent-text); }
:focus-visible { outline: 2px solid var(--auth-focus-color); outline-offset: 2px; }
.auth-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- shell --- */
.auth-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        calc(var(--auth-space-8) + env(safe-area-inset-top, 0px))
        calc(var(--auth-gutter) + env(safe-area-inset-right, 0px))
        calc(var(--auth-space-6) + env(safe-area-inset-bottom, 0px))
        calc(var(--auth-gutter) + env(safe-area-inset-left, 0px));
}
@media (max-width: 479px), (max-height: 640px) {
    .auth-shell { padding-top: calc(var(--auth-space-5) + env(safe-area-inset-top, 0px)); }
}
.auth-shell__main { width: 100%; max-width: var(--auth-card-width); }
.auth-shell--wide .auth-shell__main { max-width: var(--auth-card-width-wide); }

/* --- card --- */
.auth-card {
    background: var(--auth-surface);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-card);
    padding: var(--auth-card-pad-y) var(--auth-card-pad-x);
    animation: auth-enter 0.25s ease-out both;
}
.auth-card + .auth-card { margin-top: var(--auth-space-6); animation: none; }
.auth-card--flush { padding: 0; overflow: hidden; }
.auth-card__section { padding: var(--auth-space-6) var(--auth-card-pad-x); }
.auth-card__section + .auth-card__section { border-top: 1px solid var(--auth-border); }
/* Movement only: content is never invisible, even where animations don't run */
@keyframes auth-enter {
    from { transform: translateY(6px); }
    to { transform: none; }
}

/* --- brand header --- */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--auth-space-2);
    margin-bottom: var(--auth-space-6);
    text-align: center;
}
.auth-brand__logo-slot { display: flex; align-items: center; justify-content: center; height: 48px; width: 100%; }
.auth-brand__logo { max-height: 48px; max-width: min(200px, 100%); width: auto; height: auto; object-fit: contain; }
.auth-brand__name {
    font-size: var(--auth-text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}
.auth-brand__domain { font-size: var(--auth-text-sm); color: var(--auth-text-subtle); overflow-wrap: anywhere; }
.auth-brand__mark { height: 22px; width: auto; }
.auth-brand__eyebrow {
    font-size: var(--auth-text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--auth-text-muted);
}
[data-skin="badger"] .auth-brand { align-items: flex-start; text-align: left; }

/* --- title and lede --- */
.auth-title {
    font-size: var(--auth-text-title);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: var(--auth-space-2);
    overflow-wrap: anywhere;
}
.auth-shell--wide .auth-title { font-size: var(--auth-text-title-wide); }
.auth-lede { color: var(--auth-text-muted); margin-bottom: var(--auth-space-6); }
.auth-subtitle { font-size: var(--auth-text-lg); font-weight: 700; margin-bottom: var(--auth-space-4); }
.auth-text-muted { color: var(--auth-text-muted); }
.auth-small { font-size: var(--auth-text-sm); color: var(--auth-text-muted); }
.auth-center { text-align: center; }
.auth-stack > * + * { margin-top: var(--auth-space-4); }
.auth-stack--sm > * + * { margin-top: var(--auth-space-2); }
.auth-spaced { margin-top: var(--auth-space-6); }

/* --- field --- */
.auth-field { margin-bottom: var(--auth-space-5); }
.auth-field__label, .auth-field > label {
    display: block;
    font-size: var(--auth-text-base);
    font-weight: 600;
    margin-bottom: var(--auth-space-2);
}
.auth-field__hint { font-size: var(--auth-text-sm); color: var(--auth-text-muted); margin-top: var(--auth-space-1); }
.auth-field__error {
    display: flex;
    gap: var(--auth-space-1);
    font-size: var(--auth-text-sm);
    font-weight: 500;
    color: var(--auth-error);
    margin-top: var(--auth-space-1);
}
.auth-field__error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: var(--auth-error); color: var(--auth-surface); font-size: 11px; font-weight: 700; }
.auth-input,
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="number"],
.auth-field input[type="tel"],
.auth-field input[type="search"],
.auth-field select,
.auth-field textarea {
    display: block;
    width: 100%;
    min-height: var(--auth-control-height);
    padding: 11px 12px;
    font-size: var(--auth-text-input);
    line-height: 1.4;
    color: var(--auth-text);
    background: var(--auth-surface);
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-input:focus-visible,
.auth-field input:focus-visible,
.auth-field select:focus-visible,
.auth-field textarea:focus-visible {
    outline: 2px solid var(--auth-focus-color);
    outline-offset: 1px;
    border-color: var(--auth-focus-color);
}
.auth-input[aria-invalid="true"], .auth-field [aria-invalid="true"] { border-color: var(--auth-error); border-width: 2px; padding: 10px 11px; }
.auth-input[readonly], .auth-field input[readonly], .auth-input:disabled, .auth-field input:disabled { background: var(--auth-surface-alt); color: var(--auth-text-muted); }
.auth-input::placeholder, .auth-field input::placeholder { color: var(--auth-text-subtle); opacity: 1; }

/* A password field with its show/hide toggle */
.auth-field__control { position: relative; }
.auth-field__control .auth-input,
.auth-field__control input { padding-right: 76px; }
.auth-field__reveal {
    position: absolute;
    top: 2px; right: 2px; bottom: 2px;
    min-width: 44px;
    padding: 0 var(--auth-space-3);
    font-size: var(--auth-text-sm);
    font-weight: 600;
    color: var(--auth-accent-text);
    background: transparent;
    border: 0;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
}

/* A field with a fixed suffix (sign-up's shop address) */
.auth-field--suffix .auth-field__control { display: flex; align-items: stretch; }
.auth-field.auth-field--suffix input { border-radius: var(--auth-radius-sm) 0 0 var(--auth-radius-sm); min-width: 0; }
.auth-field__suffix {
    display: flex; align-items: center;
    padding: 0 var(--auth-space-3);
    font-size: var(--auth-text-base);
    color: var(--auth-text-muted);
    white-space: nowrap;
    background: var(--auth-surface-alt);
    border: 1px solid var(--auth-input-border);
    border-left: 0;
    border-radius: 0 var(--auth-radius-sm) var(--auth-radius-sm) 0;
}

/* The one-time code (two classes, to win over .auth-field input[type]) */
.auth-field.auth-field--code input {
    text-align: center;
    font-family: var(--auth-mono);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.3em;
    padding-left: 0.3em;
}

/* Checkboxes and radios outside an option list */
.auth-check { display: flex; gap: var(--auth-space-3); align-items: flex-start; margin-bottom: var(--auth-space-3); font-size: var(--auth-text-base); }
.auth-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--auth-accent); }

/* --- buttons --- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--auth-space-2);
    width: 100%;
    min-height: var(--auth-control-height);
    padding: 12px var(--auth-space-4);
    font-size: var(--auth-text-input);
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.auth-btn + .auth-btn, .auth-btn + form, form + .auth-btn, form + form { margin-top: var(--auth-space-3); }
.auth-login__passkey-option:not([hidden]) + .auth-btn,
.auth-login__passkey-option:not([hidden]) + .auth-providers,
.auth-btn + .auth-providers,
.auth-providers + .auth-btn,
.auth-providers + form { margin-top: var(--auth-space-3); }
/* Provider buttons (ui :: providers): stacked with names, or three and more in one row of logos */
.auth-providers--row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--auth-space-3); }
.auth-providers--row .auth-btn + .auth-btn { margin-top: 0; }
.auth-providers--row .auth-btn { padding-inline: var(--auth-space-2); }
.auth-btn--primary { color: var(--auth-on-accent); background: var(--auth-accent); }
.auth-btn--primary:hover { background: var(--auth-accent-hover); }
.auth-btn--secondary, .auth-btn--provider { color: var(--auth-text); background: var(--auth-surface); border-color: var(--auth-border-strong); }
.auth-btn--secondary:hover, .auth-btn--provider:hover { background: var(--auth-surface-alt); border-color: var(--auth-input-border); }
.auth-btn__logo { flex: none; width: 20px; height: 20px; }
/* "Last used", on the sign-in button this browser last signed in with (sign-in page script) */
.auth-btn--provider { position: relative; }
.auth-btn__badge {
    position: absolute;
    top: -9px;
    right: var(--auth-space-3);
    padding: 1px var(--auth-space-2);
    font-size: var(--auth-text-xs);
    font-weight: 600;
    line-height: 16px;
    color: var(--auth-text);
    background: var(--auth-accent-soft);
    border: 1px solid var(--auth-border-strong);
    border-radius: 999px;
}
.auth-btn--danger { color: var(--auth-error); background: var(--auth-surface); border-color: var(--auth-border-strong); }
.auth-btn--danger:hover { background: var(--auth-error-soft); border-color: var(--auth-error); }
.auth-btn--quiet-danger { color: var(--auth-text-muted); background: transparent; border-color: var(--auth-border-strong); }
.auth-btn--quiet-danger:hover, .auth-btn--quiet-danger:focus-visible { color: var(--auth-error); border-color: var(--auth-error); background: var(--auth-error-soft); }
.auth-btn--link {
    width: auto;
    min-height: 44px;
    padding: var(--auth-space-2) var(--auth-space-1);
    font-size: var(--auth-text-base);
    color: var(--auth-accent-text);
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.auth-btn--link:hover { color: var(--auth-text); }
.auth-btn--sm { width: auto; min-height: var(--auth-control-height-sm); padding: 8px var(--auth-space-4); font-size: var(--auth-text-base); }
.auth-btn[disabled], .auth-btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.auth-btn[aria-busy="true"] { cursor: progress; }
.auth-btn[aria-busy="true"]::before {
    content: "";
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: auth-spin 0.8s linear infinite;
}
.auth-actions { display: flex; flex-direction: column; gap: var(--auth-space-3); margin-top: var(--auth-space-6); }
.auth-actions > .auth-btn + .auth-btn, .auth-actions > form + form { margin-top: 0; }
.auth-actions--split { flex-direction: row; }
.auth-actions--split > * { flex: 1 1 0; }
@media (max-width: 479px) { .auth-actions--split { flex-direction: column-reverse; } }
.auth-actions--links { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: var(--auth-space-1) var(--auth-space-4); margin-top: var(--auth-space-4); }
.auth-link { color: var(--auth-accent-text); text-decoration: underline; text-underline-offset: 3px; }
.auth-link:hover { color: var(--auth-text); }

/* --- divider --- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--auth-space-3);
    margin: var(--auth-space-6) 0;
    font-size: var(--auth-text-sm);
    color: var(--auth-text-subtle);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--auth-border); }

/* --- alert --- */
.auth-alert {
    display: flex;
    gap: var(--auth-space-3);
    align-items: flex-start;
    padding: var(--auth-space-3) var(--auth-space-4);
    margin-bottom: var(--auth-space-5);
    font-size: var(--auth-text-base);
    line-height: 1.45;
    border-radius: var(--auth-radius-md);
    border: 1px solid transparent;
}
.auth-alert:focus { outline: none; }
.auth-alert:focus-visible { outline: 2px solid var(--auth-focus-color); outline-offset: 2px; }
.auth-alert__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.auth-alert__body > * + * { margin-top: var(--auth-space-1); }
.auth-alert ul { margin: var(--auth-space-1) 0 0; padding-left: var(--auth-space-5); }
.auth-alert--error { color: var(--auth-error); background: var(--auth-error-soft); border-color: rgba(185, 28, 28, 0.2); }
.auth-alert--success { color: var(--auth-success); background: var(--auth-success-soft); border-color: rgba(4, 120, 87, 0.2); }
.auth-alert--warning { color: var(--auth-warning); background: var(--auth-warning-soft); border-color: rgba(168, 91, 0, 0.2); }
.auth-alert--info { color: var(--auth-text); background: var(--auth-info-soft); border-color: rgba(37, 99, 235, 0.18); }
.auth-alert--info .auth-alert__icon { color: var(--auth-info); }

/* --- account chip --- */
.auth-account {
    display: flex;
    align-items: center;
    gap: var(--auth-space-3);
    padding: var(--auth-space-3);
    margin-bottom: var(--auth-space-5);
    background: var(--auth-surface-alt);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    min-width: 0;
}
.auth-account__avatar {
    flex: none;
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: var(--auth-text-base);
    font-weight: 700;
    color: var(--auth-on-accent);
    background: var(--auth-accent);
    overflow: hidden;
}
.auth-account__avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-account__who { min-width: 0; }
.auth-account__name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-account__email { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- option list: native radios, checkboxes or buttons styled as rows --- */
.auth-options { display: grid; gap: var(--auth-space-3); }
.auth-options__legend { font-size: var(--auth-text-base); font-weight: 600; margin-bottom: var(--auth-space-3); }
.auth-option { position: relative; display: block; cursor: pointer; }
.auth-option > input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.auth-option__body {
    display: flex;
    align-items: center;
    gap: var(--auth-space-3);
    width: 100%;
    min-height: 56px;
    padding: var(--auth-space-3) var(--auth-space-4);
    text-align: left;
    color: var(--auth-text);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border-strong);
    border-radius: var(--auth-radius-md);
    transition: border-color 0.15s, background-color 0.15s;
}
button.auth-option__body { cursor: pointer; font: inherit; }
a.auth-option__body { text-decoration: none; }
.auth-option:hover .auth-option__body, button.auth-option__body:hover, a.auth-option__body:hover { border-color: var(--auth-input-border); }
.auth-option > input:checked + .auth-option__body, .auth-option__body[aria-current="true"] {
    border-color: var(--auth-accent-text);
    box-shadow: inset 0 0 0 1px var(--auth-accent-text);
    background: var(--auth-accent-soft);
}
.auth-option > input:focus-visible + .auth-option__body { outline: 2px solid var(--auth-focus-color); outline-offset: 2px; }
.auth-option__media { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--auth-radius-sm); background: var(--auth-surface-alt); overflow: hidden; color: var(--auth-text-muted); }
.auth-option__media img { width: 100%; height: 100%; object-fit: contain; }
.auth-option__text { flex: 1; min-width: 0; }
.auth-option__title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.auth-option__desc { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); overflow-wrap: anywhere; }
.auth-badge {
    flex: none;
    display: inline-block;
    padding: 2px var(--auth-space-2);
    font-size: var(--auth-text-xs);
    font-weight: 600;
    border-radius: var(--auth-radius-pill);
    color: var(--auth-text-muted);
    background: var(--auth-surface-alt);
    border: 1px solid var(--auth-border);
}
.auth-badge--accent { color: var(--auth-accent-text); background: var(--auth-accent-soft); border-color: transparent; }
.auth-badge--success { color: var(--auth-success); background: var(--auth-success-soft); border-color: transparent; }
.auth-badge--warning { color: var(--auth-warning); background: var(--auth-warning-soft); border-color: transparent; }

/* --- result: a whole-page outcome --- */
.auth-result { text-align: center; }
.auth-result__icon {
    display: grid; place-items: center;
    width: 56px; height: 56px;
    margin: 0 auto var(--auth-space-5);
    border-radius: 50%;
    color: var(--auth-text-muted);
    background: var(--auth-surface-alt);
}
.auth-result__icon svg { width: 28px; height: 28px; }
.auth-result--success .auth-result__icon { color: var(--auth-success); background: var(--auth-success-soft); }
.auth-result--error .auth-result__icon { color: var(--auth-error); background: var(--auth-error-soft); }
.auth-result .auth-lede { margin-bottom: 0; }
.auth-result .auth-actions { margin-top: var(--auth-space-6); }
.auth-reference { margin-top: var(--auth-space-4); font-size: var(--auth-text-sm); color: var(--auth-text-subtle); }
.auth-reference code { font-family: var(--auth-mono); }

/* --- spinner --- */
.auth-spinner {
    width: 40px; height: 40px;
    margin: var(--auth-space-6) auto;
    border-radius: 50%;
    border: 4px solid var(--auth-border);
    border-top-color: var(--auth-accent-text);
    animation: auth-spin 0.9s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* --- below the card: back to the shop, footer --- */
.auth-back {
    display: flex;
    justify-content: center;
    margin-top: var(--auth-space-5);
    font-size: var(--auth-text-base);
}
.auth-back a { display: inline-flex; align-items: center; gap: var(--auth-space-1); min-height: 44px; color: var(--auth-text-muted); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.auth-back a:hover { color: var(--auth-text); }
.auth-footer {
    margin-top: var(--auth-space-6);
    font-size: var(--auth-text-xs);
    color: var(--auth-text-subtle);
    text-align: center;
}
.auth-footer a { color: inherit; }

/* --- motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .auth-spinner, .auth-btn[aria-busy="true"]::before { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
}

/* =========================================================================================
 * Pages. One section per page, built only from the tokens above.
 * ========================================================================================= */

/* --- page: login --- */
/* The note under "Email me a sign-in code" */
.auth-login__hint {
    margin-top: var(--auth-space-2);
    font-size: var(--auth-text-sm);
    color: var(--auth-text-muted);
    text-align: center;
}
/* "Sign in with a password": a disclosure styled as a link-style action, 44px to tap */
.auth-login__password { margin-top: var(--auth-space-4); }
.auth-login__password > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--auth-space-2);
    min-height: 44px;
    font-size: var(--auth-text-base);
    font-weight: 600;
    color: var(--auth-accent-text);
    text-decoration: underline;
    text-underline-offset: 3px;
    list-style: none;
    cursor: pointer;
}
.auth-login__password > summary::-webkit-details-marker { display: none; }
.auth-login__password > summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}
.auth-login__password[open] > summary { margin-bottom: var(--auth-space-4); }
.auth-login__password[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.auth-login__password > summary:hover { color: var(--auth-text); }
/* A script error under the password field sits where the field's own spacing would be */
.auth-login__password-error:not(:empty) { margin: calc(-1 * var(--auth-space-4)) 0 var(--auth-space-4); }
/* Script messages in confirm mode (a passkey that didn't work) */
.auth-login__live:empty { display: none; }
/* The passkey prompt that opens first in confirm mode; it pulses only while the browser waits */
.auth-login__passkey { text-align: center; }
.auth-login__passkey .auth-lede { margin-bottom: var(--auth-space-2); }
.auth-login__passkey-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: var(--auth-space-2) auto var(--auth-space-5);
    border-radius: 50%;
    color: var(--auth-accent-text);
    background: var(--auth-accent-soft);
    animation: auth-login-pulse 1.8s ease-in-out infinite;
}
.auth-login__passkey-icon svg { width: 30px; height: 30px; }
@keyframes auth-login-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--auth-accent-soft); }
    50% { box-shadow: 0 0 0 10px var(--auth-accent-soft); }
}
.auth-login__stage > .auth-lede { margin-bottom: var(--auth-space-5); }
/* "Want to set up a passkey or a password from the start? Create an account" */
.auth-login__register {
    margin-top: var(--auth-space-6);
    font-size: var(--auth-text-base);
    color: var(--auth-text-muted);
    text-align: center;
}

/* --- page: register --- */
.auth-register__methods { margin-bottom: var(--auth-space-5); }
/* "Sign in instead" under the account-exists alert */
.auth-register__taken {
    margin: calc(-1 * var(--auth-space-3)) 0 var(--auth-space-5);
    font-size: var(--auth-text-base);
}
.auth-register__signin {
    margin-top: var(--auth-space-6);
    font-size: var(--auth-text-base);
    color: var(--auth-text-muted);
    text-align: center;
}

/* --- page: email-code --- */
/* The notes under the lede (how long the code works, claim and passkey notes) sit apart from the code field. */
.auth-email-code__notes { margin-bottom: var(--auth-space-5); }
.auth-email-code__resend { margin-top: var(--auth-space-4); }
.auth-email-code__resend + .auth-actions--links { margin-top: var(--auth-space-1); }

/* --- page: account --- */
/* The account page: one flush card, a head section, then one section per way of signing in. */
.auth-account-page__head .auth-lede { margin-bottom: var(--auth-space-5); }
.auth-account-page__who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--auth-space-3);
}
.auth-account-page__who .auth-account { flex: 1 1 240px; margin-bottom: 0; }
/* The photo, when there is one, covers the initials; if it fails to load it is removed */
.auth-account-page__avatar > * { grid-area: 1 / 1; }
.auth-account-page__avatar img { width: 100%; height: 100%; object-fit: cover; }

.auth-account-page__heading {
    font-size: var(--auth-text-lg);
    font-weight: 700;
    line-height: 1.3;
}
.auth-account-page__desc { font-size: var(--auth-text-base); color: var(--auth-text-muted); margin-top: var(--auth-space-1); }
.auth-account-page__body { margin-top: var(--auth-space-5); }
.auth-account-page__body > .auth-field:last-of-type { margin-bottom: var(--auth-space-4); }

/* A section heading that opens and closes its section (a button inside the h2) */
.auth-account-page__toggle {
    display: flex;
    align-items: center;
    gap: var(--auth-space-3);
    width: 100%;
    min-height: 44px;
    padding: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
}
.auth-account-page__toggle-text { flex: 1; min-width: 0; }
.auth-account-page__toggle-text .auth-account-page__desc { display: block; font-weight: 400; }
.auth-account-page__chevron { flex: none; width: 20px; height: 20px; color: var(--auth-text-muted); transition: transform 0.15s; }
.auth-account-page__toggle[aria-expanded="true"] .auth-account-page__chevron { transform: rotate(180deg); }
.auth-account-page__toggle:hover .auth-account-page__heading { color: var(--auth-accent-text); }

/* The name form: the field and its Save button side by side, stacked on a phone */
.auth-account-page__inline { display: flex; align-items: flex-end; gap: var(--auth-space-3); }
.auth-account-page__inline .auth-field { flex: 1; margin-bottom: 0; min-width: 0; }
.auth-account-page__inline .auth-btn { width: auto; flex: none; }
@media (max-width: 479px) {
    .auth-account-page__inline { flex-direction: column; align-items: stretch; }
    .auth-account-page__inline .auth-btn { width: 100%; }
}

/* Rows: a connected account, a passkey, a shop */
.auth-account-page__rows { list-style: none; margin: var(--auth-space-5) 0 0; padding: 0; display: grid; gap: var(--auth-space-2); }
.auth-account-page__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--auth-space-3);
    padding: var(--auth-space-3) var(--auth-space-4);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
}
.auth-account-page__row-media {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--auth-radius-sm);
    background: var(--auth-surface-alt);
    color: var(--auth-text-muted);
    overflow: hidden;
}
.auth-account-page__row-media svg { width: 18px; height: 18px; }
.auth-account-page__row-media img { width: 24px; height: 24px; object-fit: contain; }
.auth-account-page__row-text { flex: 1 1 160px; min-width: 0; }
.auth-account-page__row-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.auth-account-page__row-desc { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); }
.auth-account-page__row form { margin: 0; }
.auth-account-page__empty { margin-top: var(--auth-space-4); font-size: var(--auth-text-base); color: var(--auth-text-muted); }
.auth-account-page__add { margin-top: var(--auth-space-4); }
/* The live region stays in the page (empty) so screen readers hear the message script puts in it */
.auth-account-page__live:not(:empty) { margin-top: var(--auth-space-4); }
.auth-account-page__live .auth-alert { margin-bottom: 0; }

/* --- page: home --- */
/* The Badger account home: what one account does, then sign in or create an account. */
.auth-home__features { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--auth-space-3); }
.auth-home__feature { display: flex; align-items: flex-start; gap: var(--auth-space-3); font-size: var(--auth-text-base); }
.auth-home__feature svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--auth-accent-text); }

/* --- page: consent --- */
/* The app asking for access: its name (a claim unless Badger made it) and where it returns to */
.auth-consent__app {
    display: flex;
    align-items: flex-start;
    gap: var(--auth-space-3);
    padding: var(--auth-space-3) var(--auth-space-4);
    background: var(--auth-surface-alt);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
}
.auth-consent__app-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--auth-text-muted);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
}
.auth-consent__app-icon svg { width: 20px; height: 20px; }
.auth-consent__app-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--auth-space-1) var(--auth-space-2); }
.auth-consent__app-name { font-weight: 600; overflow-wrap: anywhere; }
.auth-consent__app-meta { flex-basis: 100%; font-size: var(--auth-text-sm); color: var(--auth-text-muted); overflow-wrap: anywhere; }
/* Each part of the grant: the shop or platform, what the app can do, how long */
.auth-consent__section { margin-top: var(--auth-space-6); margin-bottom: 0; }
.auth-consent__hint { margin-top: var(--auth-space-2); }
.auth-consent__label {
    margin-top: var(--auth-space-6);
    margin-bottom: var(--auth-space-2);
    font-size: var(--auth-text-sm);
    color: var(--auth-text-muted);
}

/* --- page: select-shop --- */
.auth-select-shop__label {
    margin-bottom: var(--auth-space-2);
    font-size: var(--auth-text-sm);
    color: var(--auth-text-muted);
}
.auth-select-shop__search { margin-bottom: var(--auth-space-4); }
.auth-select-shop__no-match {
    margin-top: var(--auth-space-3);
    font-size: var(--auth-text-base);
    color: var(--auth-text-muted);
    text-align: center;
}
.auth-select-shop__hint { margin-top: var(--auth-space-3); }

/* --- page: signup --- */
/* Sign-up (templates/auth/signup/*): the sections of the first page, the interval switch, the plan
   rows' prices, the add-ons, the address check and the summary table. Badger skin. */

/* First page: one fieldset per section, its legend styled as .auth-subtitle */
.auth-signup-section { margin-bottom: var(--auth-space-7); }
.auth-signup-section > legend { padding: 0; }

/* The kinds of business, two or more to a row on wide screens */
.auth-signup-kinds { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Monthly / yearly: a segmented switch of native radios */
.auth-signup-interval {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--auth-space-1);
    padding: var(--auth-space-1);
    background: var(--auth-surface-alt);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-pill);
}
.auth-signup-interval__option {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 var(--auth-space-4);
    font-size: var(--auth-text-base);
    font-weight: 600;
    color: var(--auth-text-muted);
    border-radius: var(--auth-radius-pill);
    cursor: pointer;
}
.auth-signup-interval__option input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.auth-signup-interval__option:has(input:checked) {
    color: var(--auth-text);
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow-sm);
}
.auth-signup-interval__option:has(input:focus-visible) {
    outline: 2px solid var(--auth-focus-color);
    outline-offset: 2px;
}

/* Only the chosen interval's prices show (the form carries data-interval) */
.auth-signup-form[data-interval="MONTH"] [data-for-interval="YEAR"],
.auth-signup-form[data-interval="YEAR"] [data-for-interval="MONTH"] { display: none; }

/* A plan row: name, description, badge and facts, with the price on the right */
.auth-signup-plan__badge { display: block; margin-top: var(--auth-space-2); }
.auth-signup-plan__facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--auth-space-1) var(--auth-space-3);
    margin-top: var(--auth-space-2);
    font-size: var(--auth-text-sm);
    color: var(--auth-text-muted);
}
.auth-signup-plan__price { flex: none; text-align: right; }
.auth-signup-plan__price-row { display: block; }
.auth-signup-plan__amount { font-size: var(--auth-text-title); font-weight: 700; line-height: 1.2; }
.auth-signup-plan__was {
    margin-left: var(--auth-space-1);
    font-size: var(--auth-text-base);
    font-weight: 500;
    color: var(--auth-text-muted);
}
.auth-signup-plan__per { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); }
.auth-signup-plan__total { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); }
@media (max-width: 479px) {
    .auth-signup-plan { flex-wrap: wrap; }
    .auth-signup-plan__price { flex-basis: 100%; text-align: left; }
}

/* Extras under the plans */
.auth-signup-extras { margin-top: var(--auth-space-5); }
.auth-signup-addon__price { margin-left: var(--auth-space-1); color: var(--auth-text-muted); }
.auth-signup-addon__desc { display: block; font-size: var(--auth-text-sm); color: var(--auth-text-muted); }
.auth-signup-number { max-width: 160px; }

/* The live address check: words carry the meaning, the colour repeats it */
.auth-signup-address-status { min-height: 20px; }
.auth-signup-address-status[data-state="AVAILABLE"] { color: var(--auth-success); font-weight: 500; }
.auth-signup-address-status[data-state="TAKEN"],
.auth-signup-address-status[data-state="INVALID"] { color: var(--auth-error); font-weight: 500; }

/* Summary: what the owner will pay */
.auth-signup-summary {
    width: 100%;
    margin-bottom: var(--auth-space-6);
    border-collapse: collapse;
    font-size: var(--auth-text-md);
    font-variant-numeric: tabular-nums;
}
.auth-signup-summary th,
.auth-signup-summary td {
    padding: var(--auth-space-3) 0;
    text-align: left;
    font-weight: 400;
    vertical-align: top;
    border-bottom: 1px solid var(--auth-border);
}
.auth-signup-summary td { padding-left: var(--auth-space-4); text-align: right; white-space: nowrap; }
.auth-signup-summary__total th,
.auth-signup-summary__total td { font-weight: 700; border-bottom: 0; }
