:root {
    /* Matches the admin palette; primary sampled from the Immoni logo. */
    --mg-auth-ink: #20122c;
    --mg-auth-muted: #716579;
    --mg-auth-primary: #20122c;
    --mg-auth-primary-hover: #3d2850;
    --mg-auth-line: rgba(113, 101, 121, 0.26);
}

* {
    box-sizing: border-box;
}

html,
body.mg-auth-body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body.mg-auth-body {
    min-height: 100vh;
    overflow: hidden;
    color: var(--mg-auth-ink);
    font-family: "Manrope", sans-serif;
    background: #f4f1f6;
}

button,
input {
    font: inherit;
}

.mg-auth-scene {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 69% 13%, rgba(220, 210, 228, 0.78), transparent 27%),
        radial-gradient(circle at 9% 8%, rgba(255, 255, 255, 0.96), transparent 28%),
        linear-gradient(139deg, #faf9fb 0%, #f4f1f7 43%, #ede7f1 73%, #def7ff 100%);
}

.mg-auth-light {
    position: absolute;
    z-index: -5;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(48px);
}

.mg-auth-light-one {
    width: 40vw;
    height: 25vw;
    top: 5vh;
    right: 5vw;
    background: rgba(186, 166, 200, 0.23);
}

.mg-auth-light-two {
    width: 32vw;
    height: 28vw;
    bottom: -10vw;
    left: 12vw;
    background: rgba(176, 153, 192, 0.26);
}

.mg-auth-wave {
    position: absolute;
    z-index: -4;
    left: -14vw;
    width: 135vw;
    pointer-events: none;
    transform-origin: center;
    will-change: transform;
}

.mg-auth-wave-back {
    height: 44vh;
    bottom: 5vh;
    border-radius: 54% 46% 42% 48% / 72% 58% 42% 35%;
    background:
        radial-gradient(ellipse at 55% 18%, rgba(255, 255, 255, 0.92), transparent 15%),
        linear-gradient(178deg, rgba(250, 249, 251, 0.9) 0 21%, rgba(231, 224, 236, 0.9) 43%, rgba(184, 163, 199, 0.82) 68%, rgba(160, 133, 180, 0.54) 100%);
    box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.85), 0 -14px 46px rgba(201, 186, 212, 0.22);
    transform: rotate(-7deg) skewX(-6deg);
    animation: mg-wave-back 9s ease-in-out infinite alternate;
}

.mg-auth-wave-middle {
    height: 29vh;
    bottom: -2vh;
    left: -7vw;
    width: 118vw;
    border-radius: 49% 50% 0 0 / 90% 88% 0 0;
    background:
        radial-gradient(ellipse at 48% 2%, rgba(255, 255, 255, 0.74), transparent 8%),
        linear-gradient(170deg, rgba(179, 157, 195, 0.38), rgba(164, 137, 183, 0.85) 38%, rgba(169, 144, 187, 0.76) 100%);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.68), 0 -25px 60px rgba(158, 130, 178, 0.18);
    transform: rotate(5deg);
    filter: blur(0.2px);
    animation: mg-wave-middle 6.5s ease-in-out infinite alternate;
}

.mg-auth-wave-front {
    height: 23vh;
    right: -12vw;
    bottom: -11vh;
    left: auto;
    width: 104vw;
    border-radius: 51% 49% 0 0 / 100% 92% 0 0;
    background: linear-gradient(164deg, rgba(232, 226, 237, 0.76), rgba(186, 166, 201, 0.7) 44%, rgba(169, 144, 187, 0.74));
    box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.58);
    transform: rotate(-2deg);
    animation: mg-wave-front 5s ease-in-out infinite alternate;
}

@keyframes mg-wave-back {
    0% {
        transform: translate3d(-2.5%, 0, 0) rotate(-7deg) skewX(-6deg) scaleX(1.02);
    }

    50% {
        transform: translate3d(0, -2.2%, 0) rotate(-5.8deg) skewX(-4deg) scaleX(1.045);
    }

    100% {
        transform: translate3d(2.5%, 1.5%, 0) rotate(-7.8deg) skewX(-7deg) scaleX(1.02);
    }
}

