/* ==========================================================================
   Alfa Auth — login / sign-in screen
   Standalone layer for the auth pages. Reuses the --alfa-* tokens defined in
   alfa-modern.css and inherits the dark theme from <html data-alfa-theme>.
   Bidirectional: logical properties keep ar (RTL) and en (LTR) in sync.
   ========================================================================== */

/* The auth screen lives inside the dashboard's .dashboard-main-wrapper, which
   the legacy theme pads by 100px/50px and the old login sheet pushed further
   with padding-top:10%. That padding is what produced the dead band above the
   card, and stacking a 100dvh child inside it caused a second scrollbar.
   Strip it back so .alfa-auth is the only thing sizing the page.

   The .alfa-auth-page class is set on <body> by the inline script in the view;
   the :has() selectors are the same rule for engines that support it, so the
   layout is correct before a single line of JS runs. */
.alfa-auth-page,
body:has(.alfa-auth) {
    /* Clips the decorative glows that bleed past the viewport edge. Applied on
       <body> so the page keeps a single scrollbar — see the note on .alfa-auth.
       The legacy theme also leaves a 32px bottom margin on <body>, which is
       pure overflow on a full-height screen. */
    overflow-x: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

.alfa-auth-page .dashboard-main-wrapper,
.dashboard-main-wrapper:has(.alfa-auth) {
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.alfa-auth {
    --auth-field-h: 52px;

    position: relative;
    /* border-box so the 20px padding is counted inside the viewport height —
       otherwise min-height resolves to 100dvh + 40px and the page always
       scrolls by that much even when the card fits. */
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Grid items default to min-width:auto, which refuses to shrink below the
       card's intrinsic width and pushes the page into horizontal overflow on
       narrow screens. */
    grid-template-columns: minmax(0, 1fr);
    row-gap: 20px;
    padding: 20px;
    background: var(--alfa-bg);
    /* Deliberately NOT overflow-x:hidden. Setting one axis forces the other to
       compute as `auto` rather than `visible`, which turned this element into a
       second scroll container nested inside the page's own. The decorative
       glows are clipped on <body> instead. */
}

/* Two soft accent washes behind the card. Purely decorative, and cheap —
   no blur filter, which is what makes gradient backdrops janky on scroll.

   These are anchored flush to the edges rather than hanging off them: a
   negative inset would widen the scrollable area and add a horizontal
   scrollbar. The gradient fades out well before its own bounding box, so
   sitting inside the edge looks identical to bleeding past it. */
.alfa-auth::before,
.alfa-auth::after {
    content: "";
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    /* Never let the decoration drive the layout size */
    max-width: 100%;
}

.alfa-auth::before {
    inset-block-start: -280px;
    inset-inline-end: 0;
    width: min(620px, 100%);
    height: 620px;
    background: radial-gradient(circle at center,
        color-mix(in srgb, var(--alfa-accent) 26%, transparent) 0%,
        transparent 68%);
}

.alfa-auth::after {
    inset-block-end: -320px;
    inset-inline-start: 0;
    width: min(680px, 100%);
    height: 680px;
    background: radial-gradient(circle at center,
        color-mix(in srgb, var(--alfa-accent) 16%, transparent) 0%,
        transparent 68%);
}

[data-alfa-theme="dark"] .alfa-auth::before {
    background: radial-gradient(circle at center,
        color-mix(in srgb, var(--alfa-accent) 32%, transparent) 0%,
        transparent 70%);
}

/* --------------------------------------------------------------------------
   Top bar — language picker and theme toggle
   -------------------------------------------------------------------------- */
.alfa-auth-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 40px;
}

.alfa-auth-topbar .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding-inline: 14px;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius-sm);
    color: var(--alfa-text-muted);
    font-size: .875rem;
    font-weight: 550;
    box-shadow: var(--alfa-shadow-sm);
}

.alfa-auth-topbar .dropdown-toggle:hover,
.alfa-auth-topbar .dropdown-toggle:focus {
    background: var(--alfa-surface-2);
    color: var(--alfa-text);
    border-color: var(--alfa-border-strong);
}

