.v4-auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: var(--v4-paper);
    color: var(--v4-ink);
    font-family: "Montserrat", sans-serif;
}

.v4-auth-body [hidden],
.v4-account-security [hidden] {
    display: none !important;
}

.v4-auth-shell {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(380px, 5fr) minmax(500px, 7fr);
}

.v4-auth-story {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(36px, 5vw, 72px);
    background: var(--v4-nav);
    color: #fff;
}

.v4-auth-body[data-auth-page="select-tenant"] .v4-auth-story {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    align-self: start;
}

.v4-auth-brand,
.v4-auth-mobile-brand {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    color: inherit !important;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.04em;
}

.v4-auth-brand:hover,
.v4-auth-mobile-brand:hover {
    color: inherit !important;
}

.v4-auth-story .v4-auth-brand:focus-visible {
    outline-color: var(--v4-brand-on-dark);
}

.v4-auth-brand-mark {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
}

.v4-auth-brand-mark img,
.v4-auth-brand-mark svg {
    width: 100%;
    height: 100%;
}

.v4-auth-story .v4-auth-brand-mark {
    outline: 1px solid rgba(213, 229, 242, .3);
    outline-offset: -1px;
}

.v4-auth-brand-lockup {
    display: grid;
    gap: 4px;
}

.v4-auth-brand-primary {
    display: flex;
    align-items: center;
    gap: 11px;
}

.v4-auth-partner {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 6px;
    padding-top: 5px;
    border-top: 1px solid var(--v4-line);
    color: var(--v4-muted);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: normal;
    line-height: 1.2;
}

.v4-auth-story .v4-auth-partner {
    border-top-color: rgba(213, 229, 242, .32);
    color: var(--v4-brand-on-dark);
}

.v4-auth-partner img {
    box-sizing: content-box;
    padding: 1px 3px;
    border-radius: 3px;
    background: #fff;
}

.v4-auth-story-copy {
    max-width: 460px;
    margin: 48px 0;
}

.v4-auth-eyebrow {
    display: block;
    color: var(--v4-brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
    line-height: 1.3;
}

.v4-auth-story-copy::before {
    display: block;
    width: 28px;
    height: 3px;
    background: #c98e77;
    content: "";
}

.v4-auth-story-copy h2 {
    margin: 20px 0 14px;
    color: #fff;
    font-size: clamp(38px, 4.25vw, 58px);
    font-weight: 650;
    letter-spacing: -.05em;
    line-height: 1.04;
}

.v4-auth-story-copy p {
    max-width: 36ch;
    margin: 0;
    color: var(--v4-brand-on-dark);
    font-size: clamp(14px, 1.25vw, 17px);
    line-height: 1.7;
}

.v4-auth-capabilities {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 16px 0 0;
    gap: 8px 20px;
    border-top: 1px solid rgba(213, 229, 242, .32);
    color: var(--v4-brand-on-dark);
    font-size: 12px;
    font-weight: 500;
    list-style: none;
}

.v4-auth-main {
    display: grid;
    min-width: 0;
    padding: clamp(24px, 5vw, 74px);
    place-items: center;
    background: var(--v4-paper);
}

.v4-auth-mobile-brand {
    display: none;
    color: var(--v4-nav) !important;
}

.v4-auth-card {
    width: min(100%, 460px);
    padding: clamp(28px, 4vw, 44px);
    border: 1px solid var(--v4-line);
    border-radius: 14px;
    background: var(--v4-surface);
}

.v4-auth-card-wide {
    width: min(100%, 640px);
}

.v4-tenant-card {
    width: min(100%, 720px);
}

.v4-auth-card-status {
    width: min(100%, 500px);
}

.v4-auth-card-heading {
    margin: 0 0 24px;
}

.v4-auth-card-heading h1,
.v4-auth-card-heading h2,
.v4-auth-result h1,
.v4-auth-result h2 {
    margin: 11px 0 10px;
    color: var(--v4-ink);
    font-size: clamp(25px, 3.3vw, 34px);
    font-weight: 700;
    letter-spacing: -.045em;
    line-height: 1.12;
}

.v4-auth-card-heading h2,
.v4-auth-result h2 {
    font-size: clamp(23px, 3vw, 30px);
}

#v4-login-title {
    margin: 0;
}