@keyframes mg-wave-middle {
    0% {
        transform: translate3d(2.8%, 1%, 0) rotate(5deg) scaleX(1.035);
    }

    50% {
        transform: translate3d(0, -4%, 0) rotate(3.8deg) scaleX(1.07);
    }

    100% {
        transform: translate3d(-3%, 1.2%, 0) rotate(5.8deg) scaleX(1.035);
    }
}

@keyframes mg-wave-front {
    0% {
        transform: translate3d(-3.2%, 0, 0) rotate(-2deg) scaleX(1.04);
    }

    50% {
        transform: translate3d(0, -5%, 0) rotate(-0.8deg) scaleX(1.08);
    }

    100% {
        transform: translate3d(3.2%, 1%, 0) rotate(-2.6deg) scaleX(1.04);
    }
}

.mg-auth-top-brand {
    position: absolute;
    z-index: 5;
    top: clamp(24px, 5vh, 48px);
    left: clamp(28px, 5vw, 72px);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #34273d;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.mg-auth-top-brand:hover {
    color: #34273d;
}

.mg-auth-brand-logo {
    height: 26px;
    width: auto;
    object-fit: contain;
}

.mg-auth-layout {
    position: relative;
    z-index: 2;
    display: grid;
    width: 100%;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
    padding: clamp(74px, 11vh, 112px) clamp(42px, 7vw, 100px) clamp(42px, 8vh, 82px);
}

.mg-auth-hero {
    position: relative;
    display: flex;
    align-items: center;
    padding-left: clamp(36px, 7vw, 108px);
}

.mg-auth-hero-wordmark {
    position: relative;
    display: flex;
    width: max-content;
    flex-direction: column;
    color: #443251;
}

.mg-auth-hero-wordmark::before,
.mg-auth-hero-wordmark::after {
    position: absolute;
    left: -25px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(148, 117, 171, 0.22);
    content: "";
}

.mg-auth-hero-wordmark::before {
    top: 29px;
}

.mg-auth-hero-wordmark::after {
    bottom: 21px;
    width: 5px;
    height: 5px;
}

.mg-auth-hero-wordmark > span {
    margin-left: 1px;
    color: rgba(118, 100, 131, 0.5);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.38em;
}

.mg-auth-hero-logo {
    width: clamp(230px, 26vw, 360px);
    height: auto;
    margin: 6px 0 2px;
}

.mg-auth-hero-wordmark small {
    margin-top: 11px;
    color: rgba(117, 95, 133, 0.48);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.42em;
}

.mg-auth-conversation {
    position: absolute;
    top: 23%;
    left: 45%;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    opacity: 0.74;
    transform: rotate(-2deg);
}