.alfa-auth-topbar .dropdown-menu {
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius);
    box-shadow: var(--alfa-shadow-lg);
    padding: 6px;
    min-width: 190px;
}

.alfa-auth-topbar .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--alfa-radius-sm);
    padding: 8px 10px;
    color: var(--alfa-text);
    font-size: .875rem;
}

.alfa-auth-topbar .dropdown-item:hover,
.alfa-auth-topbar .dropdown-item:focus {
    background: var(--alfa-surface-2);
    color: var(--alfa-text);
}

/* The shared theme toggle only mounts itself into the dashboard topbar, so the
   auth screen ships its own button with the same visual language. */
.alfa-auth-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius-sm);
    color: var(--alfa-text-muted);
    cursor: pointer;
    box-shadow: var(--alfa-shadow-sm);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.alfa-auth-theme:hover {
    background: var(--alfa-surface-2);
    color: var(--alfa-text);
    border-color: var(--alfa-border-strong);
}

.alfa-auth-theme .alfa-icon-sun { display: none; }
[data-alfa-theme="dark"] .alfa-auth-theme .alfa-icon-moon { display: none; }
[data-alfa-theme="dark"] .alfa-auth-theme .alfa-icon-sun { display: inline; }

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.alfa-auth-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    /* No vertical padding: the 1fr grid row already absorbs the leftover height
       and centres the card, so padding here is added on top of the row and
       pushes the page past the viewport. Breathing room when the card is taller
       than the screen comes from the row gap below. */
    min-height: 0;
}

.alfa-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius-lg);
    box-shadow: var(--alfa-shadow-lg);
    padding: 40px;
}

.alfa-auth-brand {
    display: flex;
    justify-content: center;
    margin-block-end: 26px;
}

.alfa-auth-brand img {
    max-height: 46px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
}

.alfa-auth-head {
    text-align: center;
    margin-block-end: 28px;
}

.alfa-auth-title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 650;
    color: var(--alfa-text);
    letter-spacing: -0.02em;
}

[dir="rtl"] .alfa-auth-title { letter-spacing: 0; }

.alfa-auth-subtitle {
    margin: 0;
    font-size: .9375rem;
    color: var(--alfa-text-muted);
}

/* --------------------------------------------------------------------------
   Fields — floating label pattern
   -------------------------------------------------------------------------- */
.alfa-field {
    position: relative;
    margin-block-end: 18px;
}

/* The label starts centred over the input and rises into the border once the
   field holds a value or takes focus. :placeholder-shown is what detects
   "empty", so every input below carries placeholder=" ". */
.alfa-field > .form-control,
.alfa-field > input,
.alfa-field > textarea {
    width: 100%;
    height: var(--auth-field-h) !important;
    padding-block: 18px 6px;
    padding-inline: 46px 14px;
    background: var(--alfa-surface) !important;
    border: 1px solid var(--alfa-border) !important;
    border-radius: var(--alfa-radius) !important;
    color: var(--alfa-text) !important;
    font-size: .9375rem;
    line-height: 1.3;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.alfa-field.has-toggle > input {
    padding-inline-end: 48px;
}

/* Anchored to the top edge and moved with inset-block-start rather than a
   percentage translate: a translate would be relative to the label's own
   height, which changes as the font shrinks. Animating font-size also avoids
   transform-origin, whose logical keywords are not supported. */
.alfa-field > label {
    position: absolute;
    inset-block-start: 16px;
    inset-inline-start: 47px;
    margin: 0;
    color: var(--alfa-text-subtle);
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.3;
    pointer-events: none;
    transition: inset-block-start .15s ease, font-size .15s ease, color .15s ease;
}

.alfa-field > .form-control:focus,
.alfa-field > input:focus,
.alfa-field > textarea:focus {
    border-color: var(--alfa-accent) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--alfa-accent) 14%, transparent) !important;
    outline: none;
}

.alfa-field > input:focus + label,
.alfa-field > input:not(:placeholder-shown) + label {
    inset-block-start: 7px;
    font-size: .6875rem;
    font-weight: 500;
    color: var(--alfa-text-muted);
}

