:root {
    --auth-primary: #3157d5;
    --auth-primary-dark: #2544b2;
    --auth-primary-soft: #edf0ff;
    --auth-ink: #17233e;
    --auth-muted: #687268;
    --auth-canvas: #f4f5f0;
    --auth-surface: #ffffff;
    --auth-border: #dce1da;
    --auth-success: #14866d;
    --auth-success-soft: #eaf8f3;
    --auth-danger: #bd4650;
    --auth-danger-soft: #fff0f1;
    --auth-radius: 18px;
    --auth-radius-sm: 11px;
    --auth-ring: 0 0 0 4px rgba(49, 87, 213, 0.13);
    --auth-shadow: 0 30px 80px -42px rgba(23, 35, 62, 0.48);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.auth-body {
    margin: 0;
    overflow-x: hidden;
    background: var(--auth-canvas);
    color: var(--auth-ink);
    font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    font-variant-numeric: tabular-nums lining-nums;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-page {
    display: grid;
    min-height: 100dvh;
    grid-template-columns: minmax(390px, 0.88fr) minmax(540px, 1.12fr);
}

/* Product story */
.auth-story {
    position: relative;
    display: flex;
    min-height: calc(100dvh - 28px);
    margin: 14px;
    padding: clamp(30px, 4vw, 64px);
    flex-direction: column;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(circle at 12% 86%, rgba(168, 230, 207, 0.18), transparent 22rem),
        radial-gradient(circle at 96% 8%, rgba(101, 127, 226, 0.34), transparent 24rem),
        var(--auth-ink);
    color: #fff;
}

.auth-story::before {
    position: absolute;
    right: -180px;
    bottom: -150px;
    width: 430px;
    height: 430px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 44% 56% 63% 37%;
    box-shadow:
        0 0 0 42px rgba(255, 255, 255, 0.018),
        0 0 0 84px rgba(255, 255, 255, 0.014);
    content: "";
    transform: rotate(22deg);
}

.auth-story::after {
    position: absolute;
    top: 24%;
    right: 8%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a8e6cf;
    box-shadow:
        -92px -72px 0 2px rgba(168, 230, 207, 0.24),
        54px 118px 0 1px rgba(255, 255, 255, 0.24),
        -150px 196px 0 0 rgba(255, 255, 255, 0.18);
    content: "";
}

.auth-story-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 11px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.015em;
    text-decoration: none;
}

.auth-story-brand:hover {
    color: #fff;
}

.auth-story-logo,
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.auth-story-logo {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.14);
}

.auth-story-content {
    position: relative;
    z-index: 1;
    width: min(100%, 550px);
    margin: auto 0;
    padding: 56px 0;
}

.auth-story-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    color: #a8e6cf;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-story-eyebrow::before {
    width: 22px;
    height: 1px;
    background: currentColor;
    content: "";
}

.auth-story h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(38px, 4.4vw, 66px);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.06;
}

.auth-story-content > p {
    max-width: 510px;
    margin: 26px 0 0;
    color: rgba(255, 255, 255, 0.67);
    font-size: clamp(14px, 1.3vw, 17px);
    line-height: 1.75;
}

.auth-benefits {
    display: grid;
    gap: 12px;
    margin-top: 36px;
}

.auth-benefit {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255, 255, 255, 0.83);
    font-size: 14px;
    font-weight: 600;
}

.auth-benefit i {
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(168, 230, 207, 0.25);
    border-radius: 50%;
    background: rgba(168, 230, 207, 0.1);
    color: #a8e6cf;
    font-size: 14px;
}

.auth-story-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 12px;
    font-weight: 600;
}

.auth-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a8e6cf;
    box-shadow: 0 0 0 4px rgba(168, 230, 207, 0.1);
}