.mg-auth-conversation span {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 9px;
    color: #7f7486;
    font-size: 8px;
    line-height: 1.15;
    background: rgba(255, 255, 255, 0.54);
    box-shadow: 0 4px 14px rgba(124, 104, 138, 0.07);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.mg-auth-conversation span:nth-child(2) {
    margin-left: 7px;
}

.mg-auth-conversation span:nth-child(3) {
    margin-left: -3px;
}

.mg-auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-auth-card {
    width: min(100%, 430px);
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: clamp(26px, 3vw, 36px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(254, 253, 254, 0.8), rgba(250, 248, 251, 0.68));
    box-shadow: 0 26px 70px rgba(101, 75, 119, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(30px) saturate(135%);
    backdrop-filter: blur(30px) saturate(135%);
    scrollbar-width: thin;
}

.mg-login-heading > span {
    color: var(--mg-auth-primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.17em;
}

.mg-login-heading h1 {
    margin: 5px 0 7px;
    color: var(--mg-auth-ink);
    font-size: clamp(24px, 2.2vw, 30px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.2;
}

.mg-login-heading p {
    margin: 0;
    color: var(--mg-auth-muted);
    font-size: 12px;
    line-height: 1.55;
}

.mg-login-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(209, 71, 91, 0.25);
    border-radius: 10px;
    color: #b44464;
    font-size: 11px;
    line-height: 1.45;
    background: rgba(255, 235, 238, 0.64);
}

.mg-login-alert i {
    margin-top: 1px;
    font-size: 15px;
}

.mg-login-alert.is-success {
    border-color: rgba(44, 173, 107, 0.28);
    color: #288064;
    background: rgba(226, 250, 238, 0.68);
}

.mg-login-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.mg-login-field {
    display: grid;
    gap: 7px;
}

.mg-login-field label,
.mg-login-label-row a {
    font-size: 11px;
    line-height: 1.4;
}

.mg-login-field label {
    color: #43354d;
    font-weight: 700;
}

.mg-login-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.mg-login-label-row a,
.mg-login-register a {
    color: var(--mg-auth-primary);
    font-weight: 700;
    text-decoration: none;
}

.mg-login-label-row a:hover,
.mg-login-register a:hover,
.mg-login-link-button:hover {
    text-decoration: underline;
}

.mg-login-link-button {
    padding: 0;
    border: 0;
    color: var(--mg-auth-primary);
    font: inherit;
    font-weight: 700;
    background: none;
    cursor: pointer;
}

.mg-login-input {
    display: flex;
    height: 48px;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    border: 1px solid var(--mg-auth-line);
    border-radius: 9px;
    color: #7f7189;
    background: rgba(251, 250, 252, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94), 0 4px 14px rgba(115, 95, 130, 0.04);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.mg-login-input:hover {
    border-color: rgba(123, 103, 137, 0.42);
    background: rgba(254, 253, 254, 0.82);
}

.mg-login-input:focus-within {
    border-color: var(--mg-auth-primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(150, 120, 172, 0.13), inset 0 1px 0 #fff;
}

.mg-login-input.has-error {
    border-color: #d45265;
}

.mg-field-error {
    margin: -2px 0 0;
    color: #b44464;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.mg-login-input > i {
    font-size: 17px;
}

.mg-login-input input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    color: #3f3049;
    font-size: 12px;
    background: transparent;
}

.mg-login-input input::placeholder {
    color: #a097a7;
    opacity: 1;
}

.mg-password-toggle {
    display: grid;
    width: 30px;
    height: 30px;
    min-width: 30px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #887d90;
    background: transparent;
}

.mg-password-toggle:hover {
    color: var(--mg-auth-primary);
    background: rgba(147, 116, 170, 0.08);
}

.mg-password-toggle:focus-visible,
.mg-login-submit:focus-visible,
.mg-remember-option input:focus-visible + span {
    outline: 3px solid rgba(147, 116, 170, 0.22);
    outline-offset: 2px;
}

.mg-remember-option {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    gap: 8px;
    color: var(--mg-auth-muted);
    cursor: pointer;
}

.mg-remember-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mg-remember-option > span {
    display: grid;
    width: 17px;
    height: 17px;
    min-width: 17px;
    place-items: center;
    border: 1px solid rgba(123, 103, 137, 0.36);
    border-radius: 4px;
    color: transparent;
    background: rgba(255, 255, 255, 0.7);
}

.mg-remember-option > span i {
    font-size: 11px;
}

.mg-remember-option input:checked + span {
    border-color: var(--mg-auth-primary);
    color: #ffffff;
    background: var(--mg-auth-primary);
}

.mg-remember-option small {
    font-size: 10px;
    line-height: 1.4;
}

.mg-login-submit {
    display: flex;
    width: 100%;
    height: 48px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    background: linear-gradient(100deg, var(--mg-auth-primary-hover), var(--mg-auth-primary) 76%);
    box-shadow: 0 12px 28px rgba(137, 103, 162, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.mg-login-submit:hover {
    color: #ffffff;
    box-shadow: 0 15px 32px rgba(137, 103, 162, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    background: var(--mg-auth-primary-hover);
    transform: translateY(-1px);
}

.mg-login-submit i {
    font-size: 13px;
}

.mg-login-register {
    margin: 16px 0 0;
    color: #988f9f;
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 960px) {
    .mg-auth-layout {
        grid-template-columns: minmax(0, 0.85fr) minmax(370px, 1fr);
        padding-inline: 40px;
    }

    .mg-auth-hero {
        padding-left: 15px;
    }

    .mg-auth-conversation {
        left: 34%;
    }
}

@media (max-width: 760px) {
    body.mg-auth-body,
    .mg-auth-scene {
        overflow: auto;
    }

    .mg-auth-layout {
        display: flex;
        min-height: 100vh;
        align-items: center;
        justify-content: center;
        padding: 92px 22px 42px;
    }

    .mg-auth-hero {
        display: none;
    }

    .mg-auth-panel {
        width: 100%;
    }

    .mg-auth-card {
        width: min(100%, 430px);
        max-height: none;
    }

    .mg-auth-wave-back {
        height: 42vh;
        bottom: 6vh;
        left: -45vw;
        width: 190vw;
    }

    .mg-auth-wave-middle {
        left: -42vw;
        width: 180vw;
    }
}

@media (max-height: 620px) and (min-width: 761px) {
    .mg-auth-layout {
        padding-block: 62px 28px;
    }

    .mg-auth-card {
        max-height: calc(100vh - 82px);
        padding: 24px 28px;
    }

    .mg-login-form {
        gap: 12px;
        margin-top: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mg-auth-wave {
        animation: none;
    }

    .mg-login-input,
    .mg-login-submit {
        transition: none;
    }
}

/* ------------------------------------------------- login with immoni */

.mg-oauth {
    margin-top: 18px;
}

.mg-oauth-divider {
    position: relative;
    margin-bottom: 14px;
    text-align: center;
}

.mg-oauth-divider::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--mg-auth-line);
    content: "";
}

.mg-oauth-divider span {
    position: relative;
    padding: 0 10px;
    color: #988f9f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: #fff;
}

.mg-oauth-button {
    display: flex;
    height: 48px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid var(--mg-auth-line);
    border-radius: 9px;
    color: #34273d;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mg-oauth-button:hover {
    border-color: var(--mg-auth-primary);
    color: #34273d;
    box-shadow: 0 6px 18px rgba(147, 116, 170, 0.14);
}

.mg-oauth-button img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.mg-oauth-note {
    margin: 9px 0 0;
    color: #988f9f;
    font-size: 10px;
    text-align: center;
}

/* Brand-consistent focus, autofill and supporting surfaces. */
body.mg-auth-body {
    --bs-primary: var(--mg-auth-primary);
    --bs-primary-rgb: 32, 18, 44;
    --bs-text-primary: var(--mg-auth-primary);
    --bs-link-color: var(--mg-auth-primary);
    --bs-link-hover-color: var(--mg-auth-primary-hover);
    background: #f5f1f6;
}

.mg-auth-scene {
    background:
        radial-gradient(circle at 69% 13%, rgba(210, 190, 224, 0.48), transparent 32%),
        radial-gradient(circle at 9% 80%, rgba(221, 234, 225, 0.48), transparent 30%),
        linear-gradient(139deg, #fcfafb 0%, #f5f1f6 48%, #f2e9ef 78%, #f4e7d2 100%);
}

.mg-auth-light-two { background: rgba(193, 149, 174, 0.18); }

.mg-auth-hero-wordmark > span,
.mg-auth-hero-wordmark small,
.mg-login-input input::placeholder,
.mg-login-register,
.mg-oauth-note,
.mg-oauth-divider span { color: var(--mg-auth-muted); }

.mg-auth-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(252, 250, 253, 0.8));
}

.mg-auth-body :is(a, button):focus-visible,
.mg-remember-option input:focus-visible + span {
    outline: 2px solid var(--mg-auth-primary);
    outline-offset: 3px;
}

.mg-login-input input:autofill {
    -webkit-text-fill-color: var(--mg-auth-ink);
    box-shadow: 0 0 0 1000px #f5f1f6 inset;
    caret-color: var(--mg-auth-primary);
}