.v4-auth-card-heading p,
.v4-auth-result p {
    margin: 0;
    color: var(--v4-muted);
    font-size: 13px;
    line-height: 1.65;
}

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

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

.v4-auth-field label,
.v4-auth-label-row label {
    margin: 0;
    color: var(--v4-ink);
    font-size: 12px;
    font-weight: 650;
}

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

.v4-auth-label-row a {
    font-size: 11px;
    font-weight: 600;
}

.bni-v4 .v4-auth-main :is(.v4-auth-label-row a, .v4-auth-back, .v4-auth-text-link),
.bni-v4 .v4-account-security .v4-auth-text-link {
    color: var(--v4-brand);
}

.v4-auth-body .form-control,
.v4-account-security .form-control {
    min-height: 48px;
    padding: .72rem .88rem;
    border-color: var(--v4-control);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
}

.v4-auth-body .form-control:hover:not(:focus, [aria-invalid="true"]),
.v4-account-security .form-control:hover:not(:focus, [aria-invalid="true"]) {
    border-color: var(--v4-muted);
}

.v4-auth-body .form-control[aria-invalid="true"],
.v4-account-security .form-control[aria-invalid="true"] {
    border-color: var(--v4-red);
}

.v4-auth-password-control {
    position: relative;
}

.v4-auth-password-control .form-control {
    padding-right: 75px;
}

.v4-auth-password-control > button {
    position: absolute;
    top: 50%;
    right: 8px;
    min-width: 58px;
    min-height: 34px;
    padding: 0 7px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--v4-brand);
    font-size: 11px;
    font-weight: 650;
}

.v4-auth-password-control > button:hover {
    background: var(--v4-brand-soft);
}

.v4-auth-code {
    text-align: center;
    font-size: 22px !important;
    font-weight: 700;
    letter-spacing: .28em;
}

.v4-auth-field-error {
    min-height: 0;
    color: var(--v4-red);
    font-size: 11px;
    line-height: 1.4;
}

.v4-auth-field-error:empty {
    display: none;
}

.v4-auth-submit {
    width: 100%;
    min-height: 48px !important;
    margin-top: 2px;
    border-radius: 8px !important;
    font-size: 13px !important;
}

.bni-v4 .v4-auth-submit {
    border-color: var(--v4-brand) !important;
    background: var(--v4-brand) !important;
}

.bni-v4 .v4-auth-submit:hover,
.bni-v4 .v4-auth-submit:focus-visible {
    border-color: var(--v4-brand-strong) !important;
    background: var(--v4-brand-strong) !important;
}

.v4-auth-alert {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #f0c3c6;
    border-radius: 10px;
    background: var(--v4-red-soft);
    color: var(--v4-red);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.55;
}

.v4-auth-alert.is-info {
    border-color: var(--v4-line);
    background: var(--v4-brand-soft);
    color: var(--v4-brand);
}

.v4-auth-back,
.v4-auth-text-link {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    margin: -8px 0 22px;
    border: 0;
    background: transparent;
    color: var(--v4-brand);
    font-size: 12px;
    font-weight: 650;
}

button.v4-auth-back {
    padding: 0;
}

.v4-auth-back svg {
    width: 16px;
    height: 16px;
}

.v4-auth-step .v4-auth-card-heading {
    margin-top: 2px;
}

.v4-auth-card-footer {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 26px;
    padding-top: 19px;
    border-top: 1px solid var(--v4-line);
    color: var(--v4-muted);
    font-size: 10px;
    line-height: 1.5;
}

.v4-auth-card-footer svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    color: var(--v4-muted);
}

.v4-auth-card-footer-centered {
    justify-content: center;
}

.v4-auth-result {
    display: grid;
    justify-items: center;
    text-align: center;
}

.v4-auth-result .v4-auth-eyebrow {
    margin-top: 23px;
}

.v4-auth-result .btn {
    margin-top: 24px;
}

.v4-auth-result .v4-auth-text-link,
.v4-auth-result .btn-flat-secondary {
    margin: 12px 0 0;
}

