/* ============================================
   Auth – Login einheitlich Desktop & Mobile
   Register: Mobile/Tablet/Querformat
   ============================================ */

/* ─── Login: einheitliches Layout für Desktop und Mobile ─────────────────── */
body:has(.login-form) {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

body:has(.login-form) .container {
    width: 100%;
    max-width: min(100%, 420px);
    padding: 28px 20px 32px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    margin: auto;
    flex-shrink: 0;
    border-radius: 20px;
}

@media (max-width: 480px) {
    body:has(.login-form) {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    body:has(.login-form) .container {
        padding: 24px 16px 28px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    body.page-login:has(.login-form-2fa) .login-page,
    body.page-login:has(.login-form-2fa) .login-page__card.container,
    body.page-login:has(.login-form-2fa) .container {
        max-width: 100%;
    }
}

body:has(.login-form) h1 {
    font-size: clamp(22px, 5vw, 26px);
    margin-bottom: 24px;
    padding-left: 0;
    padding-right: 0;
    line-height: 1.3;
}

.login-form {
    margin-top: 24px;
    max-width: 100%;
    width: 100%;
}

.login-form-group,
.login-form .wizard-form-group {
    margin-bottom: 20px;
}

.login-form-group input,
.login-form .wizard-form-group input[type="text"],
.login-form .wizard-form-group input[type="email"],
.login-form .wizard-form-group input[type="password"] {
    min-height: 48px;
    padding: 14px;
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 9999px;
}

/* Password visibility toggle (eye button) – login and register */
.login-form .password-input-wrapper .input-field,
.password-input-wrapper .input-field {
    padding-right: 48px;
}
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.password-input-wrapper .input-field {
    flex: 1;
}
.password-toggle-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
/* Hover/active for login + register: login-page.css */
.password-toggle-btn:hover,
.password-toggle-btn:focus {
    outline: none;
}

.login-form .wizard-form-group label {
    gap: 12px;
    font-size: 15px;
    min-height: 44px;
    padding: 8px 0;
    align-items: center;
}

/* Login/Register identifier row: not a checkbox label — avoid tall min-height / padding from this sheet */
.login-form .wizard-form-group.login-identifier-group > label.login-identifier-dual-label,
body.page-register .register-account-step__form.login-form .wizard-form-group.login-identifier-group > label.login-identifier-dual-label {
    min-height: 0;
    min-width: 0;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
}

/* Register account: password labels are block labels, not checkbox rows */
body.page-register .register-account-step__form.login-form .register-step-reveal .wizard-form-group > label:not(.login-identifier-dual-label):not(.register-account-step__checkbox-label) {
    display: block !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 0 var(--login-label-gap, 6px) 0 !important;
    gap: 0 !important;
    align-items: stretch !important;
    cursor: default;
}

.login-form .wizard-form-group input[type="checkbox"],
#registerForm .wizard-form-group input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Checkbox checked: nur dunkelgrau, kein Häkchen (wie in forms.css) */
#registerForm .wizard-form-group input[type="checkbox"]:checked::after,
.login-form .wizard-form-group input[type="checkbox"]:checked::after {
    display: none;
}

.login-form .remember-me-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Remember me row: duration picker (login) — label + picker inline, linksbündig */
.login-form .remember-me-duration-picker {
    position: relative;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 4px 8px;
    margin: 0;
    padding: 4px 0;
    box-sizing: border-box;
    text-align: left;
}

.login-form .remember-me-duration-head {
    display: block;
    flex: 0 1 auto;
    align-self: center;
    min-width: 0;
    max-width: calc(100% - 6rem);
    margin: 0;
    padding: 0;
    text-align: left;
}

.login-form .remember-duration-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Vertical scroll-snap: rail width set by JS from label + stepper — min fallback until script runs */
.login-form .remember-duration-rail-wrap {
    --remember-duration-picker-h: 36px;
    --remember-duration-row: 36px;
    --remember-duration-stepper-w: 26px;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex: 0 0 auto;
    align-self: center;
    width: auto;
    min-width: calc(2.5rem + var(--remember-duration-stepper-w));
    max-width: 100%;
    height: var(--remember-duration-picker-h);
    margin: 0;
    overflow: hidden;
    border-radius: 9999px;
    box-sizing: border-box;
    border: none;
    background: transparent;
    transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .login-form .remember-duration-rail-wrap {
        transition: none;
    }
}

.login-form .remember-duration-rail-wrap:hover {
    background: transparent;
}

.login-form .remember-duration-rail-center {
    position: absolute;
    left: 2px;
    right: calc(2px + var(--remember-duration-stepper-w));
    top: 0;
    bottom: 0;
    width: auto;
    height: auto;
    margin: 0;
    transform: none;
    pointer-events: none;
    z-index: 1;
    border-radius: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
}

.login-form .remember-duration-scroller {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    /* proximity: langsames Scrollen bleibt nicht so leicht zwischen Snap-Punken „kleben“ wie bei mandatory */
    scroll-snap-type: y proximity;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, var(--login-title-color, #1a1a1a) 18%, var(--login-title-color, #1a1a1a) 82%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, var(--login-title-color, #1a1a1a) 18%, var(--login-title-color, #1a1a1a) 82%, transparent 100%);
    /* scrollbars.css sets * { scrollbar-width: thin !important } — must win here */
    scrollbar-width: none !important;
    scrollbar-color: transparent transparent !important;
    -ms-overflow-style: none !important;
    touch-action: pan-y;
}

/* WebKit / Chromium: kill track, thumb, arrows, corner (global *::-webkit-scrollbar uses !important) */
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar,
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar-track,
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar-track-piece,
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar-thumb,
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar-button,
.login-form #remember_duration_snap_scroller.remember-duration-scroller::-webkit-scrollbar-corner {
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    display: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.login-form .remember-duration-scroller:focus {
    outline: none;
}

.login-form .remember-duration-scroller:focus-visible {
    outline: none;
    box-shadow: none;
}

.login-form .remember-duration-scroller__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    padding: calc((var(--remember-duration-picker-h) - var(--remember-duration-row)) / 2) 4px;
    min-height: min-content;
}

/* Up / down step buttons: equal half-heights, flush (no gap), fill rail height */
.login-form .remember-duration-stepper {
    flex: 0 0 var(--remember-duration-stepper-w);
    width: var(--remember-duration-stepper-w);
    align-self: stretch;
    min-height: 0;
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    background: transparent;
    border: none;
    pointer-events: auto;
}

.login-form .remember-duration-step-btn {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    width: 100%;
    min-width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    color: var(--login-title-color, #1a1a1a);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: opacity 0.15s ease, background 0.12s ease;
}

.login-form .remember-duration-step-btn--up {
    border-top-right-radius: 9999px;
}

.login-form .remember-duration-step-btn--down {
    border-bottom-right-radius: 9999px;
}

.login-form .remember-duration-step-btn:hover:not(:disabled) {
    background: transparent;
}

.login-form .remember-duration-step-btn:active:not(:disabled) {
    background: transparent;
}

.login-form .remember-duration-step-btn:disabled {
    opacity: 0.32;
    cursor: default;
}

.login-form .remember-duration-step-btn:focus {
    outline: none;
}

.login-form .remember-duration-step-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.login-form .remember-duration-step-btn__shape {
    display: block;
    width: 0;
    height: 0;
    flex: 0 0 auto;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.login-form .remember-duration-step-btn--up .remember-duration-step-btn__shape {
    border-bottom: 5px solid currentColor;
    border-top: 0;
}

.login-form .remember-duration-step-btn--down .remember-duration-step-btn__shape {
    border-top: 5px solid currentColor;
    border-bottom: 0;
}

.login-form .remember-duration-snap-item {
    flex: 0 0 auto;
    scroll-snap-align: center;
    align-self: stretch;
    width: 100%;
    margin: 0;
    padding: 0 4px;
    min-height: var(--remember-duration-row);
    font-size: 13px;
    line-height: var(--remember-duration-row);
    border: none;
    border-radius: 0;
    background: transparent;
    color: color-mix(in srgb, var(--login-title-color, #1a1a1a) 52%, transparent);
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, font-weight 0.15s ease, opacity 0.15s ease;
    box-shadow: none;
    box-sizing: border-box;
}

.login-form .remember-duration-snap-item--selected {
    color: var(--login-title-color, #1a1a1a);
    font-weight: 700;
    opacity: 1;
}

.login-form .remember-duration-snap-item:not(.remember-duration-snap-item--selected) {
    opacity: 0.82;
}

.login-form .remember-duration-snap-item:hover {
    color: var(--login-title-color, #1a1a1a);
}

.login-form .remember-duration-snap-item--selected:hover {
    color: var(--login-title-color, #1a1a1a);
}

.login-form .remember-duration-snap-item:focus,
.login-form .remember-duration-snap-item:focus-visible {
    outline: none;
    box-shadow: none;
}

.login-button {
    min-height: 52px;
    padding: 16px 20px;
    margin-top: 24px;
    font-size: 16px;
    width: 100%;
    border-radius: 9999px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Google OAuth popup open: shrink to circle, G icon — outline ring = rotating gradient (login-page ::before on login; here for register) */
body.kinma-google-oauth-busy {
    --kinma-google-oauth-diameter: min(208px, calc(100vw - 32px));
}

/* Blocks interaction with the rest of the page; exempt islands use higher z-index */
body.kinma-google-oauth-busy::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.4);
    z-index: 12000;
    pointer-events: auto;
}

body.dark-mode.kinma-google-oauth-busy::before {
    background: rgba(0, 0, 0, 0.58);
}

/* Login (OAuth popup open): hide everything except title, “stay logged in”, Google (Kinma) button, Cloudflare hint */
body.kinma-google-oauth-busy.page-login .mobile-top-nav-row,
body.kinma-google-oauth-busy.page-login .settings-controls-container,
body.kinma-google-oauth-busy.page-login #chatPopup,
body.kinma-google-oauth-busy.page-login .wizard-form-group.login-identifier-group,
body.kinma-google-oauth-busy.page-login #login-password-field-wrap,
body.kinma-google-oauth-busy.page-login #login-password-actions,
body.kinma-google-oauth-busy.page-login .login-alt-divider,
body.kinma-google-oauth-busy.page-login .login-page__card > .links,
body.kinma-google-oauth-busy.page-login .login-page__card .error-message,
body.kinma-google-oauth-busy.page-login .login-page__card .success-message {
    display: none !important;
}

/* Above dimming overlay */
body.kinma-google-oauth-busy.page-login h1.login-page__title,
body.kinma-google-oauth-busy.page-login .login-page__oauth-wait-hint,
body.kinma-google-oauth-busy.page-login .remember-me-row--always-on,
body.kinma-google-oauth-busy.page-login .login-passkey-google-row {
    position: relative;
    z-index: 12001;
}

body.kinma-google-oauth-busy.page-login #login-cf-bottom-dock {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12001 !important;
}

body.kinma-google-oauth-busy.page-login #login-cf-trust-footer {
    z-index: 12001 !important;
}

/* Cancel control: centered in circle, no chip background; X replaces G on hover (fine) / always on touch */
.login-google-oauth-circle-wrap {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

body.page-login .login-passkey-google-row__pair > .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) {
    align-self: center;
}

.login-google-oauth-cancel {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 8;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    transition: none;
}

/* Hover lift when cancel is interactive (no transition — instant G↔X elsewhere) */
.login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) .login-google-oauth-cancel:hover,
.login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) .login-google-oauth-cancel:focus-visible {
    transform: translate(-50%, -50%) scale(1.06);
}

.login-google-oauth-cancel__icon {
    display: block;
    width: min(124px, calc(var(--kinma-google-oauth-diameter, 208px) * 0.56));
    height: auto;
    overflow: visible;
}

.login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) .login-google-oauth-cancel {
    display: flex;
}

/* Fine pointer: instant swap G ↔ X */
@media (hover: hover) and (pointer: fine) {
    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting):hover .login-google-oauth-busy-g,
    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting):focus-within .login-google-oauth-busy-g {
        opacity: 0;
        animation: none;
    }

    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting):hover .login-google-oauth-cancel,
    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting):focus-within .login-google-oauth-cancel {
        opacity: 1;
        transform: translate(-50%, -50%);
        pointer-events: auto;
    }
}