.alfa-field > input:focus + label {
    color: var(--alfa-accent);
}

/* Leading icon */
.alfa-field-icon {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 0;
    width: 46px;
    transform: translateY(-50%);
    text-align: center;
    color: var(--alfa-text-subtle);
    font-size: .9375rem;
    pointer-events: none;
    transition: color .15s ease;
}

.alfa-field > input:focus ~ .alfa-field-icon {
    color: var(--alfa-accent);
}

/* Password reveal */
.alfa-field-toggle {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 6px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--alfa-radius-sm);
    color: var(--alfa-text-subtle);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.alfa-field-toggle:hover {
    background: var(--alfa-surface-2);
    color: var(--alfa-text);
}

.alfa-field-toggle:focus-visible {
    outline: 2px solid var(--alfa-accent);
    outline-offset: 2px;
}

/* Chrome paints autofilled inputs a hard yellow that ignores background-color.
   An inset shadow the size of the field is the only reliable repaint. */
.alfa-field > input:-webkit-autofill,
.alfa-field > input:-webkit-autofill:hover,
.alfa-field > input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--alfa-text);
    -webkit-box-shadow: 0 0 0 1000px var(--alfa-surface) inset;
    box-shadow: 0 0 0 1000px var(--alfa-surface) inset;
    caret-color: var(--alfa-text);
    transition: background-color 9999s ease-in-out 0s;
}

/* Invalid state */
.alfa-field.is-invalid > input,
.alfa-field.is-invalid > textarea,
.alfa-field > input.is-invalid {
    border-color: var(--alfa-danger) !important;
}

.alfa-field.is-invalid > input:focus,
.alfa-field.is-invalid > textarea:focus,
.alfa-field > input.is-invalid:focus {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--alfa-danger) 14%, transparent) !important;
}

.alfa-field.is-invalid .alfa-field-icon {
    color: var(--alfa-danger);
}

.alfa-field-error {
    display: block;
    margin-block-start: 6px;
    padding-inline-start: 2px;
    color: var(--alfa-danger);
    font-size: .8125rem;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Options row
   -------------------------------------------------------------------------- */
.alfa-auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-block: 4px 22px;
}

.alfa-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--alfa-text-muted);
    font-size: .875rem;
    font-weight: 450;
    cursor: pointer;
    user-select: none;
}

.alfa-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border-strong);
    border-radius: 5px;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.alfa-check input[type="checkbox"]:checked {
    background-color: var(--alfa-accent);
    border-color: var(--alfa-accent);
    /* Tick drawn as a background image so it needs no extra element */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
}

.alfa-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--alfa-accent);
    outline-offset: 2px;
}

.alfa-link {
    color: var(--alfa-accent);
    font-size: .875rem;
    font-weight: 550;
}

.alfa-link:hover {
    color: var(--alfa-accent);
    text-decoration: underline;
}

/* A link that has to be a <button> because it posts a form — the OTP resend.
   Strips the button chrome so it reads as the anchor beside it. */
button.alfa-link {
    padding: 0;
    background: none;
    border: 0;
    /* Buttons do not inherit the page font on their own */
    font-family: inherit;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Submit
   -------------------------------------------------------------------------- */
.alfa-auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 50px;
    background: var(--alfa-accent) !important;
    border: 1px solid var(--alfa-accent) !important;
    border-radius: var(--alfa-radius) !important;
    color: var(--alfa-accent-contrast) !important;
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
    transition: filter .15s ease, transform .1s ease, box-shadow .15s ease;
}

/* The status screens use an anchor for the same button — Bootstrap 5 underlines
   links by default, which would strike through the label. */
a.alfa-auth-submit,
a.alfa-auth-submit:hover {
    text-decoration: none;
}

.alfa-auth-submit:hover {
    filter: brightness(.93);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--alfa-accent) 32%, transparent);
}

.alfa-auth-submit:active {
    transform: translateY(1px);
}

