:root {
    --login-forest: #0f3d2a;
    --login-forest-deep: #0a2a1d;
    --login-leaf: #176b3a;
    --login-leaf-strong: #125a31;
    --login-mist: #e8f3ec;
    --login-ink: #14231c;
    --login-muted: #5b6d63;
}

body.site-auth {
    margin: 0;
    min-height: 100vh;
    background: var(--login-mist);
}

body.site-auth > .alert {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: min(calc(100% - 2rem), 28rem);
    margin: 0;
    box-shadow: 0 12px 28px rgba(15, 61, 42, .14);
}

body.site-auth > .alert + .alert {
    top: 4.5rem;
}

.login-stage {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 55% at 12% 18%, rgba(76, 159, 56, .22), transparent 55%),
        radial-gradient(ellipse 70% 50% at 88% 78%, rgba(23, 107, 58, .18), transparent 58%),
        linear-gradient(165deg, #f4faf6 0%, #e7f2eb 42%, #dcece2 100%);
}

.login-stage__glow {
    position: absolute;
    inset: auto;
    width: min(52vw, 420px);
    height: min(52vw, 420px);
    border-radius: 50%;
    background: conic-gradient(
        from 30deg,
        #e5243b,
        #dda63a,
        #4c9f38,
        #c5192d,
        #26bde2,
        #a21942,
        #fd6925,
        #00689d,
        #e5243b
    );
    opacity: .14;
    filter: blur(2px);
    animation: login-stage-drift 18s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

.login-stage__glow--a { top: -12%; right: -8%; }
.login-stage__glow--b { bottom: -18%; left: -10%; animation-delay: -7s; opacity: .1; }

.login-stage__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 28rem);
    text-align: center;
    padding: clamp(2rem, 5vw, 2.75rem) clamp(1.5rem, 4vw, 2.25rem) clamp(1.75rem, 4vw, 2.25rem);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(20, 35, 28, .08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .7) inset,
        0 24px 48px rgba(15, 61, 42, .12);
    backdrop-filter: blur(10px);
    animation: login-stage-rise .7s cubic-bezier(.22, 1, .36, 1) both;
}

.login-stage__brand {
    display: grid;
    justify-items: center;
    gap: .85rem;
    margin-bottom: 1.75rem;
}

.login-stage__mark {
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 1.35rem;
    overflow: hidden;
    background: var(--login-forest-deep);
    border: 2px solid rgba(242, 183, 5, .7);
    box-shadow: 0 18px 36px rgba(15, 61, 42, .2);
    animation: login-stage-mark .9s cubic-bezier(.22, 1, .36, 1) .08s both;
}

.login-stage__mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-stage__name {
    margin: 0;
    font-size: clamp(1.85rem, 4vw, 2.25rem);
    line-height: 1.15;
    letter-spacing: -.02em;
    color: var(--login-ink);
    font-weight: 800;
}

.login-stage__tag {
    margin: 0;
    max-width: 22rem;
    color: var(--login-muted);
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 500;
}

.login-stage__actions {
    display: grid;
    gap: .85rem;
    margin-top: 1.85rem;
}

.button--rru-account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    width: 100%;
    min-height: 3.35rem;
    padding: .85rem 1.15rem;
    border-radius: .9rem;
    border: 1px solid var(--login-leaf);
    background: var(--login-leaf);
    color: #fff;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
    box-shadow: 0 10px 22px rgba(23, 107, 58, .22);
}

.button--rru-account:hover {
    background: var(--login-leaf-strong);
    border-color: var(--login-leaf-strong);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(23, 107, 58, .28);
}

.button--rru-account:active {
    transform: translateY(0);
}

.button--rru-account__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 2.25rem;
    flex: 0 0 auto;
    background: transparent;
}

.button--rru-account__mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.login-stage__note {
    margin: 0;
    color: var(--login-muted);
    font-size: .92rem;
}

.login-stage__note[hidden] {
    display: none !important;
}

.login-stage__back {
    display: inline-block;
    margin-top: 1.35rem;
    color: var(--login-forest);
    font-weight: 600;
    font-size: .95rem;
    text-decoration: none;
}

.login-stage__back:hover {
    text-decoration: underline;
}

.login-stage__langs {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    display: flex;
    gap: .35rem;
}

.login-stage__langs a {
    min-width: 2.25rem;
    height: 2.25rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(20, 35, 28, .08);
    color: var(--login-forest);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
}

.login-stage__langs a.is-active {
    background: var(--login-forest);
    border-color: var(--login-forest);
    color: #fff;
}

@keyframes login-stage-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes login-stage-mark {
    from { opacity: 0; transform: scale(.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes login-stage-drift {
    from { transform: translate3d(0, 0, 0) rotate(0deg); }
    to { transform: translate3d(-18px, 22px, 0) rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
    .login-stage__panel,
    .login-stage__mark,
    .login-stage__glow,
    .button--rru-account {
        animation: none !important;
        transition: none !important;
    }
}

/* OIDC popup result (success / error): keep card centered in the window */
.login-stage--result {
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    align-content: center;
    padding: clamp(1.5rem, 5vw, 2.75rem);
}

.login-stage__panel--result {
    width: min(100%, 26rem);
    padding: clamp(1.75rem, 4.5vw, 2.4rem) clamp(1.4rem, 4vw, 2rem);
}

.login-stage__result-title {
    margin: 0 0 .65rem;
    color: var(--login-forest-deep);
    font-size: clamp(1.35rem, 3.2vw, 1.65rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.login-stage__result-body {
    margin: 0;
    color: var(--login-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.login-stage__result-actions {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin-top: 1.4rem;
}

.login-stage__result-actions .button {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
}