/* Form panel */
.auth-panel {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.auth-card-wrap {
    width: 100%;
    max-width: var(--card-width, 460px);
    animation: authEnter 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes authEnter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-brand {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    color: var(--auth-ink);
    text-decoration: none;
}

.auth-brand:hover {
    color: var(--auth-ink);
}

.auth-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    background: var(--auth-ink);
    color: #fff;
    font-size: 18px;
}

.auth-wordmark,
.auth-tagline {
    display: block;
}

.auth-wordmark {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.15;
}

.auth-tagline {
    margin-top: 2px;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 600;
}

.auth-card {
    position: relative;
    padding: 34px;
    border: 1px solid var(--auth-border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--auth-shadow), inset 0 1px rgba(255, 255, 255, 0.8);
}

.auth-context-icon {
    display: flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    border-radius: 13px;
    background: var(--auth-primary-soft);
    color: var(--auth-primary);
    font-size: 18px;
}

.auth-title {
    margin: 0 0 7px;
    color: var(--auth-ink);
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.auth-subtitle,
.auth-info {
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.65;
}

.auth-subtitle {
    margin: 0 0 26px;
}

.auth-info {
    margin: 0 0 24px;
    text-align: center;
}

.auth-info .highlight {
    color: var(--auth-primary-dark);
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    color: #38443b;
    font-size: 14px;
    font-weight: 700;
}

.form-label .req {
    margin-left: 2px;
    color: var(--auth-danger);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    color: #929b92;
    font-size: 15px;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color 160ms ease;
}

.input-wrapper:focus-within .input-icon {
    color: var(--auth-primary);
}

.has-icon .form-control {
    padding-left: 42px;
}

.has-icon .form-control:has(+ .input-toggle),
.has-icon .form-control:has(~ .input-toggle) {
    padding-right: 44px;
}

.input-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 2;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #89938a;
    cursor: pointer;
    transform: translateY(-50%);
}

.input-toggle:hover {
    background: var(--auth-primary-soft);
    color: var(--auth-primary);
}

.form-control,
.form-select {
    width: 100%;
    min-height: 45px;
    padding: 11px 13px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #fff;
    color: var(--auth-ink);
    font-size: 15px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-control::placeholder {
    color: #a1aaa2;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--auth-primary);
    outline: 0;
    background: #fdfdff;
    box-shadow: var(--auth-ring);
}

.form-control-lg {
    min-height: 49px;
    padding: 13px 14px;
    font-size: 14px;
}

textarea.form-control {
    min-height: 76px;
    resize: vertical;
}

.input-group-text {
    border-color: var(--auth-border);
    background: #f7f8f5;
    color: var(--auth-muted);
    font-size: 14px;
}

.field-validation-error {
    display: block;
    margin-top: 5px;
    color: var(--auth-danger);
    font-size: 12px;
    font-weight: 600;
}

.field-validation-valid,
.validation-summary-valid {
    display: none;
}

/* Actions */
.btn-auth,
.btn-outline {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--auth-radius-sm);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.btn-auth {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--auth-primary);
    background: var(--auth-primary);
    color: #fff;
    box-shadow: 0 12px 24px -17px rgba(49, 87, 213, 0.95);
}

.btn-auth:hover {
    transform: translateY(-1px);
    border-color: var(--auth-primary-dark);
    background: var(--auth-primary-dark);
    color: #fff;
    box-shadow: 0 16px 30px -18px rgba(49, 87, 213, 0.95);
}

.btn-auth:active,
.btn-outline:active {
    transform: translateY(0);
}

.btn-auth:focus-visible,
.btn-outline:focus-visible,
.btn-link:focus-visible,
.link-muted:focus-visible {
    outline: 3px solid rgba(49, 87, 213, 0.2);
    outline-offset: 2px;
}

.btn-auth:disabled {
    transform: none;
    opacity: 0.65;
    cursor: wait;
    box-shadow: none;
}

.btn-outline {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--auth-border);
    background: #fff;
    color: var(--auth-primary-dark);
}

.btn-outline:hover {
    border-color: #bec8ec;
    background: var(--auth-primary-soft);
    color: var(--auth-primary-dark);
}