.alfa-auth-submit:focus-visible {
    outline: 2px solid var(--alfa-accent);
    outline-offset: 2px;
}

.alfa-auth-submit[disabled] {
    opacity: .72;
    cursor: default;
    filter: none;
    transform: none;
}

/* Only visible once the form is submitting */
.alfa-auth-submit .alfa-spinner { display: none; }
.alfa-auth-submit.is-loading .alfa-spinner { display: inline-block; }

.alfa-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in srgb, var(--alfa-accent-contrast) 35%, transparent);
    border-top-color: var(--alfa-accent-contrast);
    border-radius: 50%;
    animation: alfa-spin .6s linear infinite;
}

@keyframes alfa-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Divider + social / demo buttons
   -------------------------------------------------------------------------- */
.alfa-auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-block: 26px;
    color: var(--alfa-text-subtle);
    font-size: .75rem;
    font-weight: 550;
    text-transform: uppercase;
    letter-spacing: .06em;
}

[dir="rtl"] .alfa-auth-divider {
    letter-spacing: 0;
    text-transform: none;
}

.alfa-auth-divider::before,
.alfa-auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--alfa-border);
}

.alfa-auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.alfa-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 46px;
    padding-inline: 14px;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius);
    color: var(--alfa-text);
    font-size: .875rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.alfa-social-btn:hover {
    background: var(--alfa-surface-2);
    border-color: var(--alfa-border-strong);
    color: var(--alfa-text);
}

.alfa-social-btn .fa-facebook,
.alfa-social-btn .fa-facebook-f { color: #1877f2; }
.alfa-social-btn .fa-google { color: #ea4335; }

.alfa-auth-demo-label {
    margin-block: 22px 10px;
    color: var(--alfa-text-subtle);
    font-size: .75rem;
    font-weight: 550;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .06em;
}

[dir="rtl"] .alfa-auth-demo-label {
    letter-spacing: 0;
    text-transform: none;
}

/* --------------------------------------------------------------------------
   Card footer
   -------------------------------------------------------------------------- */
.alfa-auth-foot {
    margin-block-start: 26px;
    padding-block-start: 20px;
    border-block-start: 1px solid var(--alfa-border);
    text-align: center;
    color: var(--alfa-text-muted);
    font-size: .875rem;
}

.alfa-auth-page-foot {
    position: relative;
    z-index: 1;
    padding-block: 8px;
    color: var(--alfa-text-subtle);
    font-size: .8125rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Sign-up variants
   --------------------------------------------------------------------------
   The registration screens reuse the login card wholesale — same floating
   fields, same submit, same footer. All they add is a wider shell, a
   two-column row, group captions, and textarea / file variants of
   .alfa-field, so the two pages stay one design instead of two.
   -------------------------------------------------------------------------- */
.alfa-auth-card--wide {
    max-width: 620px;
}

/* Two fields sharing a line. Column gap only: .alfa-field already carries its
   own bottom margin, so a row-gap would double the spacing once this collapses
   to a single column. */
.alfa-auth-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
}

/* Group caption with a rule running out to the card edge — enough to break a
   long form into scannable blocks without the weight of a second heading. */
.alfa-auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-block: 0 18px;
    color: var(--alfa-text-subtle);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.alfa-auth-section + * { margin-block-start: 0; }

.alfa-auth-section:not(:first-of-type) {
    margin-block-start: 10px;
}

.alfa-auth-section::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--alfa-border);
}

[dir="rtl"] .alfa-auth-section {
    letter-spacing: 0;
    text-transform: none;
}

/* Textarea. The base rule pins .form-control to the field height with
   !important, so the override has to name the element to win. */
.alfa-field > textarea,
.alfa-field > textarea.form-control {
    height: auto !important;
    min-height: 92px;
    padding-block: 22px 10px;
    resize: vertical;
}

/* :placeholder-shown applies to textarea too, so the floating label needs no
   new mechanism — only the same rules with the element added. */
.alfa-field > textarea:focus + label,
.alfa-field > textarea:not(:placeholder-shown) + label {
    inset-block-start: 7px;
    font-size: .6875rem;
    font-weight: 500;
    color: var(--alfa-text-muted);
}

