:root {
    --auth-map-width: max(100vw, 50.01vh);
    --auth-map-height: max(199.97vw, 100vh);
    --auth-login-card-height: 720px;
    --auth-signup-card-height: 840px;
}

html,
body {
    overflow-x: hidden;
}

.container.wh-container-med {
    width: min(560px, calc(100vw - 24px));
    min-height: var(--auth-map-height);
}

#admin-background {
    position: absolute !important;
    left: 50% !important;
    top: 0 !important;
    width: var(--auth-map-width) !important;
    height: var(--auth-map-height) !important;
    max-width: none !important;
    transform: translateX(-50%);
    object-fit: cover;
    object-position: center top;
    filter: saturate(0.96) contrast(1.02);
    opacity: 0.98;
    pointer-events: none;
}

.container .wh-card {
    --auth-card-height: var(--auth-login-card-height);

    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 24px));
    max-width: 560px;
    height: min(var(--auth-card-height), calc(100vh - 32px));
    margin: 0;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 26px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(14px);
    transition: height 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.container .wh-card[data-auth-mode="signup"],
.container .wh-card:has(.auth-shell[data-auth-mode="signup"]) {
    --auth-card-height: var(--auth-signup-card-height);
}

.auth-shell {
    --auth-accent: #0f766e;
    --auth-accent-strong: #0a5d57;
    --auth-border: rgba(15, 23, 42, 0.10);
    --auth-text-muted: #5b6678;

    padding: 28px 28px 24px;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(250, 252, 251, 0.96), rgba(255, 255, 255, 0.98));
    box-sizing: border-box;
}

.auth-shell *,
.auth-shell *::before,
.auth-shell *::after {
    box-sizing: border-box;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.10);
    color: var(--auth-accent-strong);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-message-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-message {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
}

.auth-message--success {
    color: #065f46;
    background: rgba(16, 185, 129, 0.14);
}

.auth-message--error {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.14);
}

.auth-message--warning {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
}

.auth-message--info {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
}

.auth-forms,
.auth-org-panels {
    overflow: hidden;
}

.auth-forms {
    flex: 1 1 auto;
    min-height: 0;
}

.auth-forms__track,
.auth-org-panels__track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 200%;
    height: 100%;
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-forms__track > *,
.auth-org-panels__track > * {
    min-width: 0;
}

.auth-shell[data-auth-mode="signup"] .auth-forms__track,
.auth-shell[data-org-mode="join"] .auth-org-panels__track {
    transform: translateX(-50%);
}

.auth-form-panel {
    padding-right: 16px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.auth-form-panel--signup {
    padding-left: 16px;
    padding-right: 0;
}

.auth-form-panel__intro {
    margin-bottom: 20px;
}

.auth-form-panel__intro h1 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.08;
    color: #0f172a;
}

.auth-form-panel__intro p {
    margin: 0;
    color: var(--auth-text-muted);
    line-height: 1.6;
}

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

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

.auth-field label {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.auth-field input {
    width: 100%;
    min-height: 52px;
    padding: 0 15px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.42);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.10);
}

.auth-field input.auth-code-input {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

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

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

.auth-form-errors,
.auth-field .errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-form-errors {
    padding: 13px 14px;
    border-radius: 14px;
    color: #991b1b;
    background: rgba(239, 68, 68, 0.12);
}

.auth-field .errorlist {
    font-size: 13px;
    line-height: 1.45;
    color: #b91c1c;
}

.auth-turnstile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 65px;
}

.auth-turnstile .cf-turnstile {
    width: min(100%, 420px);
    min-height: 65px;
}

.auth-turnstile iframe {
    display: block;
    max-width: 100%;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-strong) 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 34px rgba(15, 118, 110, 0.20);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.auth-submit:hover,
.auth-submit:focus {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px rgba(15, 118, 110, 0.24);
}

.auth-footer-link {
    margin: 16px 0 0;
    color: var(--auth-text-muted);
    line-height: 1.6;
}

.auth-footer-link a,
.auth-inline-toggle {
    color: var(--auth-accent-strong);
    font-weight: 700;
    text-decoration: none;
}

.auth-footer-link a:hover,
.auth-footer-link a:focus,
.auth-inline-toggle:hover,
.auth-inline-toggle:focus {
    text-decoration: none;
    color: #094b46;
}

.auth-inline-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
}

.auth-inline-toggle__text {
    overflow-wrap: break-word;
}

.auth-inline-toggle__text--join,
.auth-shell[data-org-mode="create"] .auth-inline-toggle__text--create {
    display: none;
}

.auth-shell[data-org-mode="create"] .auth-inline-toggle__text--join {
    display: inline;
}

.auth-org-join,
.auth-org-create {
    display: grid;
    transition: max-height 240ms ease, opacity 240ms ease, margin 240ms ease;
}

.auth-org-join {
    max-height: 180px;
    opacity: 1;
}

.auth-org-create {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.auth-shell[data-org-mode="create"] .auth-org-join {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.auth-shell[data-org-mode="create"] .auth-org-create {
    max-height: 220px;
    opacity: 1;
}

.auth-panel {
    display: grid;
    gap: 18px;
}

.auth-panel__intro h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.1;
    color: #0f172a;
}

.auth-panel__intro p,
.auth-field-help {
    margin: 0;
    color: var(--auth-text-muted);
    line-height: 1.6;
}

.auth-org-switch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.06);
}

.auth-org-switch::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    transition: transform 240ms ease;
}

.auth-shell[data-org-mode="join"] .auth-org-switch::after {
    transform: translateX(100%);
}

.auth-org-switch__option {
    position: relative;
    z-index: 1;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--auth-text-muted);
    font-weight: 700;
    cursor: pointer;
}

.auth-org-switch__option.is-active {
    color: #0f172a;
}

.auth-org-panel--join {
    padding-left: 16px;
}

@media (max-width: 640px) {
    .container.wh-container-med {
        width: calc(100vw - 16px);
    }

    .container .wh-card {
        width: calc(100vw - 16px);
        height: min(var(--auth-card-height), calc(100vh - 16px));
        margin: 0;
        border-radius: 22px;
    }

    .auth-shell {
        padding: 22px 20px 20px;
    }

    .auth-form-panel,
    .auth-form-panel--signup,
    .auth-org-panel--join {
        padding-left: 0;
        padding-right: 0;
    }

    .auth-form-panel__intro h1,
    .auth-panel__intro h1 {
        font-size: 28px;
    }

    .auth-field--split {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 820px) and (min-width: 641px) {
    .container.wh-container-med {
        width: min(520px, calc(100vw - 24px));
    }

    .container .wh-card {
        max-width: 520px;
        height: calc(100vh - 24px);
        margin: 0;
        border-radius: 22px;
    }

    .auth-shell {
        padding: 20px 24px 18px;
    }

    .auth-form-panel__intro {
        margin-bottom: 12px;
    }

    .auth-form-panel__intro h1 {
        font-size: 28px;
    }

    .auth-form-panel__intro p {
        font-size: 14px;
        line-height: 1.45;
    }

    .auth-form {
        gap: 10px;
    }

    .auth-field {
        gap: 5px;
    }

    .auth-field input {
        min-height: 44px;
        border-radius: 12px;
    }

    .auth-turnstile,
    .auth-turnstile .cf-turnstile {
        min-height: 60px;
    }

    .auth-submit {
        min-height: 46px;
        border-radius: 12px;
    }

    .auth-footer-link {
        margin-top: 10px;
        line-height: 1.4;
    }
}