.btn-link,
.link-muted {
    border: 0;
    background: transparent;
    color: var(--auth-primary-dark);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.btn-link:hover,
.link-muted:hover {
    color: var(--auth-primary);
    text-decoration: underline;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #475148;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

/* Messages */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 18px;
    padding: 11px 13px;
    border-radius: var(--auth-radius-sm);
    font-size: 13px;
    line-height: 1.55;
}

.alert i {
    margin-top: 1px;
    flex-shrink: 0;
    font-size: 14px;
}

.alert-danger {
    border: 1px solid #f3c8cb;
    background: var(--auth-danger-soft);
    color: #8f3038;
}

.alert-success {
    border: 1px solid #c2e7db;
    background: var(--auth-success-soft);
    color: #116450;
}

.alert-info {
    border: 1px solid #ccd5f5;
    background: var(--auth-primary-soft);
    color: var(--auth-primary-dark);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 21px 0;
    color: #9aa39b;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

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

.new-client-link {
    margin: 18px 0 0;
    color: var(--auth-muted);
    font-size: 11.5px;
    text-align: center;
}

.new-client-link a {
    color: var(--auth-primary-dark);
    font-weight: 800;
    text-decoration: none;
}

.new-client-link a:hover {
    color: var(--auth-primary);
    text-decoration: underline;
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 18px;
    color: #7c867d;
    font-size: 9.5px;
    line-height: 1.5;
    text-align: center;
}

.auth-footer a {
    color: #566158;
    font-weight: 700;
    text-decoration: none;
}

.auth-footer a:hover {
    color: var(--auth-primary);
}

/* Verification and password tools */
.otp-boxes {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.otp-box {
    width: 46px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    background: #fff;
    color: var(--auth-ink);
    font-size: 19px;
    font-weight: 800;
    text-align: center;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.otp-box:focus {
    transform: translateY(-2px);
    border-color: var(--auth-primary);
    outline: 0;
    box-shadow: var(--auth-ring);
}

.otp-box.filled {
    border-color: #bfc9ee;
    background: var(--auth-primary-soft);
    color: var(--auth-primary-dark);
}

.resend-row {
    margin-top: 14px;
    color: var(--auth-muted);
    font-size: 10.5px;
    text-align: center;
}

.resend-row button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--auth-primary-dark);
    font-size: inherit;
    font-weight: 800;
    cursor: pointer;
}

.resend-row button:disabled {
    color: #9aa39b;
    cursor: not-allowed;
}

.strength-track {
    height: 5px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--auth-border);
}

.strength-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 200ms ease, background 200ms ease;
}

.strength-label {
    margin-top: 5px;
    color: var(--auth-muted);
    font-size: 10px;
}

.pw-rules {
    display: grid;
    gap: 4px;
    margin: 9px 0 0;
    padding: 0;
    list-style: none;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--auth-muted);
    font-size: 10px;
}

.pw-rules li i {
    color: #bbc3bb;
    font-size: 11px;
}

.pw-rules li.met,
.pw-rules li.met i {
    color: var(--auth-success);
}

/* Onboarding and terms */
.section-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 20px 0 13px;
}