/* Touch: instant swap */
@media (hover: none), (pointer: coarse) {
    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) .login-google-oauth-busy-g {
        opacity: 0;
        animation: none;
    }

    .login-google-oauth-circle-wrap:has(.login-button-google.is-google-oauth-waiting) .login-google-oauth-cancel {
        opacity: 1;
        transform: translate(-50%, -50%);
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-google-oauth-cancel,
    .login-button.login-button-google.is-google-oauth-waiting .login-google-oauth-busy-g {
        transition: none;
    }

    .login-google-oauth-cancel__icon animateTransform {
        display: none;
    }
}

body.kinma-google-oauth-busy.page-register .register-account-step__oauth-reveal,
body.kinma-google-oauth-busy.page-register .register-account-step > h1.login-page__title {
    position: relative;
    z-index: 12001;
}

@keyframes kinma-google-login-border-spin {
    from {
        transform: rotate(0deg) translateZ(0);
    }
    to {
        transform: rotate(360deg) translateZ(0);
    }
}

@property --kinma-google-ring-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes kinma-google-ring-shift {
    0% {
        --kinma-google-ring-angle: 0deg;
    }
    20% {
        --kinma-google-ring-angle: 113deg;
    }
    40% {
        --kinma-google-ring-angle: 241deg;
    }
    60% {
        --kinma-google-ring-angle: 67deg;
    }
    80% {
        --kinma-google-ring-angle: 312deg;
    }
    100% {
        --kinma-google-ring-angle: 0deg;
    }
}

