:root {
    --traxi-orange: #ff7a00;
    --traxi-orange-hover: #ff8a1f;
    --traxi-black: #0b0b0b;
    --traxi-surface: #161617;
    --traxi-surface-raised: #242426;
    --traxi-white: #ffffff;
    --traxi-text-primary: rgba(255, 255, 255, 1);
    --traxi-text-secondary: rgba(255, 255, 255, 0.72);
    --traxi-text-muted: rgba(255, 255, 255, 0.48);
    --traxi-border: rgba(255, 255, 255, 0.08);
    --traxi-error: #ff453a;
    --traxi-success: #30d158;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    color-scheme: dark;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--traxi-black);
}

body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    color: var(--traxi-text-primary);
    background: var(--traxi-black);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

.auth-page {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    overflow: hidden;
    background:
        radial-gradient(circle at 50% -8%, rgba(255, 122, 0, 0.18), transparent 42%),
        linear-gradient(180deg, #11100f 0%, var(--traxi-black) 38%, #070707 100%);
}

.auth-page::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 62%);
    content: "";
    pointer-events: none;
}

.auth-glow {
    position: absolute;
    z-index: -1;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.08;
    pointer-events: none;
}

.auth-glow--primary {
    top: -180px;
    left: calc(50% - 160px);
    background: var(--traxi-orange);
}

.auth-glow--secondary {
    right: -220px;
    bottom: -180px;
    background: var(--traxi-orange);
}

.auth-shell {
    align-self: center;
    justify-self: center;
    width: min(100%, 420px);
}

.auth-brand {
    display: grid;
    justify-items: center;
    margin-bottom: 24px;
    text-align: center;
}

.auth-logo {
    display: grid;
    min-height: 54px;
    place-items: center;
    margin-bottom: 12px;
}

.auth-logo__image {
    display: none;
    width: auto;
    max-width: 188px;
    height: 54px;
    object-fit: contain;
}

.auth-logo.has-image .auth-logo__image {
    display: block;
}

.auth-logo.has-image .auth-logo__fallback {
    display: none;
}

.auth-logo__fallback {
    color: var(--traxi-white);
    font-family: ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
}

.auth-logo__fallback::after {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--traxi-orange);
    box-shadow: 0 0 18px rgba(255, 122, 0, 0.7);
    content: "";
}

.auth-eyebrow {
    margin: 0;
    color: var(--traxi-orange);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.18em;
    line-height: 1.4;
    text-transform: uppercase;
}

.auth-card {
    padding: 28px;
    border: 1px solid var(--traxi-border);
    border-radius: 24px;
    background: rgba(22, 22, 23, 0.94);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading h1 {
    margin: 0;
    color: var(--traxi-white);
    font-family: ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(30px, 8vw, 38px);
    font-weight: 750;
    letter-spacing: -0.035em;
    line-height: 1.06;
}

.auth-heading p {
    margin: 12px 0 0;
    color: var(--traxi-text-secondary);
    font-size: 15px;
    line-height: 1.5;
}

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 12px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.42;
}

.auth-alert svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.auth-alert--error {
    color: rgba(255, 90, 85, 0.96);
    border-color: rgba(255, 69, 58, 0.35);
    background: rgba(255, 69, 58, 0.12);
}

.auth-alert--success {
    color: rgba(88, 220, 112, 0.96);
    border-color: rgba(48, 209, 88, 0.3);
    background: rgba(48, 209, 88, 0.1);
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-passkey-first {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.auth-divider {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--traxi-text-muted);
    font-size: 12px;
}

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

.auth-identifier-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
}