.alfa-field > textarea:focus + label { color: var(--alfa-accent); }
.alfa-field > textarea:focus ~ .alfa-field-icon { color: var(--alfa-accent); }

/* A textarea is several lines tall, so a vertically centred label and icon
   would float in the middle of an empty box — pin both to the first line. */
.alfa-field--area > label { inset-block-start: 21px; }

.alfa-field--area .alfa-field-icon {
    inset-block-start: 26px;
    transform: none;
}

/* Static label for controls that cannot float one: the file widget has no
   placeholder to key off, and its own title line shows the chosen filename. */
.alfa-field-label {
    display: block;
    margin-block-end: 7px;
    color: var(--alfa-text-muted);
    font-size: .8125rem;
    font-weight: 550;
}

.alfa-field-hint {
    display: block;
    margin-block-start: 6px;
    padding-inline-start: 2px;
    color: var(--alfa-text-subtle);
    font-size: .78rem;
}

/* Document uploads. The widget itself is shared (alfa-modern.css §25) — this
   is only the spacing and error text the auth card adds around it. */
.alfa-upload-field {
    margin-block-end: 16px;
}

.alfa-upload-field:last-of-type {
    margin-block-end: 4px;
}

/* Consent row. It wraps to two or three lines, so it cannot use the centred
   inline .alfa-check from the login options row. */
.alfa-check--block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-block: 18px 20px;
    font-size: .875rem;
    line-height: 1.55;
}

.alfa-check--block input[type="checkbox"] {
    margin-block-start: 2px;
}

.alfa-check--block a {
    color: var(--alfa-accent);
    font-weight: 550;
}

/* --------------------------------------------------------------------------
   Status screens — OTP / pending approval
   -------------------------------------------------------------------------- */
.alfa-auth-status {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--alfa-accent) 12%, transparent);
    color: var(--alfa-accent);
    font-size: 1.5rem;
}

.alfa-auth-status--pending {
    background: color-mix(in srgb, var(--alfa-warning) 14%, transparent);
    color: var(--alfa-warning);
}

/* Inline alert inside the card, matching the field language rather than
   Bootstrap's. */
.alfa-auth-note {
    margin-block-end: 20px;
    padding: 11px 14px;
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius);
    background: var(--alfa-surface-2);
    color: var(--alfa-text-muted);
    font-size: .875rem;
    text-align: center;
}

.alfa-auth-note--ok {
    border-color: color-mix(in srgb, var(--alfa-success) 40%, transparent);
    background: color-mix(in srgb, var(--alfa-success) 10%, transparent);
    color: var(--alfa-text);
}

.alfa-auth-note--warn {
    border-color: color-mix(in srgb, var(--alfa-danger) 40%, transparent);
    background: color-mix(in srgb, var(--alfa-danger) 10%, transparent);
    color: var(--alfa-text);
}

/* Resend row. Deliberately not .alfa-auth-foot: it sits directly above the
   real footer, and two of those would draw two divider rules. */
.alfa-auth-resend {
    margin-block-start: 20px;
    color: var(--alfa-text-muted);
    font-size: .875rem;
    text-align: center;
}

/* The masked phone number the OTP was sent to */
.alfa-auth-strong {
    display: block;
    margin-block-start: 6px;
    color: var(--alfa-text);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .04em;
}

/* --------------------------------------------------------------------------
   Choice cards — a radio group presented as selectable tiles, for a decision
   the user makes once and that changes the rest of the form (account type).
   Deliberately reuses the .alfa-field border, radius and focus ring so the
   tiles read as part of the same form rather than a foreign component.
   -------------------------------------------------------------------------- */
.alfa-choice-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-block-end: 18px;
}

.alfa-choice {
    display: block;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

/* The native radio stays in the accessibility tree and keeps keyboard
   behaviour; it is the tile that is painted. */
.alfa-choice input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.alfa-choice__body {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 14px;
    background: var(--alfa-surface);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius);
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.alfa-choice:hover .alfa-choice__body {
    border-color: var(--alfa-border-strong);
}

/* Same accent ring the inputs use on focus, so selection reads consistently. */
.alfa-choice input[type="radio"]:checked + .alfa-choice__body {
    border-color: var(--alfa-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--alfa-accent) 14%, transparent);
}