/* Softer drift behind the ring (loading + hover share name; easing set on each animation) */
@keyframes kinma-google-login-bg-flow {
    0%,
    100% {
        background-position: 0% 35%;
    }
    20% {
        background-position: 50% 42%;
    }
    40% {
        background-position: 92% 52%;
    }
    60% {
        background-position: 72% 90%;
    }
    80% {
        background-position: 22% 24%;
    }
}

body.page-login .login-button.login-button-secondary.login-button-google {
    transition:
        width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        min-height 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        max-width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        border-radius 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        padding 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background-color 0.22s ease;
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting {
    pointer-events: none;
    gap: 0;
    justify-content: center;
    align-items: center;
    width: var(--kinma-google-oauth-diameter) !important;
    max-width: var(--kinma-google-oauth-diameter);
    height: var(--kinma-google-oauth-diameter);
    min-height: var(--kinma-google-oauth-diameter);
    padding: 0;
    border-radius: 50%;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
    overflow: hidden;
    /* Pill→circle: time-reversed bezier vs. base rule (circle→pill) */
    transition:
        width 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        height 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        min-height 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        max-width 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        border-radius 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        padding 0.65s cubic-bezier(0.64, 0, 0.78, 0),
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background-color 0.22s ease;
}

/* Login-only mobile fallback when login-page ::before is unavailable */
body.page-login .login-button.login-button-secondary.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon)::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
        from var(--kinma-google-ring-angle, 0deg),
        #4285f4 0deg,
        #ea4335 72deg,
        #fbbc05 144deg,
        #34a853 216deg,
        #4285f4 288deg,
        #4285f4 360deg
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
    backface-visibility: hidden;
    will-change: --kinma-google-ring-angle;
    animation: kinma-google-ring-shift 6s steps(1, end) infinite;
    transform: none;
    transform-origin: center center;
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) {
    position: relative;
    border: none;
    transform: scale(1.02);
    background-color: #ffffff;
    background-image: none;
    animation: none;
    box-shadow:
        0 2px 10px rgba(66, 133, 244, 0.14),
        0 2px 11px rgba(234, 67, 53, 0.09),
        0 2px 11px rgba(251, 188, 4, 0.09),
        0 2px 10px rgba(52, 168, 83, 0.1);
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) > * {
    position: relative;
    z-index: 1;
}