.section-header .step {
    display: flex;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--auth-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.section-header h5 {
    margin: 0;
    color: var(--auth-ink);
    font-size: 13px;
    font-weight: 800;
}

.section-header .step-line {
    height: 1px;
    flex: 1;
    background: var(--auth-border);
}

.info-panel {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 17px;
    padding: 13px 14px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #f8f9f6;
}

.info-panel i {
    flex-shrink: 0;
    color: var(--auth-primary);
    font-size: 18px;
}

.info-panel h6 {
    margin: 0 0 3px;
    color: var(--auth-ink);
    font-size: 11.5px;
    font-weight: 800;
}

.info-panel p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.welcome-notice {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #c2e7db;
    border-radius: var(--auth-radius-sm);
    background: var(--auth-success-soft);
    text-align: center;
}

.welcome-notice h3 {
    margin: 0 0 5px;
    color: var(--auth-ink);
    font-size: 13px;
    font-weight: 800;
}

.welcome-notice p {
    margin: 0 0 9px;
    color: #38665a;
    font-size: 10.5px;
    line-height: 1.55;
}

.welcome-notice .actions {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 7px;
}

.terms-body {
    max-height: 48vh;
    padding: 4px 12px 4px 0;
    overflow-y: auto;
    color: #465047;
    font-size: 11px;
    line-height: 1.7;
    scrollbar-color: #c8cec8 transparent;
    scrollbar-width: thin;
}

.terms-body h4 {
    margin: 17px 0 5px;
    color: var(--auth-ink);
    font-size: 12px;
    font-weight: 800;
}

.terms-body h4:first-child {
    margin-top: 0;
}

.terms-body ul {
    padding-left: 18px;
}

.terms-body li {
    margin: 3px 0;
}

.terms-body em {
    color: var(--auth-primary-dark);
}

.onboard-progress {
    margin-bottom: 18px;
}

.onboard-progress-bar {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--auth-border);
}

.onboard-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--auth-primary);
    transition: width 250ms ease;
}

.onboard-progress-label {
    margin-top: 6px;
    color: var(--auth-muted);
    font-size: 9.5px;
    font-weight: 700;
    text-align: center;
}

.onboard-step[hidden] {
    display: none;
}

.onboard-step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: var(--auth-ink);
    font-size: 12px;
    font-weight: 800;
}

.onboard-step-title i {
    color: var(--auth-primary);
    font-size: 14px;
}

.onboard-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #475148;
    font-size: 11px;
    cursor: pointer;
}

.onboard-switch input {
    width: 17px;
    height: 17px;
    accent-color: var(--auth-primary);
}

.onboard-nav {
    display: flex;
    gap: 9px;
    margin-top: 19px;
}

.onboard-nav .btn-outline {
    width: auto;
    flex: 0 0 auto;
    padding-right: 18px;
    padding-left: 18px;
}

.onboard-nav .btn-auth {
    flex: 1;
}

.onboard-nav [hidden] {
    display: none !important;
}

@media (max-width: 1199.98px) {
    .auth-page {
        grid-template-columns: minmax(360px, 0.78fr) minmax(500px, 1.22fr);
    }

    .auth-story {
        padding: 40px;
    }

    .auth-story h1 {
        font-size: clamp(36px, 4vw, 50px);
    }
}

@media (max-width: 991.98px) {
    .auth-page {
        display: block;
    }

    .auth-story {
        display: none;
    }

    .auth-panel {
        min-height: 100dvh;
        padding: 42px 22px;
        background:
            radial-gradient(circle at 100% 0, rgba(49, 87, 213, 0.09), transparent 22rem),
            radial-gradient(circle at 0 100%, rgba(168, 230, 207, 0.12), transparent 20rem),
            var(--auth-canvas);
    }

    .auth-brand {
        display: inline-flex;
    }
}

@media (max-width: 575.98px) {
    .auth-panel {
        align-items: flex-start;
        padding: 26px 14px;
    }

    .auth-brand {
        margin: 0 4px 20px;
    }

    .auth-card {
        padding: 25px 20px;
        border-radius: 18px;
    }

    .auth-context-icon {
        width: 39px;
        height: 39px;
        margin-bottom: 15px;
        font-size: 16px;
    }

    .auth-title {
        font-size: 21px;
    }

    .auth-footer {
        flex-wrap: wrap;
        padding: 0 10px;
    }
}

@media (max-width: 419.98px) {
    .otp-boxes {
        gap: 6px;
    }

    .otp-box {
        width: 40px;
        height: 48px;
        font-size: 17px;
    }

    .auth-footer-separator {
        display: none;
    }

    .auth-footer span,
    .auth-footer a {
        flex-basis: 100%;
    }
}

@media (max-width: 339.98px) {
    .auth-card {
        padding-right: 16px;
        padding-left: 16px;
    }

    .otp-boxes {
        gap: 4px;
    }

    .otp-box {
        width: 36px;
        height: 44px;
    }
}

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