:root {
    --auth-primary: #146ef5;
    --auth-primary-dark: #0758d6;
    --auth-ink: #172033;
    --auth-muted: #667085;
    --auth-border: #dfe5ee;
    --auth-surface: #ffffff;
    --auth-soft: #f4f7fb;
}

* {
    box-sizing: border-box;
}

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

body.auth-page {
    margin: 0;
    background: var(--auth-surface);
    color: var(--auth-ink);
    font-family: "Inter", sans-serif;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) minmax(480px, 0.92fr);
}

.auth-main {
    display: flex;
    min-width: 0;
    overflow-y: auto;
}

.auth-main__inner {
    display: flex;
    width: min(100%, 620px);
    min-height: 100%;
    margin: auto;
    padding: clamp(28px, 5vw, 64px);
    flex-direction: column;
    justify-content: center;
}

.auth-logo {
    display: inline-flex;
    width: fit-content;
    margin-bottom: clamp(28px, 5vh, 54px);
    transition: opacity 160ms ease;
}

.auth-logo:hover {
    opacity: 0.78;
}

.auth-logo img {
    display: block;
    width: 176px;
    height: 65px;
    object-fit: contain;
    object-position: left center;
}

.auth-card {
    width: 100%;
}

.auth-main--legal .auth-main__inner {
    justify-content: flex-start;
}

.auth-legal {
    display: grid;
    gap: 24px;
}

.auth-legal__intro {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

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

.auth-legal__section h2 {
    margin: 0;
    color: var(--auth-ink);
    font-size: 1rem;
    font-weight: 750;
}

.auth-legal__section p,
.auth-legal__section li {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.86rem;
    line-height: 1.7;
}

.auth-legal__section ul {
    display: grid;
    margin: 0;
    gap: 6px;
    padding-left: 20px;
}

.auth-legal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

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

.auth-kicker {
    display: inline-flex;
    margin-bottom: 12px;
    color: var(--auth-primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-heading h1 {
    margin: 0 0 10px;
    color: var(--auth-ink);
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.12;
}

.auth-heading p {
    max-width: 480px;
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.96rem;
    line-height: 1.65;
}

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

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

.auth-field__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.auth-label {
    margin: 0;
    color: #344054;
    font-size: 0.875rem;
    font-weight: 700;
}

.auth-required {
    color: #d92d20;
    font-weight: 800;
}

.auth-optional {
    color: #98a2b3;
    font-size: 0.75rem;
    font-weight: 500;
}

.auth-optional-disclosure {
    overflow: hidden;
    border: 1px dashed var(--auth-border);
    border-radius: 12px;
    background: var(--auth-soft);
}

.auth-optional-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #344054;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 650;
    list-style: none;
    padding: 13px 15px;
    transition: background-color 160ms ease, color 160ms ease;
}

.auth-optional-trigger::-webkit-details-marker {
    display: none;
}

.auth-optional-trigger:hover,
.auth-optional-trigger:focus-visible {
    background: rgba(20, 110, 245, 0.06);
    color: var(--auth-primary);
    outline: 0;
}

.auth-optional-trigger__meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--auth-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.auth-optional-trigger__icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 160ms ease;
}

.auth-optional-disclosure[open] .auth-optional-trigger__icon {
    transform: rotate(180deg);
}

.auth-optional-disclosure__content {
    display: grid;
    border-top: 1px solid var(--auth-border);
    gap: 8px;
    padding: 14px 15px 15px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background: #fff;
    color: var(--auth-ink);
    font-size: 0.94rem;
    outline: 0;
    padding: 12px 15px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.auth-input::placeholder {
    color: #98a2b3;
}

.auth-input:hover {
    border-color: #b9c3d2;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(20, 110, 245, 0.12);
}

.auth-input[readonly] {
    background: var(--auth-soft);
    color: #475467;
}

.auth-input.is-invalid {
    border-color: #f04438;
}

.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(240, 68, 56, 0.1);
}

.auth-input.is-valid {
    border-color: #12b76a;
}

.auth-input.is-valid:focus {
    box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.12);
}

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

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: grid;
    width: 38px;
    height: 38px;
    border: 1px solid var(--auth-border);
    border-radius: 9px;
    background: transparent;
    color: #667085;
    cursor: pointer;
    place-items: center;
    transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    background: var(--auth-soft);
    color: var(--auth-primary);
    outline: 0;
}