body.dark-mode.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) {
    background-color: #1a1a1a;
    background-image: none;
    animation: none;
    box-shadow:
        0 2px 11px rgba(66, 133, 244, 0.15),
        0 2px 12px rgba(234, 67, 53, 0.09),
        0 2px 12px rgba(251, 188, 4, 0.08),
        0 2px 11px rgba(52, 168, 83, 0.1);
    color: #f8fafc;
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) .login-google-oauth-busy-g {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.55))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.28));
}

body.dark-mode.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) .login-google-oauth-busy-g {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.55))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.28));
}

body.page-login .login-button.login-button-google .login-button-google__idle,
body.page-register .register-account-step .login-button.login-button-google .login-button-google__idle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: inherit;
    flex: 1 1 auto;
    min-width: 0;
}

body.page-login .login-button.login-button-google.login-button--with-leading-icon .login-button-google__idle,
body.page-register .register-account-step .login-button.login-button-google.login-button--with-leading-icon .login-button-google__idle {
    width: 100%;
    gap: 10px;
}

body.page-login .login-button.login-button-google .login-button-google__oauth-busy,
body.page-register .register-account-step .login-button.login-button-google .login-button-google__oauth-busy {
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    width: auto;
    height: auto;
    flex: 0 0 auto;
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting .login-button-google__idle,
body.page-register .register-account-step .login-button.login-button-google.is-google-oauth-waiting .login-button-google__idle {
    display: none !important;
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting .login-button-google__oauth-busy,
body.page-register .register-account-step .login-button.login-button-google.is-google-oauth-waiting .login-button-google__oauth-busy {
    display: inline-flex !important;
}

@keyframes kinma-google-oauth-icon-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.86;
    }
}

body.page-login .login-button.login-button-google.is-google-oauth-waiting .login-google-oauth-busy-g,
body.page-register .register-account-step .login-button.login-button-google.is-google-oauth-waiting .login-google-oauth-busy-g {
    transform-origin: center center;
    transition: none;
    animation: kinma-google-oauth-icon-pulse 2.75s cubic-bezier(0.42, 0.12, 0.38, 0.88) infinite;
}

.login-google-oauth-busy-g {
    display: block;
    width: min(88px, calc(var(--kinma-google-oauth-diameter, 208px) * 0.42));
    height: auto;
    max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    body.page-login .login-button.login-button-secondary.login-button-google {
        transition-duration: 0.01ms !important;
    }

    body.page-login .login-button.login-button-secondary.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon)::before {
        animation: none;
    }

    body.page-login .login-button.login-button-google.is-google-oauth-waiting:not(.login-button--with-leading-icon) {
        animation: none;
        background-position: 48% 52%;
    }

    body.page-login .login-button.login-button-google.is-google-oauth-waiting .login-google-oauth-busy-g,
    body.page-register .register-account-step .login-button.login-button-google.is-google-oauth-waiting .login-google-oauth-busy-g {
        animation: none;
    }
}

