/* Shared layout for public forms. Keep content and actions in document flow,
   including at short heights and when a mobile browser requests desktop layout. */
.auth-page {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 80px 0 0;
    overflow-wrap: anywhere;
}

.auth-page .container,
.auth-page .onboarding-container,
.auth-page .onboarding-form-container,
.auth-page .reset-container,
.auth-page .change-container,
.auth-page .activate-container,
.auth-page .language-switcher,
.auth-page input,
.auth-page select,
.auth-page textarea,
.auth-page button {
    box-sizing: border-box;
    min-width: 0;
}

.auth-page .container {
    width: 100%;
    flex: 1 0 auto;
    padding: 16px 16px 24px;
}

.auth-page .login-form,
.auth-page .passkey-login-panel,
.auth-page .signup-link-policy-notice {
    width: min(100%, 350px);
    flex-shrink: 0;
}

.auth-page .login-form {
    padding: clamp(20px, 5vw, 40px);
}

.auth-page .login-image {
    width: 150px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.auth-page .reset-container,
.auth-page .change-container,
.auth-page .activate-container {
    width: calc(100% - 32px);
    max-width: 480px;
    padding: clamp(20px, 5vw, 40px);
    margin: auto 0;
}

.auth-page .onboarding-header-outside {
    max-width: calc(100% - 32px);
    margin-top: 8px;
}

.auth-page .onboarding-header-outside .parent-title { color: #e2e8f0; }

.auth-page .onboarding-container {
    width: calc(100% - 32px);
    padding: clamp(12px, 3vw, 30px);
}

.auth-page .onboarding-form-container {
    width: min(100%, 650px);
    padding: clamp(16px, 3vw, 26px);
}

.auth-page .form-group,
.auth-page .onboarding-policy-notice > div {
    min-width: 0;
}

.auth-page .form-group input,
.auth-page .form-group select,
.auth-page .form-group textarea,
.auth-page .reset-input,
.auth-page .change-input,
.auth-page .activate-input {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
}

.auth-page .password-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: start;
    min-width: 0;
}

.auth-page .password-container input {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    min-height: 44px;
    padding-right: 48px;
}

.auth-page #togglePassword,
.auth-page .toggle-password {
    position: static;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    z-index: 1;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    transform: none;
    background: transparent;
    color: #b7c1cd;
}

.auth-page .caps-warning {
    grid-column: 1 / -1;
    position: static;
    margin: 6px 0 0;
    transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
}

.auth-page .login-form button[type="submit"],
.auth-page .onboarding-submit,
.auth-page .reset-submit,
.auth-page .change-submit,
.auth-page .activate-submit,
.auth-page .remember-me-container {
    min-height: 44px;
}

.auth-page .signup-link,
.auth-page .reset-link {
    max-width: 100%;
    margin-left: 0;
}

.auth-page .remember-me-container label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.auth-page .reset-link {
    margin-top: 0;
}

.auth-page .signup-link a,
.auth-page .reset-link a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.auth-page .footer {
    position: static;
    flex-shrink: 0;
    margin: 24px 0 0;
    padding: 16px;
}

.auth-page .language-switcher {
    position: absolute;
    top: 16px;
    right: 16px;
    margin: 0;
    z-index: 10000;
}

/* The public forms reserve a header row, so reporting never covers a field. */
.auth-page #bug-icon {
    position: absolute;
    top: 16px;
    right: 80px;
    bottom: auto;
    width: 44px;
    height: 48px;
    font-size: 30px;
    color: #e2e8f0;
    border-radius: 6px;
    background: #263241;
}

.auth-page #bug-icon:hover { color: #a7f3d0; transform: none; }

.auth-page #bug-text {
    position: absolute;
    top: 68px;
    right: 80px;
    bottom: auto;
    max-width: calc(100% - 96px);
}

.auth-page .language-button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 4px;
    list-style: none;
    cursor: pointer;
    border-radius: 6px;
}

.auth-page .language-button::-webkit-details-marker {
    display: none;
}

.auth-page .language-button img {
    width: 100%;
    height: auto;
}