.auth-password-toggle__icon {
    display: block;
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.auth-password-toggle__icon[hidden] {
    display: none;
}

.auth-help,
.auth-feedback,
.invalid-feedback {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
}

.auth-help {
    color: var(--auth-muted);
}

.auth-feedback {
    color: var(--auth-muted);
}

.auth-feedback.is-success {
    color: #067647;
}

.auth-feedback.is-error,
.invalid-feedback,
.auth-error {
    color: #d92d20;
}

.invalid-feedback {
    display: block;
}

.auth-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #475467;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.5;
}

.auth-check input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--auth-primary);
    flex: 0 0 auto;
}

.auth-check--centered {
    align-items: center;
}

.auth-check--centered input {
    margin-top: 0;
}

.auth-link {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-submit {
    display: inline-flex;
    min-height: 50px;
    border: 0;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--auth-primary);
    box-shadow: 0 10px 22px rgba(20, 110, 245, 0.2);
    color: #fff;
    cursor: pointer;
    font-size: 0.94rem;
    font-weight: 750;
    padding: 13px 20px;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.auth-submit:hover:not(:disabled) {
    background: var(--auth-primary-dark);
    box-shadow: 0 12px 26px rgba(20, 110, 245, 0.28);
    transform: translateY(-1px);
}

.auth-submit:focus-visible {
    outline: 3px solid rgba(20, 110, 245, 0.3);
    outline-offset: 3px;
}

.auth-submit:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.auth-submit[data-registration-submit]:disabled:not(.is-loading) {
    background: #d0d5dd;
    box-shadow: none;
    color: #667085;
    opacity: 1;
}

.auth-submit-help {
    margin: -10px 0 0;
    color: var(--auth-muted);
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: center;
}

.auth-submit-help.is-success {
    color: #067647;
    font-weight: 600;
}

.auth-submit--block {
    width: 100%;
}

.auth-submit__loading {
    display: none;
}

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

.auth-submit.is-loading .auth-submit__loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-secondary {
    display: inline-flex;
    min-height: 50px;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    background: var(--auth-surface);
    color: #344054;
    font-weight: 700;
    padding: 12px 20px;
    text-decoration: none;
}

.auth-secondary:hover {
    border-color: #b9c3d2;
    background: var(--auth-soft);
    color: var(--auth-ink);
}

.auth-form-actions {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.auth-switch {
    margin: 8px 0 0;
    color: var(--auth-muted);
    font-size: 0.9rem;
    text-align: center;
}

.auth-alert {
    display: flex;
    border: 1px solid;
    border-radius: 12px;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.84rem;
    line-height: 1.55;
    padding: 13px 14px;
}

.auth-alert--success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: #067647;
}

.auth-alert--danger {
    border-color: #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.auth-alert--warning {
    border-color: #fedf89;
    background: #fffaeb;
    color: #93370d;
}

.auth-alert--warning strong {
    font-weight: 700;
    white-space: nowrap;
}

.auth-submit.is-throttled,
.auth-link.is-throttled {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}

.auth-ruc-summary {
    display: none;
    border: 1px solid #b2ddff;
    border-radius: 12px;
    background: #eff8ff;
    color: #175cd3;
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 12px 14px;
}

.auth-ruc-summary.is-visible {
    display: block;
}

.auth-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-grid--contact {
    align-items: start;
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
}

.auth-password-rules {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.76rem;
    gap: 6px 18px;
    list-style: none;
    padding: 0;
}

.auth-password-rules li {
    white-space: nowrap;
    transition: color 160ms ease;
}

.auth-password-rules li::before {
    content: "•";
    margin-right: 6px;
    color: var(--auth-primary);
}

.auth-password-rules li.is-valid {
    color: #067647;
    font-weight: 600;
}

.auth-password-rules li.is-valid::before {
    content: "✓";
    color: #12b76a;
}

.auth-password-match {
    font-weight: 600;
}

.auth-otp {
    font-size: clamp(1.35rem, 5vw, 2rem);
    font-weight: 750;
    letter-spacing: 0.55em;
    padding-left: calc(15px + 0.55em);
    text-align: center;
}

.auth-phone {
    margin-top: 8px;
    color: var(--auth-ink);
    font-size: 1.15rem;
    font-weight: 800;
}

.auth-icon {
    display: grid;
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    border-radius: 22px;
    background: #eff8ff;
    place-items: center;
}

.auth-icon img {
    width: 42px;
    height: 42px;
}

.auth-modal .modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(16, 24, 40, 0.18);
}

