.auth-header {
    flex: 0 0 auto;
    border-bottom: var(--rp-border-width-standard) solid var(--rp-color-border, var(--line));
    background: var(--rp-color-surface, var(--surface));
}

.auth-header-inner,
.auth-footer-inner {
    width: min(100%, var(--rp-content-width-standard));
    margin-inline: auto;
    padding-inline: var(--rp-page-gutter);
}

.auth-header-inner {
    display: flex;
    min-height: calc(var(--rp-control-height-touch) + var(--rp-space-16));
    align-items: center;
    justify-content: space-between;
    gap: var(--rp-space-16) var(--rp-space-24);
}

.auth-brand,
.auth-brand picture {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.auth-brand-text {
    color: inherit;
    font-family: var(--rp-font-family-heading);
    font-size: var(--rp-font-size-20);
    font-weight: 700;
    line-height: 1.2;
}

.auth-brand img {
    display: block;
    width: var(--rp-auth-brand-width);
    max-height: var(--rp-space-32);
    object-fit: contain;
    object-position: left center;
}

.tenant-auth-surface .auth-brand img {
    width: min(var(--portal-logo-width, var(--rp-auth-brand-width)), 44vw);
    max-height: calc(var(--portal-header-height, 64px) - var(--rp-space-16));
}

.tenant-auth-surface .auth-header-inner {
    min-height: var(--portal-header-height, calc(var(--rp-control-height-touch) + var(--rp-space-16)));
}

.tenant-auth-surface[data-portal-header-align="center"] .auth-header-inner {
    justify-content: center;
}

.tenant-auth-surface[data-portal-header-align="center"] .auth-public-navigation {
    flex-basis: 100%;
    justify-content: center;
}

.auth-public-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--rp-space-8) var(--rp-space-16);
}

.auth-public-navigation .auth-menu-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--rp-space-8) var(--rp-space-16);
}

.auth-header .auth-mobile-menu-toggle {
    display: none;
}

.auth-public-navigation a {
    color: inherit;
    font-size: var(--rp-font-size-14);
    font-weight: 600;
    text-decoration: none;
}

.auth-public-navigation a:is(:hover, :focus-visible) {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.tenant-auth-surface[data-portal-header-colors="custom"] > .auth-header {
    border-bottom-color: color-mix(in srgb, var(--portal-header-text) 20%, var(--portal-header-bg));
    background: var(--portal-header-bg);
    color: var(--portal-header-text);
}

.tenant-auth-surface[data-portal-header-colors="custom"] > .auth-header a:focus-visible {
    outline-color: currentColor;
}

.tenant-auth-surface[data-portal-header-sticky="true"] > .auth-header {
    position: sticky;
    z-index: 30;
    top: 0;
}

.auth-app-shell {
    width: min(100%, calc(var(--rp-content-width-reading) + (2 * var(--rp-space-48))));
    margin-inline: auto;
    padding: var(--rp-space-48) var(--rp-page-gutter);
}

.auth-app-shell > .flash,
.auth-app-shell > .error-list {
    width: min(100%, var(--rp-content-width-reading));
    margin-inline: auto;
}

.auth-app-shell .auth-shell {
    min-height: 0;
    padding: 0;
    place-items: start center;
}

.auth-app-shell .auth-panel {
    width: min(100%, var(--rp-auth-panel-width));
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: var(--rp-elevation-none);
}

.auth-app-shell .auth-panel.wide-auth,
.auth-app-shell .organization-setup-panel {
    width: min(100%, var(--rp-content-width-reading));
    max-width: none;
}

.auth-app-shell .registration-panel {
    width: min(100%, var(--rp-auth-registration-width));
}

.auth-app-shell .auth-panel h1 {
    margin: 0 0 var(--rp-space-24);
}

.auth-app-shell .registration-heading {
    max-width: none;
}

.auth-app-shell .registration-heading h1 {
    margin-bottom: var(--rp-space-16);
}

.auth-app-shell .registration-role-grid .account-type-option,
.auth-app-shell .organization-mode-options,
.auth-app-shell .organization-mode-option {
    box-shadow: var(--rp-elevation-none);
}

.auth-app-shell .registration-role-grid .account-type-option:has(input:checked),
.auth-app-shell .organization-mode-option:has(input:checked) {
    box-shadow: var(--rp-elevation-none);
}

.auth-footer {
    flex: 0 0 auto;
    margin-top: auto;
    border-top: var(--rp-border-width-standard) solid var(--rp-color-border, var(--line));
    background: var(--rp-color-surface, var(--surface));
}

.tenant-auth-surface .auth-footer {
    border-top: 0;
    background: transparent;
}

.tenant-auth-surface .auth-footer > .site-footer,
.tenant-auth-surface .auth-footer > .minimal-four-column-footer {
    margin: 0;
}

.auth-footer-inner {
    display: flex;
    min-height: calc(var(--rp-control-height-standard) + var(--rp-space-16));
    align-items: center;
    justify-content: space-between;
    gap: var(--rp-space-12) var(--rp-space-24);
    padding-block: var(--rp-space-16);
}

.auth-footer-inner p {
    margin: 0;
    color: var(--rp-color-text-muted, var(--muted));
    font-size: var(--rp-font-size-14);
}

.auth-footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rp-space-8) var(--rp-space-16);
}