.auth-page .language-switcher .language-dropdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(44px, 1fr));
    gap: 4px;
    top: 100%;
    right: 0;
    left: auto;
    max-height: calc(100vh - 88px);
    max-height: calc(100dvh - 88px);
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.auth-page .language-dropdown button {
    min-width: 44px;
    min-height: 44px;
    margin: 0;
}

.auth-page .language-dropdown img {
    display: block;
    width: 40px;
    height: auto;
}

.auth-page .back-arrow,
.auth-page .back-arrow-reset {
    position: absolute;
    top: 16px;
    left: 16px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 48px;
    margin: 0;
}

.auth-page .back-arrow .tooltip-text,
.auth-page .back-arrow-reset .tooltip-text {
    left: 0;
    top: 100%;
    bottom: auto;
    transform: none;
}

.auth-page .csrf-toast-message {
    box-sizing: border-box;
    width: min(480px, calc(100% - 32px));
    min-width: 0;
    margin-left: 0;
    transform: translateX(-50%);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
}

.auth-page button:focus-visible,
.auth-page input:focus-visible,
.auth-page select:focus-visible,
.auth-page a:focus-visible,
.auth-page summary:focus-visible {
    outline: 3px solid #a7f3d0;
    outline-offset: 2px;
}

/* Public authentication presentation. Opt-in keeps the MFA and tenant shells
   independent. One surface, one type scale, no inset cards or text shadows. */
.auth-page.auth-refresh {
    --auth-canvas: #0b1220;
    --auth-surface: #142034;
    --auth-field: #0d1728;
    --auth-border: #384b66;
    --auth-text: #f0f5fc;
    --auth-muted: #b4c1d3;
    --auth-accent: #93c5fd;
    color-scheme: dark;
    background: var(--auth-canvas);
    background-attachment: scroll;
    color: var(--auth-text);
    font-family: Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    text-shadow: none;
    padding-top: 88px;
}

.auth-refresh .container {
    justify-content: flex-start;
    gap: 16px;
    padding-top: clamp(8px, 3vh, 32px);
}

.auth-refresh :is(.auth-entry-card, .reset-container, .change-container, .activate-container, .onboarding-form-container) {
    box-sizing: border-box;
    width: min(440px, calc(100% - 32px));
    max-width: 100%;
    margin: 16px auto;
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    background: var(--auth-surface);
    box-shadow: 0 12px 32px rgb(0 0 0 / 12%);
    color: var(--auth-text);
    text-shadow: none;
}