.auth-modal .modal-header,
.auth-modal .modal-body {
    padding: 24px;
}

.auth-modal .btn-close {
    width: 36px;
    height: 36px;
}

.auth-footer {
    margin: clamp(30px, 5vh, 54px) 0 0;
    color: #98a2b3;
    font-size: 0.76rem;
    line-height: 1.5;
}

.auth-showcase {
    position: relative;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: linear-gradient(150deg, #0a55d0 0%, #1877f2 52%, #19a4ef 100%);
    color: #fff;
}

.auth-showcase::before {
    position: absolute;
    inset: 0;
    background-image: url("../media/misc/auth-bg.png");
    background-position: center;
    background-size: cover;
    content: "";
    mix-blend-mode: soft-light;
    opacity: 0.3;
}

.auth-showcase__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.auth-showcase__glow--top {
    top: -150px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: rgba(108, 92, 231, 0.42);
}

.auth-showcase__glow--bottom {
    bottom: -190px;
    left: -130px;
    width: 460px;
    height: 460px;
    background: rgba(16, 185, 129, 0.3);
}

.auth-showcase__content {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 760px;
    margin: auto;
    padding: clamp(42px, 5vw, 76px);
    flex-direction: column;
    align-items: center;
}

.auth-showcase__eyebrow {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 8px 13px;
}

.auth-showcase__visual {
    width: min(100%, 620px);
    margin: clamp(20px, 3vh, 36px) auto 10px;
}

.auth-showcase__visual img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 28px 45px rgba(0, 34, 94, 0.24));
}

.auth-showcase__copy {
    max-width: 590px;
    text-align: center;
}

.auth-showcase__copy h2 {
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(2rem, 3.4vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.08;
}

.auth-showcase__copy p {
    max-width: 540px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.96rem;
    line-height: 1.7;
}

.auth-benefits {
    display: flex;
    margin-top: 24px;
    justify-content: center;
    gap: 12px 24px;
    flex-wrap: wrap;
}

.auth-benefits span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    font-weight: 600;
}

@media (max-width: 1199.98px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(400px, 0.82fr);
    }

    .auth-showcase__content {
        padding: 42px;
    }
}

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

    .auth-main {
        min-height: 100vh;
        min-height: 100dvh;
        background:
            radial-gradient(circle at top right, rgba(20, 110, 245, 0.11), transparent 38%),
            var(--auth-surface);
    }

    .auth-main__inner {
        width: min(100%, 620px);
        padding: 32px clamp(24px, 6vw, 52px);
    }

    .auth-logo {
        margin-bottom: 32px;
    }

    .auth-showcase {
        display: none;
    }

    .auth-footer {
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    .auth-main__inner {
        justify-content: flex-start;
        padding: 22px 18px 28px;
    }

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

    .auth-logo img {
        width: 142px;
        height: 52px;
    }

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

    .auth-form {
        gap: 17px;
    }

    .auth-grid,
    .auth-form-actions {
        grid-template-columns: 1fr;
    }

    .auth-actions-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .auth-secondary {
        width: 100%;
    }

    .auth-password-rules {
        justify-content: flex-start;
    }

    .auth-footer {
        margin-top: 32px;
    }
}

@media (max-width: 359.98px) {
    .auth-main__inner {
        padding-inline: 14px;
    }

    .auth-heading h1 {
        font-size: 1.65rem;
    }

    .auth-otp {
        font-size: 1.2rem;
        letter-spacing: 0.4em;
        padding-left: calc(15px + 0.4em);
    }
}

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

[data-bs-theme="dark"] body.auth-page {
    --auth-ink: #f2f4f7;
    --auth-muted: #98a2b3;
    --auth-border: #344054;
    --auth-surface: #101828;
    --auth-soft: #1d2939;
}

[data-bs-theme="dark"] .auth-main,
[data-bs-theme="dark"] .auth-input,
[data-bs-theme="dark"] .auth-secondary {
    background-color: var(--auth-surface);
}

[data-bs-theme="dark"] .auth-label,
[data-bs-theme="dark"] .auth-check,
[data-bs-theme="dark"] .auth-optional-trigger {
    color: #d0d5dd;
}

[data-bs-theme="dark"] .auth-submit[data-registration-submit]:disabled:not(.is-loading) {
    background: #344054;
    color: #98a2b3;
}

[data-bs-theme="dark"] .auth-logo img {
    filter: invert(1);
}