.auth-footer-inner a {
    color: var(--rp-color-link, var(--link-color));
    font-size: var(--rp-font-size-14);
    text-decoration: none;
}

.auth-footer-inner a:hover {
    text-decoration: underline;
}

@media (max-width: 560px) {
    .auth-header-inner {
        min-height: calc(var(--rp-control-height-touch) + var(--rp-space-8));
    }

    .auth-brand img {
        width: var(--rp-auth-brand-mobile-width);
        max-height: calc(var(--rp-space-24) + var(--rp-space-4));
    }

    .auth-public-navigation {
        width: 100%;
        justify-content: flex-start;
    }

    .auth-header-inner {
        align-items: flex-start;
        flex-direction: column;
        padding-block: var(--rp-space-12);
    }

    .auth-app-shell {
        padding-block: var(--rp-space-32) var(--rp-space-48);
    }

    .auth-footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 1120px) {
    .auth-header.auth-menu-ready {
        position: relative;
        z-index: 30;
    }

    .auth-header.auth-menu-ready .auth-header-inner {
        min-height: var(--portal-header-height, calc(var(--rp-control-height-touch) + var(--rp-space-16)));
        align-items: center;
        justify-content: space-between;
        flex-direction: row;
        padding-block: var(--rp-space-8);
    }

    .auth-header.auth-menu-ready .auth-mobile-menu-toggle {
        position: relative;
        z-index: 3;
        display: inline-flex;
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        padding: 0;
        border: 0;
        border-radius: var(--tenant-button-radius, 8px);
        background: var(--portal-primary, var(--brand-blue));
        color: var(--portal-primary-text, white);
        cursor: pointer;
    }

    .auth-header.auth-menu-ready .auth-mobile-menu-toggle:is(:hover, :focus-visible, [aria-expanded="true"]) {
        background: var(--brand-blue-dark);
        color: white;
    }

    .auth-header.auth-menu-ready .auth-mobile-menu-toggle:focus-visible {
        outline: 3px solid rgba(6, 78, 228, 0.2);
        outline-offset: 2px;
    }

    .tenant-auth-surface[data-portal-menu-trigger="outline"] > .auth-header.auth-menu-ready .auth-mobile-menu-toggle {
        border: 1px solid var(--portal-primary);
        background: transparent;
        color: var(--portal-primary);
    }

    .tenant-auth-surface[data-portal-menu-trigger="minimal"] > .auth-header.auth-menu-ready .auth-mobile-menu-toggle {
        background: transparent;
        color: var(--portal-primary);
    }

    .auth-header.auth-menu-ready .auth-public-navigation {
        position: fixed;
        inset: 0;
        z-index: 2;
        display: flex;
        width: 100%;
        height: 100dvh;
        min-height: 100vh;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: nowrap;
        margin: 0;
        padding: 0;
        background: var(--portal-surface, var(--rp-color-surface, var(--surface)));
        color: var(--portal-text, var(--rp-color-text, var(--text)));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
    }

    .auth-header.auth-menu-ready .auth-public-navigation.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        transition-delay: 0s;
    }

    .auth-header.auth-menu-ready .auth-menu-panel {
        display: flex;
        width: 100%;
        min-height: 100%;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 4px;
        padding: calc(var(--rp-mobile-header-offset) + env(safe-area-inset-top) + var(--rp-space-16)) var(--page-gutter, var(--rp-page-gutter)) max(28px, env(safe-area-inset-bottom));
    }

    .auth-header.auth-menu-ready .auth-menu-panel a {
        display: flex;
        width: 100%;
        min-height: 48px;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 4px;
        border-bottom: 1px solid rgba(31, 40, 42, 0.1);
        border-radius: 0;
        font-size: 18px;
        font-weight: var(--weight-nav, 600);
    }

    .tenant-auth-surface[data-portal-menu-panel="drawer"] > .auth-header.auth-menu-ready .auth-menu-panel {
        width: min(390px, 92vw);
        margin-left: auto;
        border-left: 1px solid var(--portal-border);
        background: var(--portal-surface);
        color: var(--portal-text);
        transform: translateX(24px);
        transition: transform 180ms ease;
    }

    .tenant-auth-surface[data-portal-menu-panel="drawer"] > .auth-header.auth-menu-ready .auth-public-navigation.is-open .auth-menu-panel {
        transform: translateX(0);
    }

    .tenant-auth-surface[data-portal-header-colors="custom"] > .auth-header.auth-menu-ready .auth-public-navigation {
        background: var(--portal-header-bg);
        color: var(--portal-header-text);
    }

    .tenant-auth-surface[data-portal-menu-panel="drawer"] > .auth-header.auth-menu-ready .auth-public-navigation {
        background: transparent;
        transform: none;
    }

    .tenant-auth-surface[data-portal-header-colors="custom"] > .auth-header.auth-menu-ready .auth-menu-panel {
        background: var(--portal-header-bg);
        color: var(--portal-header-text);
    }
}

@media (max-width: 420px) {
    .auth-header.auth-menu-ready .auth-mobile-menu-toggle {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-header.auth-menu-ready .auth-public-navigation,
    .auth-header.auth-menu-ready .auth-menu-panel {
        transition: none;
    }
}

@media (forced-colors: active) {
    .auth-header,
    .auth-footer {
        border-color: CanvasText;
    }
}