.v4-auth-result-icon,
.v4-account-security-icon {
    display: inline-grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border-radius: 18px;
    background: var(--v4-brand-soft);
    color: var(--v4-brand);
}

.v4-auth-result-icon.is-success {
    background: var(--v4-green-100);
    color: var(--v4-green-700);
}

.v4-auth-result-icon.is-danger {
    background: var(--v4-red-soft);
    color: var(--v4-red);
}

.v4-auth-result-icon svg,
.v4-account-security-icon svg {
    width: 27px;
    height: 27px;
}

.v4-auth-result-compact {
    padding: 16px 0 6px;
}

.v4-auth-result-compact h2 {
    font-size: 22px;
}

.v4-password-rules {
    display: grid;
    margin: -2px 0 2px;
    padding: 13px 14px;
    gap: 8px;
    border-radius: 11px;
    background: var(--v4-surface-soft);
    list-style: none;
}

.v4-password-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--v4-muted);
    font-size: 11px;
    line-height: 1.35;
}

.v4-password-rules li svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    fill: transparent;
}

.v4-password-rules li.is-met {
    color: var(--v4-green-700);
    font-weight: 600;
}

.v4-password-rules li.is-met svg {
    fill: currentColor;
}

.v4-tenant-loading {
    display: flex;
    min-height: 150px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--v4-muted);
    font-size: 12px;
}

.v4-tenant-tools {
    display: grid;
    margin-bottom: 14px;
    gap: 8px;
}

.v4-tenant-tools[hidden],
.v4-tenant-no-results[hidden] {
    display: none !important;
}

.v4-tenant-search {
    position: relative;
    display: flex;
    min-height: 48px;
    align-items: center;
    border: 1px solid var(--v4-line);
    border-radius: 13px;
    background: #fff;
    color: var(--v4-muted);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.v4-tenant-search:focus-within {
    border-color: var(--v4-brand);
    box-shadow: 0 0 0 3px rgba(40, 77, 112, .12);
}

.v4-tenant-search > svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-left: 15px;
}

.v4-tenant-search input {
    width: 100%;
    min-width: 0;
    padding: 13px 10px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--v4-ink);
    font-size: 13px;
}

.v4-tenant-search input::-webkit-search-cancel-button {
    appearance: none;
}

.v4-tenant-search input::placeholder {
    color: var(--v4-muted);
}

.v4-tenant-search button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    margin-right: 6px;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--v4-muted);
}

.v4-tenant-search button:hover,
.v4-tenant-search button:focus-visible {
    background: var(--v4-brand-soft);
    color: var(--v4-brand);
}

.v4-tenant-search button[hidden] {
    display: none !important;
}

.v4-tenant-list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--v4-muted);
    font-size: 10px;
}

#v4-tenant-count {
    color: var(--v4-brand);
    font-size: 11px;
    font-weight: 700;
}

.v4-auth-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 3px solid rgba(40, 77, 112, .18);
    border-top-color: var(--v4-brand);
    border-radius: 50%;
    animation: v4-auth-spin .8s linear infinite;
}

.v4-tenant-list {
    display: grid;
    max-height: min(430px, 54vh);
    padding: 2px;
    gap: 10px;
    overflow: auto;
    overscroll-behavior: contain;
}

.v4-tenant-option {
    display: grid;
    width: 100%;
    min-height: 76px;
    grid-template-columns: 44px minmax(0, 1fr) 18px;
    align-items: center;
    padding: 13px 15px;
    gap: 13px;
    border: 1px solid var(--v4-line);
    border-radius: 13px;
    background: #fff;
    color: var(--v4-ink);
    text-align: left;
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.v4-tenant-option:hover:not(:disabled),
.v4-tenant-option:focus-visible:not(:disabled) {
    border-color: var(--v4-brand);
    background: var(--v4-brand-soft);
    transform: translateY(-1px);
}

.v4-tenant-option:disabled {
    cursor: wait;
    opacity: .6;
}

.v4-tenant-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: var(--v4-brand-soft);
    color: var(--v4-brand);
    font-size: 13px;
    font-weight: 700;
}

