html,
body {
    min-height: 100%;
}

:root {
    --authelia-panel-width: clamp(360px, 28vw, 420px);
    --authelia-panel-padding: 40px;
    --authelia-panel-content-width: calc(var(--authelia-panel-width) - 80px);
}

body {
    margin: 0;
    overflow-x: hidden;
    background: #f5f7fb;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0 var(--authelia-panel-width) 0 0;
    background:
        radial-gradient(circle at 12% 10%, rgba(43, 123, 212, 0.95) 0%, rgba(43, 123, 212, 0.15) 18%, transparent 42%),
        radial-gradient(circle at 72% 78%, rgba(88, 110, 255, 0.65) 0%, rgba(88, 110, 255, 0.08) 20%, transparent 42%),
        radial-gradient(circle at 88% 32%, rgba(210, 67, 104, 0.55) 0%, rgba(210, 67, 104, 0.08) 18%, transparent 40%),
        linear-gradient(135deg, #154f8a 0%, #081c35 24%, #07162b 56%, #2c1653 78%, #6e1631 100%);
    border-radius: 0;
    z-index: -2;
}

#root {
    min-height: 100vh;
    display: flex;
    justify-content: flex-end;
    position: relative;
}

#root::before {
    content: "AI Troubleshooting for Industrial Networks";
    white-space: nowrap;
    position: fixed;
    left: 6vw;
    top: calc(42vh + 4.8rem);
    max-width: none;
    color: #ffffff;
    font-weight: 300;
    font-size: clamp(1.2rem, 1.65vw, 2.1rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    z-index: -1;
}

#root::after {
    content: "";
    display: block;
    position: fixed;
    left: 6vw;
    top: 42vh;
    width: clamp(9.75rem, 12vw, 13rem);
    height: clamp(2.75rem, 3.6vw, 3.7rem);
    background: url("/authelia-logo.svg") left center / contain no-repeat;
    pointer-events: none;
    z-index: -1;
}

#root > div:not(.MuiSnackbar-root) {
    width: var(--authelia-panel-width);
    min-width: 360px;
    min-height: 100vh;
    margin-left: auto;
    background: #ffffff;
    box-shadow: -16px 0 36px rgba(7, 22, 43, 0.08);
    position: relative;
}

[class*="makeStyles-icon"],
img[src*="logo.png"],
img[src*="logo.svg"] {
    display: none !important;
}

#root > div:not(.MuiSnackbar-root)::before {
    content: "";
    display: block;
    position: absolute;
    top: 38px;
    left: 40px;
    transform: none;
    width: 6.8rem;
    height: 2rem;
    background: url("/authelia-logo.svg") left center / contain no-repeat;
    filter: brightness(0) saturate(100%) invert(11%) sepia(31%) saturate(1308%) hue-rotate(184deg) brightness(94%) contrast(95%);
    pointer-events: none;
}

#first-factor-stage,
#second-factor-stage,
#reset-password-stage {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 146px var(--authelia-panel-padding) 120px !important;
    box-sizing: border-box;
}

#first-factor-stage .MuiTypography-h5,
#second-factor-stage .MuiTypography-h5,
#reset-password-stage .MuiTypography-h5 {
    visibility: hidden;
    position: relative;
    margin-bottom: 10px !important;
}

#first-factor-stage .MuiTypography-h5::before,
#second-factor-stage .MuiTypography-h5::before,
#reset-password-stage .MuiTypography-h5::before {
    visibility: visible;
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: #2f3640;
}

#first-factor-stage .MuiTypography-h5::before {
    content: "Sign in";
}

#second-factor-stage .MuiTypography-h5::before {
    content: "Secure your account";
}

#reset-password-stage .MuiTypography-h5::before {
    content: "Account recovery";
}

#second-factor-stage .MuiTypography-body1,
#second-factor-stage .MuiTypography-body2,
#second-factor-stage .MuiFormHelperText-root {
    color: #5c6675;
    line-height: 1.5;
}

#second-factor-stage img[src^="data:image"],
#second-factor-stage canvas,
#second-factor-stage svg[viewBox] {
    display: block;
    max-width: min(100%, 240px);
    height: auto;
    margin: 20px auto;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #ced5df;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(7, 22, 43, 0.08);
    box-sizing: border-box;
}

#second-factor-stage .MuiButton-root + .MuiButton-root {
    margin-top: 10px !important;
}

.MuiAvatar-root,
.MuiDivider-root,
a[href*="authelia.com"][target="_blank"],
#language-button {
    display: none !important;
}

.MuiFormControl-root,
.MuiTextField-root {
    width: 100% !important;
}

.MuiInputBase-root,
.MuiOutlinedInput-root {
    border-radius: 12px !important;
    background: #ffffff;
    font-size: 0.95rem !important;
}

.MuiOutlinedInput-notchedOutline {
    border-color: #ced5df !important;
}

.Mui-focused .MuiOutlinedInput-notchedOutline {
    border-color: #2f6fcb !important;
    border-width: 2px !important;
}

.MuiButton-containedPrimary,
.MuiButton-contained {
    min-height: 54px !important;
    border-radius: 10px !important;
    background: #2f6fcb !important;
    box-shadow: none !important;
    font-size: 0.98rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
}

.MuiButton-containedPrimary:hover,
.MuiButton-contained:hover {
    background: #255fb2 !important;
    box-shadow: none !important;
}

#first-factor-stage label[class*="rememberMe"],
footer {
    display: none !important;
}

.MuiSnackbar-root {
    left: auto !important;
    right: var(--authelia-panel-padding) !important;
    bottom: auto !important;
    top: max(128px, calc(50vh - 250px)) !important;
    transform: none !important;
    width: var(--authelia-panel-content-width) !important;
    max-width: var(--authelia-panel-content-width) !important;
    min-width: 0 !important;
    box-sizing: border-box;
    justify-content: stretch !important;
}

.MuiSnackbar-root .MuiAlert-root,
.MuiSnackbar-root .MuiSnackbarContent-root {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.aitin-login-footer {
    position: fixed;
    left: calc(100% - var(--authelia-panel-width));
    right: 0;
    bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    color: #5c6675;
    font-size: 0.95rem;
    z-index: 5;
}

.aitin-login-footer a {
    color: #256fd1;
    font-weight: 700;
    text-decoration: none;
}

.aitin-login-footer a:hover,
.aitin-login-footer a:focus-visible {
    text-decoration: underline;
}

@media (max-width: 1100px) {
    body::before,
    #root::before,
    #root::after {
        display: none;
    }

    #root {
        justify-content: center;
        padding: 24px;
        box-sizing: border-box;
    }

    #root > div:not(.MuiSnackbar-root) {
        width: min(100%, 460px);
        min-width: 0;
        box-shadow: 0 16px 36px rgba(7, 22, 43, 0.12);
    }

    #root > div:not(.MuiSnackbar-root)::before {
        right: auto;
        left: 40px;
        transform: none;
    }

    #first-factor-stage,
    #second-factor-stage,
    #reset-password-stage {
        padding-top: 120px !important;
    }

    .MuiSnackbar-root {
        left: 50% !important;
        right: auto !important;
        top: 110px !important;
        width: min(calc(100vw - 80px), 380px) !important;
        max-width: min(calc(100vw - 80px), 380px) !important;
        transform: translateX(-50%) !important;
    }

    .aitin-login-footer {
        left: 0;
        right: 0;
        text-align: center;
    }
}

.port-diagram-container {
    width: 60% !important;
}