.alfa-choice input[type="radio"]:focus-visible + .alfa-choice__body {
    outline: 2px solid var(--alfa-accent);
    outline-offset: 2px;
}

.alfa-choice__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--alfa-text-muted);
    background: var(--alfa-surface-2);
    border-radius: 50%;
    font-size: .9375rem;
    transition: color .15s ease;
}

.alfa-choice input[type="radio"]:checked + .alfa-choice__body .alfa-choice__icon {
    color: var(--alfa-accent);
}

.alfa-choice__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.alfa-choice__title {
    color: var(--alfa-text);
    font-size: .9375rem;
    font-weight: 550;
}

.alfa-choice__hint {
    color: var(--alfa-text-muted);
    font-size: .75rem;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Stepped form — the four-step driver sign-up. One <form>, four sections
   toggled with [hidden]; only the last step posts, so nothing partial is ever
   stored server-side.
   -------------------------------------------------------------------------- */
.alfa-steps-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-block-end: 14px;
}

.alfa-steps-count {
    color: var(--alfa-text-muted);
    font-size: .8125rem;
}

/* Segments rather than one filling bar: the step count is small and fixed, and
   discrete segments say "4 steps" at a glance where a percentage does not. */
.alfa-steps-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
    margin-block-end: 22px;
}

.alfa-steps-seg {
    height: 3px;
    background: var(--alfa-border);
    border-radius: 2px;
    transition: background-color .2s ease;
}

.alfa-steps-seg.is-done {
    background: var(--alfa-accent);
}

.alfa-step-note {
    margin: 0 0 18px;
    color: var(--alfa-text-muted);
    font-size: .8125rem;
    line-height: 1.5;
}

.alfa-steps-nav {
    display: flex;
    gap: 10px;
    margin-block-start: 6px;
}

/* Both nav buttons share .alfa-auth-submit for height and radius; the ghost
   modifier only swaps the fill so Back reads as secondary to Next. */
.alfa-steps-nav .alfa-auth-submit {
    margin-block-start: 0;
}

.alfa-auth-submit--ghost {
    flex: 0 0 auto;
    min-width: 96px;
    color: var(--alfa-text);
    background: var(--alfa-surface-2);
    border: 1px solid var(--alfa-border);
}

.alfa-auth-submit--ghost:hover {
    border-color: var(--alfa-border-strong);
}

/* [hidden] must win over the display the buttons and sections set themselves. */
.alfa-step[hidden],
.alfa-steps-nav .alfa-auth-submit[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Approval stages — the post-submit screen's three-item progress list.
   -------------------------------------------------------------------------- */
.alfa-stages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 22px 0;
    padding: 18px;
    text-align: start;
    background: var(--alfa-surface-2);
    border: 1px solid var(--alfa-border);
    border-radius: var(--alfa-radius);
}

.alfa-stage {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--alfa-text-muted);
    font-size: .875rem;
}

.alfa-stage__dot {
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--alfa-border-strong);
    border-radius: 50%;
    font-size: .625rem;
}

.alfa-stage.is-done {
    color: var(--alfa-text);
    font-weight: 550;
}

.alfa-stage.is-done .alfa-stage__dot {
    color: var(--alfa-bg);
    background: var(--alfa-accent);
    border-color: var(--alfa-accent);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
    .alfa-auth { padding: 14px; }

    .alfa-auth-card {
        padding: 28px 20px;
        border-radius: var(--alfa-radius);
    }

    .alfa-auth-title { font-size: 1.3125rem; }
    .alfa-auth-grid { grid-template-columns: 1fr; }
    .alfa-auth-row { grid-template-columns: minmax(0, 1fr); }
    .alfa-choice-group { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .alfa-auth *,
    .alfa-auth *::before,
    .alfa-auth *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