.auth-identifier-tab {
    min-height: 40px;
    padding: 0 10px;
    color: var(--traxi-text-muted);
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.auth-identifier-tab.is-active {
    color: var(--traxi-white);
    background: rgba(255, 122, 0, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 122, 0, 0.24);
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field label {
    color: var(--traxi-text-secondary);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.auth-phone {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 8px;
}

.auth-phone.is-email {
    grid-template-columns: minmax(0, 1fr);
}

.auth-phone__country {
    position: relative;
    display: flex;
    height: 54px;
    align-items: center;
    justify-content: space-between;
    padding: 0 13px;
    color: var(--traxi-white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: var(--traxi-surface);
    cursor: pointer;
    transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.auth-phone__country:hover {
    border-color: rgba(255, 255, 255, 0.17);
    background: #19191a;
}

.auth-phone__country:focus-within {
    border-color: var(--traxi-orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.14);
}

.auth-phone__country-value {
    overflow: hidden;
    font-size: 15px;
    font-weight: 650;
    white-space: nowrap;
}

.auth-phone__country svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--traxi-text-muted);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.auth-phone__country select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.auth-field__error {
    margin: 0;
    color: rgba(255, 90, 85, 0.96);
    font-size: 12px;
    line-height: 1.4;
}

.auth-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    color: var(--traxi-white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    outline: none;
    background: var(--traxi-surface);
    caret-color: var(--traxi-orange);
    font-size: 16px;
    font-weight: 500;
    transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
    -webkit-appearance: none;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.auth-input:hover {
    border-color: rgba(255, 255, 255, 0.17);
    background: #19191a;
}

.auth-input:focus {
    border-color: var(--traxi-orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.14);
}

.auth-password {
    position: relative;
}

.auth-password .auth-input {
    padding-right: 54px;
}

.auth-password__toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    color: var(--traxi-text-muted);
    border: 0;
    border-radius: 12px;
    outline: 0;
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 200ms ease, background 200ms ease;
}

.auth-password__toggle:hover {
    color: var(--traxi-text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.auth-password__toggle:focus-visible {
    color: var(--traxi-orange);
    box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.28);
}

.auth-password__icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.auth-password__icon--hide,
.auth-password__toggle[aria-pressed="true"] .auth-password__icon--show {
    display: none;
}

.auth-password__toggle[aria-pressed="true"] .auth-password__icon--hide {
    display: block;
}

.auth-submit {
    position: relative;
    display: grid;
    width: 100%;
    height: 56px;
    margin-top: 4px;
    padding: 0 20px;
    place-items: center;
    color: var(--traxi-black);
    border: 0;
    border-radius: 16px;
    outline: 0;
    background: var(--traxi-orange);
    box-shadow: 0 10px 26px rgba(255, 122, 0, 0.2);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background 200ms ease, box-shadow 200ms ease, opacity 200ms ease,
        transform 100ms ease;
}

.auth-submit:hover {
    background: var(--traxi-orange-hover);
    box-shadow: 0 12px 30px rgba(255, 122, 0, 0.26);
}

.auth-submit:focus-visible {
    box-shadow: 0 0 0 3px var(--traxi-black), 0 0 0 6px rgba(255, 122, 0, 0.7);
}

.auth-submit:active {
    transform: scale(0.985);
}

.auth-submit:disabled {
    opacity: 0.58;
    cursor: wait;
}

.auth-submit__loading {
    display: none;
    gap: 9px;
    align-items: center;
}

.auth-submit.is-loading .auth-submit__label {
    display: none;
}

.auth-submit.is-loading .auth-submit__loading {
    display: flex;
}

.auth-help {
    display: flex;
    justify-content: flex-end;
    margin: -8px 0 -4px;
}

.auth-help a,
.auth-footer a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 0 4px;
    color: var(--traxi-orange);
    border-radius: 8px;
    outline: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    text-underline-offset: 4px;
}

.auth-help a:hover,
.auth-footer a:hover {
    color: var(--traxi-orange-hover);
    text-decoration: underline;
}

.auth-help a:focus-visible,
.auth-footer a:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.3);
}

.auth-spinner {
    width: 17px;
    height: 17px;
    border: 2px solid rgba(11, 11, 11, 0.3);
    border-top-color: var(--traxi-black);
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

.auth-footer {
    display: flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    color: var(--traxi-text-muted);
    font-size: 12px;
    font-weight: 550;
}

.auth-footer svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

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

@media (max-width: 520px) {
    .auth-page {
        align-items: center;
        padding-right: 20px;
        padding-left: 20px;
    }

    .auth-brand {
        margin-bottom: 18px;
    }

    .auth-card {
        padding: 24px 4px 8px;
        border-color: transparent;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .auth-heading {
        margin-bottom: 24px;
    }

    .auth-phone {
        grid-template-columns: 104px minmax(0, 1fr);
    }
}

@media (max-height: 680px) and (orientation: portrait) {
    .auth-page {
        align-items: start;
        overflow-y: auto;
    }

    .auth-shell {
        margin: auto 0;
    }

    .auth-brand {
        margin-bottom: 12px;
    }

    .auth-logo {
        min-height: 40px;
        margin-bottom: 8px;
    }

    .auth-logo__image {
        height: 40px;
    }

    .auth-logo__fallback {
        font-size: 26px;
    }

    .auth-heading {
        margin-bottom: 20px;
    }

    .auth-heading h1 {
        font-size: 30px;
    }

    .auth-form {
        gap: 16px;
    }

    .auth-phone {
        grid-template-columns: 104px minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