.auth-refresh .auth-entry-card { width: min(100%, 440px); margin: 0; }
.auth-refresh .login-form {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
}
.auth-refresh .login-image { display: block; margin: 0 auto 16px; }
.auth-refresh :is(h1, .parent-title) {
    margin: 0 0 12px;
    color: var(--auth-text);
    font-size: clamp(1.375rem, 2.5vw, 1.625rem);
    line-height: 1.25;
    font-weight: 700;
    text-align: center;
    text-shadow: none;
}
.auth-refresh .auth-intro {
    margin: 0 0 24px;
    color: var(--auth-muted);
    font-size: 0.875rem;
    line-height: 1.55;
    text-align: center;
}
.auth-refresh :is(.login-form, .reset-container, .change-container, .activate-container, .onboarding-form-container) label {
    display: block;
    margin: 0 0 6px;
    color: var(--auth-text);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
}
.auth-refresh :is(.login-form, .reset-container, .change-container, .activate-container, .onboarding-form-container) :is(input:not([type="checkbox"]):not([type="hidden"]), select, textarea) {
    width: 100%;
    min-height: 44px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-field);
    color: var(--auth-text);
    font: 400 16px/1.4 Arial, sans-serif;
    box-shadow: none;
    text-shadow: none;
}
.auth-refresh :is(input, textarea)::placeholder { color: var(--auth-muted); opacity: 1; text-shadow: none; }
.auth-refresh :is(input, select, textarea):focus { border-color: var(--auth-accent); color: var(--auth-text); }
.auth-refresh :is(input, textarea)[readonly] { color: var(--auth-muted); background: var(--auth-canvas); }
.auth-refresh .password-container input { padding-right: 48px; }
.auth-refresh :is(#togglePassword, .toggle-password) {
    align-self: start;
    margin-top: 1px;
    color: var(--auth-muted);
}
.auth-refresh :is(.login-form button[type="submit"], .reset-submit, .change-submit, .activate-submit, .onboarding-submit) {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    margin: 8px 0 0;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font: 700 0.9375rem/1.5 Arial, sans-serif;
    box-shadow: none;
    text-shadow: none;
    transition: background-color 120ms ease;
}
.auth-refresh :is(.login-form button[type="submit"], .reset-submit, .change-submit, .activate-submit, .onboarding-submit):hover { background: #1d4ed8; }
.auth-refresh button:disabled { opacity: .65; cursor: wait; }
.auth-refresh .remember-me-container { display: flex; justify-content: flex-start; gap: 8px; margin-top: 8px; }
.auth-refresh .remember-me-container input { width: 18px; height: 18px; margin: 0; accent-color: #60a5fa; }
.auth-refresh .remember-me-container label { display: inline-flex; margin: 0; color: var(--auth-muted); }
.auth-refresh .passkey-login-panel { width: 100%; margin: 0 0 12px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.auth-refresh .passkey-login-button { min-height: 44px; border: 1px solid var(--auth-border); border-radius: 8px; background: var(--auth-field); color: var(--auth-text); box-shadow: none; }
.auth-refresh .passkey-login-divider { margin: 12px 0; color: var(--auth-muted); }
.auth-refresh :is(.signup-link, .reset-link) { margin: 0; font-size: .875rem; font-weight: 400; color: var(--auth-muted); text-align: center; }
.auth-refresh :is(.signup-link, .reset-link) p { margin: 0; }
.auth-refresh :is(.signup-link, .reset-link) a { color: var(--auth-accent); text-decoration: underline; text-underline-offset: 3px; }
.auth-refresh :is(.error-message, .change-error, .activate-error) { color: #fda4af; margin-top: 0; line-height: 1.5; }
.auth-refresh :is(.error-message-login, .success-message-login, .maintenance-notice) { width: min(100%, 440px); box-sizing: border-box; margin: 0; box-shadow: none; }
.auth-refresh .reset-response { margin: 0 0 16px; padding: 0; color: var(--auth-text); }
.auth-refresh .onboarding-container { width: calc(100% - 32px); max-width: 672px; margin: 0 auto; padding: 0; background: transparent; border: 0; box-shadow: none; }
.auth-refresh .onboarding-form-container { width: 100%; margin: 20px auto 0; }
.auth-refresh .onboarding-header-outside { max-width: min(640px, calc(100% - 32px)); margin: 8px auto 0; }
.auth-refresh .onboarding-header-outside img { width: 80px; height: auto; margin: 0 0 12px; }
.auth-refresh .child-title { color: var(--auth-muted); font-size: .875rem; font-weight: 400; margin-bottom: 8px; }
.auth-refresh .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 0; }
.auth-refresh .form-group { margin-bottom: 0; }
.auth-refresh :is(.reset-logo, .change-logo-center-img, .activate-logo-center-img) { width: 80px; height: auto; max-width: 100%; }
.auth-refresh :is(.reset-logo-center, .change-logo-center, .activate-logo-center) { margin-bottom: 16px; }
.auth-refresh :is(.language-button, #bug-icon, .back-arrow, .back-arrow-reset) { background: var(--auth-surface); color: var(--auth-muted); border: 1px solid var(--auth-border); border-radius: 8px; box-shadow: none; }
.auth-refresh #bug-icon { font-size: 22px; }
.auth-refresh :is(.back-arrow, .back-arrow-reset) { font-size: 22px; }
.auth-refresh .language-button img { width: 28px; }
.auth-refresh .footer { background: transparent; color: var(--auth-muted); font: 400 .75rem/1.5 Arial, sans-serif; }
@media (max-width: 540px) {
    .auth-refresh .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