.login-2fa-hint {
    font-size: 15px;
    margin-top: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.login-2fa-cooldown {
    font-size: 14px;
    margin: 0 0 10px;
    line-height: 1.4;
    color: #b45309;
    text-align: center;
}

body.dark-mode .login-2fa-cooldown {
    color: #fbbf24;
}

.login-form-2fa .login-button {
    margin-top: 16px;
}

.login-2fa-resend {
    margin-top: 12px;
    font-size: 14px;
}

.login-2fa-resend a {
    padding: 8px 0;
    display: inline-block;
    min-height: 44px;
    line-height: 28px;
}

.login-back-link {
    margin-top: 20px;
    font-size: 14px;
    text-align: center;
}

/* Same treatment as .links a ("Zurück zur Anmeldung" etc.): text link, no chip background */
.login-back-link a {
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    line-height: 1.2;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
}

.login-back-link a:hover {
    color: #6c757d;
}

body.dark-mode .login-back-link a {
    color: #e5e7eb;
}

body.dark-mode .login-back-link a:hover {
    color: #9ca3af;
}

body:has(.login-form) .links {
    margin-top: 28px;
    padding: 0 4px;
}

body:has(.login-form) .links a {
    font-size: 15px;
    padding: 10px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

body:has(.login-form) .links a.links__register-split {
    font-weight: 400;
}

body:has(.login-form) .links a.links__register-split .links__register-split-action {
    font-weight: 700;
}

body:has(.login-form) .messages,
body:has(.login-form) [class*="message"] {
    max-width: 100%;
    word-wrap: break-word;
}


/* ============================================
   Wizard Mobile (Person erstellen) — Register: register-wizard-layout.css
   ============================================ */

/* Logo in der Wizard-Leiste ausblenden (Kinma über settings-controls / Desktop-Parität) */
.wizard-top-kinma {
    display: none;
}

@media (max-width: 1024px) {

    /* Person erstellen-bearbeiten: Kinma in der Wizard-Leiste */
    body.page-person-wizard .settings-controls-container .settings-top-left,
    body.page-persons:has(#createPersonForm) .settings-controls-container .settings-top-left {
        display: none !important;
    }

    /* Logo in der Wizard-Leiste: sauber zentriert, proportionale Größe */
    .wizard-top-kinma {
        display: flex !important;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        order: 0;
    }

    .wizard-top-kinma .kinma-logo-in-wizard {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: none;
        background: transparent;
        cursor: pointer;
        position: relative;
        overflow: visible;
        -webkit-tap-highlight-color: transparent;
    }
    .wizard-top-kinma .kinma-lang-outline {
        position: absolute;
        inset: -2px;
        border-radius: 50%;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        border: 2px solid rgba(255, 255, 255, 0.95);
        box-sizing: border-box;
    }
    .wizard-top-kinma .kinma-lang-inner {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #fff;
    }
    .wizard-top-kinma .settings-logo-img {
        position: relative;
        z-index: 2;
        width: 26px;
        height: 26px;
        object-fit: contain;
        display: block;
    }

    /* ─── Layout: eine Scrollfläche, Header sticky – Inhalt beginnt immer unter dem Header ─── */
    .wizard-layout {
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: 0;
        box-sizing: border-box;
        display: block;
    }

    /* Header im Fluss, klebt beim Scrollen oben – keine festen Pixel nötig */
    .wizard-layout .wizard-island-top {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        padding: 12px 16px 14px !important;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
        width: 100% !important;
        max-width: none !important;
        min-height: 72px;
        height: auto;
        max-height: none;
        flex-shrink: 0;
        z-index: 1000;
        border-radius: 0 0 20px 20px;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 8px;
        flex-wrap: nowrap;
        overflow: visible;
        box-sizing: border-box;
    }

    /* Kinma links in der Leiste, vertikal zentriert */
    .wizard-island-top .wizard-top-kinma {
        position: absolute !important;
        left: max(16px, env(safe-area-inset-left));
        top: 50%;
        transform: translateY(-50%);
        bottom: auto;
        margin: 0;
    }

    .wizard-island-top .wizard-title {
        font-size: 18px;
        font-weight: 600;
        white-space: nowrap;
        text-align: center;
        width: 100%;
        flex: 0 0 auto;
        margin: 0;
        order: 1;
        padding-left: 52px;
        padding-right: 52px;
        box-sizing: border-box;
        line-height: 1.3;
    }

    /* Zeile 2: Stepper volle Breite, gleichmäßig verteilt */
    .wizard-island-top .wizard-steps {
        width: 100%;
        flex: 0 0 auto;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 0;
        order: 2;
        min-width: 0;
        padding-top: 4px;
    }

    .wizard-island {
        min-width: 0 !important;
        border-radius: 16px !important;
        position: relative !important;
        left: auto !important;
        transform: none !important;
    }

    /* Stepper: größere Kreise, nur Nummern sichtbar (Labels ausgeblendet für mehr Platz) */
    body.page-person-wizard .wizard-step .step-number,
    body.page-persons:has(#createPersonForm) .wizard-step .step-number {
        width: 32px;
        height: 32px;
        font-size: 13px;
        font-weight: 600;
    }
    body.page-person-wizard .wizard-step:not(:last-child) .step-number,
    body.page-persons:has(#createPersonForm) .wizard-step:not(:last-child) .step-number {
        margin-right: 0;
    }
    body.page-person-wizard .wizard-steps::before,
    body.page-persons:has(#createPersonForm) .wizard-steps::before {
        top: 16px;
        left: 16px;
        right: 16px;
        height: 2px;
    }
    body.page-person-wizard .wizard-step,
    body.page-persons:has(#createPersonForm) .wizard-step {
        flex: 1;
        min-width: 0;
    }
    body.page-person-wizard .wizard-step .step-label,
    body.page-persons:has(#createPersonForm) .wizard-step .step-label {
        display: none;
    }

    /* Form-Bereich im Fluss direkt unter dem Header, unten Platz für fixe Buttons */
    .wizard-layout .wizard-form-layer {
        padding-top: 12px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        overflow: visible;
        display: block;
    }

    .wizard-layout .wizard-form-layer .container {
        width: 100%;
        max-width: 100%;
        padding: 12px 16px 28px !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        box-sizing: border-box;
    }

    /* Profil-Vorschau: .container-Padding (12px/16px oben) sonst sichtbarer Rand — komplett 0 */
    body.kinma-wizard-profile-preview-step .wizard-layout .wizard-form-layer .container,
    body:has(.wizard-content > div:not(.hidden):has(#profile-preview-wrapper)) .wizard-layout .wizard-form-layer .container,
    body:has(> #profile-preview-wrapper) .wizard-layout .wizard-form-layer .container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Vollflächen-Vorschau: kein seitliches Layout-Padding, Scroll in #profile-preview-wrapper */
    body.kinma-wizard-profile-preview-step .wizard-layout,
    body:has(.wizard-content > div:not(.hidden):has(#profile-preview-wrapper)) .wizard-layout,
    body:has(> #profile-preview-wrapper) .wizard-layout {
        overflow: visible !important;
        height: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    body.kinma-wizard-profile-preview-step .wizard-layout .wizard-form-layer,
    body:has(.wizard-content > div:not(.hidden):has(#profile-preview-wrapper)) .wizard-layout .wizard-form-layer,
    body:has(> #profile-preview-wrapper) .wizard-layout .wizard-form-layer {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.kinma-wizard-profile-preview-step .wizard-layout .wizard-buttons-island,
    body:has(.wizard-content > div:not(.hidden):has(#profile-preview-wrapper)) .wizard-layout .wizard-buttons-island,
    body:has(> #profile-preview-wrapper) .wizard-layout .wizard-buttons-island {
        z-index: 1003 !important;
    }

    .wizard-content {
        min-height: 0;
    }

    /* Register: Grunddaten-Grid auf schmalen Screens 1 Spalte */
    .wizard-step-grunddaten {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .wizard-step-grunddaten .name-inputs-container {
        grid-template-columns: 1fr !important;
    }

    .wizard-form-group input,
    .wizard-form-group select,
    .wizard-form-group textarea {
        min-height: 48px;
        font-size: 16px;
        box-sizing: border-box;
        width: 100%;
    }

    .wizard-form-group input[type="text"],
    .wizard-form-group input[type="email"],
    .wizard-form-group input[type="password"],
    .wizard-form-group input[type="date"] {
        padding: 12px 16px;
    }

    /* Combobox: nicht 100% Breite erzwingen — Chevron bleibt in der Zeile */
    .wizard-form-group .country-combobox-wrapper .country-text-input,
    .wizard-form-group .city-combobox-wrapper .city-text-input {
        width: auto !important;
        flex: 1 1 auto;
        min-width: 0;
        padding-left: 0;
        padding-right: 4px;
    }

    /* Wizard-Buttons: fixiert am unteren Rand, nimmt keinen Platz im Layout */
    .wizard-layout .wizard-buttons-island {
        position: fixed !important;
        left: 12px;
        right: 12px;
        bottom: max(16px, env(safe-area-inset-bottom));
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 10px 12px !important;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        border-radius: 16px !important;
        transform: none !important;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        flex: none !important;
        flex-shrink: 0 !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .wizard-buttons-island .wizard-buttons {
        flex-wrap: nowrap;
        gap: 8px;
        justify-content: center;
        width: 100%;
    }

    .wizard-buttons .btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 14px;
        min-width: 0;
        flex: 1 1 0;
        -webkit-tap-highlight-color: transparent;
    }

    .wizard-buttons .wizard-back-to-login-btn {
        flex: 0 0 auto;
        min-width: 0;
    }

    /* Register: Link „Bereits registriert?“ – Abstand über der fixierten Leiste */
    .wizard-layout .links {
        margin-top: 24px;
        padding: 0 12px 24px;
    }
}

/* Sehr schmale Screens: Titel etwas kleiner */
@media (max-width: 380px) {
    .wizard-island-top .wizard-title {
        font-size: 16px;
    }
}

/* ============================================
   Join / Invitation page – Desktop & Mobile
   Kinma logo oben, Karte zentriert, Buttons gut klickbar
   ============================================ */
body:has(.page-join-invite) {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.join-invite-flash {
    width: 100%;
    max-width: min(100%, 480px);
    margin: 0 auto 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.45;
    box-sizing: border-box;
}

.join-invite-flash--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

body.dark-mode .join-invite-flash--error {
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.page-join-invite {
    width: 100%;
    max-width: min(100%, 480px);
    margin: 0 auto;
    padding: 24px 20px 32px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    flex-shrink: 0;
}

.join-invite-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 32px 28px 36px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.join-invite-title {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    margin: 0 0 12px;
    line-height: 1.3;
}

.join-invite-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: #1a1a1a;
    text-align: center;
    margin: 0 0 16px;
    line-height: 1.5;
}

.join-invite-hint {
    font-size: 0.9375rem;
    color: #6c757d;
    text-align: center;
    margin: 0 0 28px;
    line-height: 1.5;
}

.join-invite-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.join-invite-btn {
    display: block;
    text-align: center;
    padding: 14px 24px;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    min-height: 48px;
    line-height: 1.25;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.join-invite-btn-primary {
    background: #1a1a1a;
    color: #ffffff;
    border: none;
}

.join-invite-btn-primary:hover {
    background: #1a1a1a;
    color: #fff;
}

.join-invite-btn-secondary {
    background: #f8f9fa;
    color: #1a1a1a;
    border: 1px solid #dee2e6;
}

.join-invite-btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #1a1a1a;
}

@media (max-width: 480px) {
    body:has(.page-join-invite) {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .page-join-invite {
        padding: 16px 16px 28px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .join-invite-card {
        padding: 28px 20px 32px;
    }
    .join-invite-actions {
        gap: 10px;
    }
}

/* Optional: wenn Settings-Controls (Kinma-Leiste) sichtbar ist, etwas Abstand nach unten */
body:has(.page-join-invite) .settings-controls-wrapper {
    flex-shrink: 0;
}

/* Familienwechsel-Modal (z-index 10050): Kinma-Leiste darüber, damit Logo/Legal-Menü klickbar bleibt */
body:has(.page-join-invite--switch) .settings-controls-container {
    z-index: 10060;
}

/* Familienwechsel per Einladung: zweistufiges Modal (kein Link-Verbrauch vor POST) */
.page-join-invite--switch {
    position: relative;
    min-height: 50vh;
}

.join-invite-card--switch {
    opacity: 0.35;
    pointer-events: none;
    margin-bottom: 0;
}

.join-switch-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
}

.join-switch-modal--hidden,
.join-switch-modal[hidden] {
    display: none !important;
}

.join-switch-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
}

.join-switch-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    border: 1px solid #e9ecef;
    max-height: min(90vh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.join-switch-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px;
    line-height: 1.3;
    text-align: center;
}

.join-switch-modal__text {
    font-size: 0.9375rem;
    color: #1a1a1a;
    line-height: 1.55;
    margin: 0 0 12px;
    text-align: center;
}

.join-switch-modal__family-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    font-weight: 600;
    font-size: 1.0625rem;
    color: #1a1a1a;
}

.join-switch-modal__family-name {
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

.join-switch-modal__family-arrow-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    line-height: 0;
}

.join-switch-modal__text--muted {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 4px;
}

body.dark-mode .join-switch-modal__family-row {
    color: #f1f5f9;
}

body.dark-mode .join-switch-modal__family-arrow-icon {
    color: #94a3b8;
}

body.dark-mode .join-switch-modal__text--muted {
    color: #94a3b8;
}

.join-switch-modal__meta {
    font-size: 0.875rem;
    color: #6c757d;
    text-align: center;
    margin: 0 0 20px;
}

.join-switch-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.join-switch-modal__actions .join-invite-btn {
    width: 100%;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.join-switch-modal__actions--stack form {
    margin: 0;
    width: 100%;
}

.join-switch-modal__submit {
    width: 100%;
}

.join-switch-modal__confirm-summary {
    margin-top: 6px;
    margin-bottom: 18px;
}

body.dark-mode .join-switch-modal__backdrop {
    background: rgba(0, 0, 0, 0.55);
}

body.dark-mode .join-switch-modal__panel {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

body.dark-mode .join-switch-modal__title {
    color: #f1f5f9;
}

body.dark-mode .join-switch-modal__text,
body.dark-mode .join-switch-modal__meta {
    color: #cbd5e1;
}

/* ============================================
   Person erstellen / bearbeiten — Wizard wie Register
   ============================================ */
body.page-persons:has(#createPersonForm) .wizard-form-group select:not(.wizard-relationships-select) {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 2px solid #e9ecef;
    font-size: 16px;
    background: transparent;
    color: #1a1a1a;
    border-radius: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
body.page-persons:has(#createPersonForm) .wizard-form-group select:not(.wizard-relationships-select):focus {
    outline: none;
    border-bottom-color: #1a1a1a;
}

body.page-persons:has(#createPersonForm) .relationships-section {
    max-width: 100%;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-section {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 48%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px 24px 32px;
    box-shadow: 0 1px 3px rgba(26, 26, 26, 0.06);
    width: 100%;
    box-sizing: border-box;
}
/* Kopfzeile: Erklärung links, Dropdowns rechts — volle Breite */
body.page-persons:has(#createPersonForm) .wizard-relationships-top {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.2fr);
    gap: 24px 36px;
    align-items: start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}
@media (max-width: 768px) {
    body.page-persons:has(#createPersonForm) .wizard-relationships-top {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
body.page-persons:has(#createPersonForm) .wizard-relationships-intro {
    margin-bottom: 0;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
}
body.page-persons:has(#createPersonForm) .relationships-description {
    color: #64748b;
    font-size: 15px;
    margin: 0;
    line-height: 1.55;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
    margin-bottom: 0;
}
@media (max-width: 640px) {
    body.page-persons:has(#createPersonForm) .wizard-relationships-fields {
        grid-template-columns: 1fr;
    }
}
/* Hauptbereich: Stammbaum-Vorschau | automatische Beziehungen */
body.page-persons:has(#createPersonForm) .wizard-relationships-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 28px;
    align-items: stretch;
    min-height: 0;
}
@media (max-width: 900px) {
    body.page-persons:has(#createPersonForm) .wizard-relationships-body {
        grid-template-columns: 1fr;
    }
}
body.page-persons:has(#createPersonForm) .wizard-relationships-body:has(#wizard-tree-placement-preview[hidden]) .wizard-relationships-col--preview {
    display: none;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-body:has(#wizard-tree-placement-preview[hidden]) {
    grid-template-columns: 1fr;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-auto-empty {
    flex: 1;
    margin: 0;
    padding: 24px 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #64748b;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    box-sizing: border-box;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-auto-empty[hidden] {
    display: none !important;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-field label {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    display: block;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    color: #1a1a1a;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.page-persons:has(#createPersonForm) .wizard-relationships-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview {
    margin-top: 0;
    flex: 1;
    min-height: 240px;
    padding: 18px 16px 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview[hidden] {
    display: none !important;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview__head {
    margin-bottom: 12px;
    text-align: left;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px 0;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview__hint {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview__viewport {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: min(340px, 48vh);
    min-height: 200px;
    padding: 12px 0 8px;
    -webkit-overflow-scrolling: touch;
}
body.page-persons:has(#createPersonForm) .wizard-tree-preview-mini {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    transform: scale(0.42);
    transform-origin: top center;
    flex-shrink: 0;
}
body.page-persons:has(#createPersonForm) .wizard-tree-preview-mini .tree-person-box {
    pointer-events: none;
    cursor: default;
}
body.page-persons:has(#createPersonForm) .wizard-tree-preview-mini .tree-person-box.is-new-person {
    box-shadow:
        inset 0 0 0 1px #ffffff,
        0 8px 24px rgba(99, 102, 241, 0.18),
        0 0 0 3px rgba(99, 102, 241, 0.35);
}
body.page-persons:has(#createPersonForm) .wizard-tree-preview-mini .wizard-tree-preview-middle {
    position: absolute;
    z-index: 4;
    text-align: center;
    font-size: 12px;
    line-height: 1.3;
    color: #1a1a1a;
    background: rgba(255, 255, 255, 0.92);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
    box-sizing: border-box;
    pointer-events: none;
}
body.page-persons:has(#createPersonForm) .wizard-tree-placement-preview__note {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    margin: 10px 0 0 0;
    line-height: 1.45;
}
body.page-persons:has(#createPersonForm) .auto-relationships-preview {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    margin-top: 0;
    padding: 18px 16px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
body.page-persons:has(#createPersonForm) .auto-relationships-preview.auto-relationships-preview--visible {
    display: flex;
}
body.page-persons:has(#createPersonForm) .auto-relationships-header {
    flex-shrink: 0;
}
body.page-persons:has(#createPersonForm) .auto-relationships-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px 0;
}
body.page-persons:has(#createPersonForm) .auto-relationships-header p {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 14px 0;
    line-height: 1.45;
}
body.page-persons:has(#createPersonForm) .relationships-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
    max-height: min(52vh, 520px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 901px) {
    body.page-persons:has(#createPersonForm) .wizard-relationships-body:not(:has(#wizard-tree-placement-preview[hidden])) .relationships-grid {
        max-height: min(58vh, 560px);
    }
}
body.page-persons:has(#createPersonForm) .relationship-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}
body.page-persons:has(#createPersonForm) .relationship-biological-option {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-top: 12px;
}
body.page-persons:has(#createPersonForm) .relationship-biological-option label {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1a1a1a;
}
body.page-persons:has(#createPersonForm) .relationship-biological-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}
body.page-persons:has(#createPersonForm) .relationships-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 32px;
    color: #6c757d;
}
body.page-persons:has(#createPersonForm) .relationships-empty svg {
    margin-bottom: 16px;
}
body.page-persons:has(#createPersonForm) .relationships-empty p {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}
body.page-persons:has(#createPersonForm) .relationships-empty span {
    font-size: 14px;
    opacity: 0.7;
}
body.page-persons:has(#createPersonForm) .relationship-primary {
    border: 2px solid #1a1a1a;
}
body.page-persons:has(#createPersonForm) .relationship-badge {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
}
body.page-persons:has(#createPersonForm) .relationship-badge-auto {
    display: inline-block;
    background: #28a745;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
}
body.page-persons:has(#createPersonForm) .relationship-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
}
body.page-persons:has(#createPersonForm) .relationship-card:hover {
    border-color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
body.page-persons:has(#createPersonForm) .relationship-card-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}
body.page-persons:has(#createPersonForm) .relationship-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    flex-shrink: 0;
}
body.page-persons:has(#createPersonForm) .relationship-card:hover .relationship-icon {
    background: #1a1a1a;
    color: #ffffff;
}
body.page-persons:has(#createPersonForm) .relationship-info {
    flex: 1;
    min-width: 0;
}
body.page-persons:has(#createPersonForm) .relationship-person-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.page-persons:has(#createPersonForm) .relationship-type {
    font-size: 14px;
    color: #6c757d;
}
body.page-persons:has(#createPersonForm) .relationship-remove-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}
body.page-persons:has(#createPersonForm) .relationship-remove-btn:hover {
    background: #fff5f5;
    opacity: 1;
}
body.page-persons:has(#createPersonForm) .btn-add-relationship {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: #ffffff;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}
body.page-persons:has(#createPersonForm) .btn-add-relationship:hover {
    border-color: #1a1a1a;
    background: #f8f9fa;
}
body.page-persons:has(#createPersonForm) .btn-add-relationship svg {
    transition: transform 0.2s ease;
}
body.page-persons:has(#createPersonForm) .btn-add-relationship:hover svg {
    transform: rotate(90deg);
}
body.page-persons:has(#createPersonForm) .relationship-modal-overlay {
    animation: personCreateFadeIn 0.2s ease;
}
@keyframes personCreateFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
body.page-persons:has(#createPersonForm) .relationship-modal {
    animation: personCreateSlideUp 0.3s ease;
}
@keyframes personCreateSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
body.page-persons:has(#createPersonForm) .relationship-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
body.page-persons:has(#createPersonForm) .relationship-modal-header button:hover {
    color: #1a1a1a;
}
body.page-persons:has(#createPersonForm) .btn-modal-cancel,
body.page-persons:has(#createPersonForm) .btn-modal-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
body.page-persons:has(#createPersonForm) .btn-modal-cancel {
    background: #f8f9fa;
    color: #6c757d;
}
body.page-persons:has(#createPersonForm) .btn-modal-cancel:hover {
    background: #e9ecef;
    color: #1a1a1a;
}
body.page-persons:has(#createPersonForm) .btn-modal-primary {
    background: #1a1a1a;
    color: #ffffff;
}
body.page-persons:has(#createPersonForm) .btn-modal-primary:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
body.page-persons:has(#createPersonForm) .skip-relationships-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    width: 100%;
}
body.page-persons:has(#createPersonForm) .skip-relationships-desc {
    margin-top: 8px;
    color: #6c757d;
    font-size: 14px;
}

/* Wizard Profil-Vorschau: globales .container (padding 48px 32px) — letzte Regel, alle Viewports */
body.kinma-wizard-profile-preview-step .wizard-layout .wizard-form-layer .container,
body:has(> #profile-preview-wrapper) .wizard-layout .wizard-form-layer .container,
body:has(.wizard-content > div:not(.hidden):has(#profile-preview-wrapper)) .wizard-layout .wizard-form-layer .container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