.v4-tenant-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.v4-tenant-copy strong {
    overflow: hidden;
    color: var(--v4-ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v4-tenant-copy small {
    color: var(--v4-muted);
    font-size: 10px;
}

.v4-tenant-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.v4-tenant-code {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--v4-line);
    border-radius: 99px;
    background: var(--v4-brand-soft);
    color: var(--v4-brand);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
}

.v4-tenant-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v4-tenant-no-results {
    padding: 26px 18px;
}

.v4-tenant-arrow {
    color: var(--v4-brand);
}

.v4-tenant-arrow svg {
    width: 17px;
    height: 17px;
}

.v4-auth-card-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 22px;
    gap: 8px;
}

.v4-auth-progress {
    width: min(100%, 260px);
    height: 5px;
    margin-top: 26px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--v4-surface-soft);
}

.v4-auth-progress span {
    display: block;
    width: 45%;
    height: 100%;
    border-radius: inherit;
    background: var(--v4-brand);
    animation: v4-auth-progress 1.25s ease-in-out infinite;
}

.v4-auth-noscript {
    position: fixed;
    z-index: 9999;
    right: 16px;
    bottom: 16px;
    left: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--v4-red);
    color: #fff;
    text-align: center;
    font-size: 12px;
}

/* Authenticated account security screen */
.v4-account-security {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 18px 14px 34px;
}

.v4-account-security-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 20px;
}

.v4-account-security-header h1 {
    margin: 7px 0 5px;
    color: var(--v4-ink);
    font-size: clamp(25px, 3vw, 36px);
    font-weight: 700;
    letter-spacing: -.045em;
}

.v4-account-security-header p {
    margin: 0;
    color: var(--v4-muted);
    font-size: 13px;
}

.v4-account-security-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    align-items: start;
    gap: 18px;
}

.v4-account-security-card,
.v4-account-security-tips {
    margin: 0;
}

.v4-account-security-card .card-body,
.v4-account-security-tips .card-body {
    padding: clamp(22px, 3vw, 34px);
}

.v4-account-security-card .v4-auth-form {
    max-width: 520px;
}

.v4-account-security-tips {
    position: sticky;
    top: 106px;
    background: var(--v4-surface);
}

.v4-account-security-tips h2 {
    margin: 20px 0 9px;
    color: var(--v4-ink);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.25;
}

.v4-account-security-tips p {
    margin-bottom: 18px;
    color: var(--v4-muted);
    font-size: 12px;
    line-height: 1.6;
}

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

@keyframes v4-auth-progress {
    0% { transform: translateX(-115%); }
    100% { transform: translateX(235%); }
}

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

    .v4-auth-story {
        display: none;
    }

    .v4-auth-main {
        display: flex;
        min-height: 100vh;
        min-height: 100dvh;
        flex-direction: column;
        justify-content: center;
        padding: 30px clamp(18px, 5vw, 46px);
        gap: 26px;
    }

    .v4-auth-mobile-brand {
        display: inline-flex;
        margin: 0 auto;
    }

    .v4-auth-card {
        margin: 0 auto;
    }

    .v4-account-security-grid {
        grid-template-columns: 1fr;
    }

    .v4-account-security-tips {
        position: relative;
        top: auto;
    }
}

@media (max-width: 575.98px) {
    .v4-auth-main {
        justify-content: flex-start;
        padding: 22px 12px;
        gap: 19px;
    }

    .v4-auth-mobile-brand {
        margin-top: 2px;
    }

    .v4-auth-card {
        padding: 24px 20px;
        border-radius: 12px;
    }

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

    .v4-auth-card-actions,
    .v4-account-security-header {
        align-items: stretch;
        flex-direction: column;
    }

    .v4-auth-card-actions .btn,
    .v4-account-security-header .btn {
        width: 100%;
    }

    .v4-tenant-list {
        max-height: min(460px, 58vh);
    }

    .v4-tenant-list-summary small {
        display: none;
    }

    .v4-tenant-option {
        min-height: 70px;
        padding: 11px 12px;
    }

    .v4-account-security {
        padding: 10px 0 26px;
    }

    .v4-account-security-card .card-body,
    .v4-account-security-tips .card-body {
        padding: 22px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .v4-auth-spinner,
    .v4-auth-progress span {
        animation: none !important;
    }

    .v4-tenant-option {
        transition: none;
    }
}
