.menu .sub_menu.active{
    display: block;
}

.header-inner{
    position: relative;
}

.menu .sub_menu{
    position: absolute;
    background-color: #FAF8F2;
    width: 1220px;
    max-width: 100%;
    margin-top: 9px;
    left: 0;
    line-height: 1.2;
}

header.is-scrolled .menu .sub_menu{
    margin-top: 12px;
}

aside li a {
    line-height: 20px;
    display: inline-block;
    color: #83878B;
}

aside li.active a{
    box-shadow: inset 2px 0px 0px 0px #936846;
    font-weight: 600;
    color: #31373D;

}

/* ===== Mega menu：desktop 側欄+內容雙欄／mobile 手風琴，共用同一份 markup =====
   結構：.mega-menu-list > .mega-item > .mega-tab + .mega-panel
   Mobile（預設）：一般文檔流，click 一個 tab 就喺佢下面展開自己嗰個 panel（手風琴）。
   Desktop（lg 或以上）：.mega-tab 保持正常文檔流（喺左欄疊埋，唔會因為右邊內容高度被谷高）；
   .mega-panel 用 position:absolute 疊喺右邊內容區，靠 .active 決定顯示邊個。
   容器高度由 JS（applyMegaPanelHeight，喺 header 嘅 inline script 入面）跟住現時顯示緊嗰個
   panel 嘅實際內容高度同步更新，避免唔同分頁內容高度唔一嘅時候溢出或留白。 */
.mega-menu-list {
    display: flex;
    flex-direction: column;
}

.mega-tab {
    display: block;
    color: #83878B;
    cursor: pointer;
    padding: 16px;
}

.mega-item.active > .mega-tab {
    background: #FAF8F2;
    color: #31373D;
    font-weight: 600;
}

.mega-panel {
    display: none;
}

.mega-item.active .mega-panel {
    display: block;
}

@media (min-width: 768px) {
    .mega-menu-list {
        position: relative;
        min-height: 364px;
        padding: 40px 0;
        gap: 24px;
    }

    /* 用返原本 aside 嘅連續直線效果 */
    .mega-menu-list::before {
        content: '';
        position: absolute;
        left: 16px;
        top: 40px;
        bottom: 40px;
        width: 1px;
        background: #DFDFE0;
    }

    .mega-item {
        display: block;
    }

    .mega-tab {
        width: fit-content;
        margin: 0 16px;
        padding: 0 0 0 20px;
        background: none !important;
        font-weight: 400;
    }

    .mega-item.active > .mega-tab {
        background: none !important;
        box-shadow: inset 3px 0px 0px 0px #936846;
        font-weight: 600;
        color: #31373D;
    }

    .mega-panel {
        position: absolute;
        top: 0;
        left: 25%;
        right: 0;
        display: none !important;
    }

    .mega-item.active .mega-panel {
        display: flex !important;
    }
}

header .bottom_area .sub.active{
    background: url("../images/icon_topmenu_arrow_active.svg") no-repeat right center;
    background-size: 8px;
    padding-right: 16px;
}

header .bottom_area .sub.active > a{
    font-weight: 600;
}

.menu .sub.active > ul {
    display: block !important;
}

header .bottom_area .sub .bg-gray{
    display: none;
}

header .bottom_area .sub.active::before, .search_popup::before{
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0;
    background: #00000073;
    top: 138px;
}

header.is-scrolled .bottom_area .sub.active::before, 
header.is-scrolled .search_popup::before{
    top: 80px;
}

/* search pop */

.search_popup .search_box{
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding-left: 160px;
    margin-top: 9px;
    padding-top: 40px;
    padding-bottom: 40px;
    background: #f5f7f8;
}

header.is-scrolled .search_popup .search_box {
    margin-top: 10px;
}

@media (max-width: 1023px) {
    .search_popup .search_box{
        padding: 40px;
        display: flex;
        justify-content: center;
    }
}

.search_code_wrapper svg {
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    color: #31373d;
}

.search_code_wrapper > a{
    background: #fff;
    border: 1px solid #DFDFE0;
    border-radius: 4px;
    padding: 12px 16px;
}

.search_code_wrapper a:focus-within, .search_code_wrapper a:focus, .search_code_wrapper a:active, .search_code_wrapper a:hover{
    border-color: #005075;
}

.search_code_wrapper a.code_search div{
    border: none;
    padding-bottom: 0;
}

.search_box .code_search_wrap input {
    background-color: #fff !important;
    border-color: #DFDFE0 !important;
}

.search_box .code_search_dropdown{
    width: calc(100% - 200px);
}

.search_box .code_search_wrap button.text-white{
    color: #fff !important;
}

.search_box .code_search_wrap .text-white{
    color: #31373D !important;
}

.search_box .code_search_wrap .rise .arrow {
    background-image: url(../images/arrow_rise.svg) !important;
    background-size: 100% auto;
}

.search_box .code_search_wrap .drop .arrow {
    background-image: url(../images/arrow_drop.svg) !important;
    background-size: 100% auto;
}

.search_box .code_search_wrap .cs_name, .search_box .code_search_wrap .cs_code{
    font-size: 16px;
    font-weight: 400;
    color: #83878B;
}

/* lang */
.lang_dropdown li.active{
    background: url(../images/icon_tick.svg) no-repeat right 15px center;
    background-size: 20px;
}

.lang_dropdown li.active a{
    font-weight: 600;
}

/* ===== Responsive ===== */
.hamburger {
    /*display: none;*/
}
/* .mobile_menu {
    display: block;
} */

    .mobile_menu_icon {
        background-image: url(/home/images/icon_hamburger.svg);
        background-position: center;
        background-size: 100%;
    }

@media (max-width: 1023px) {
    .menu .sub_menu{
        width: 100%;
        left: 0;
    }
 
    .hamburger {
        display: flex;
    }

    .hamburger_open .mobile_menu_icon {
        background-image: url(/home/images/icon_hamburger_close.svg);
        background-position: center;
        background-size: 100%;
    }

    header .bottom_area .sub.active::before{
        display: none;
    }

    .search_code_wrapper > a:focus-within {
        border-color: #005075;
    }

    .search_code_wrapper{
        width: auto;
        margin: 24px 16px;
    }

    .search_code_wrapper a.code_search svg{
        width: 24px !important;
        min-width: 24 !important;
        height: 24px !important;
        color: #31373d;
    }

    .mobile_menu .code_search_dropdown{
        background-color: #F5F7F8 !important;
    }

    .mobile_menu .code_search_wrap .bg-\[\#101820\] {
        background-color: #ffffff !important;
        border-color: #DFDFE0 !important;
    }

    .mobile_menu .code_search_dropdown .text-white{
        color: #31373D !important;
    }

    .mobile_menu .code_search_wrap .cs_name, .mobile_menu .code_search_wrap .cs_code{
        font-size: 16px;
        font-weight: 400;
        color: #83878B;
    }

    .mobile_menu .code_search_wrap .rise .arrow {
        background-image: url(../images/arrow_rise.svg) !important;
        background-size: 100% auto;
    }

    .mobile_menu .code_search_wrap .drop .arrow {
        background-image: url(../images/arrow_drop.svg) !important;
        background-size: 100% auto;
    }

    .mobile_menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 8px;
        width: 100%;
        background: #fff;
        border-top: 1px solid #DFDFE0;
        z-index: 100;
        height: calc(100vh - 79px);
    }

    .mobile_menu.mobile_menu_open {
        display: block;
        background: #f5f7f8;
    }

    .mobile_menu .bottom_area {
        flex-direction: column;
        align-items: stretch;
    }

    .mobile_menu h2{
        font-size: 18px;
        margin-bottom: 16px;
    }

    .mobile_menu .text-base{
        font-size: 14px;
    }

    .mobile_menu .menu > ul {
        flex-direction: column;
        gap: 0;
        line-height: 1.2;
    }

    .mobile_menu .menu > ul > .sub {
        width: 100%;
        padding-right: 0;
    }

    .mobile_menu .menu > ul > .sub > a {
        display: block;
        padding: 16px;
        font-size: 18px;
    }

    .mobile_menu .sub_menu {
        position: unset;
        width: 100%;
        background-color: #f5f7f8;
        margin-top: 0;
    }

    .mobile_menu .sub_menu .shadow-md,
    .mobile_menu .sub_menu .border-b {
        border: none;
        box-shadow: none;
    }

    .mobile_menu .sub_menu .flex {
        flex-direction: column;
        width: 100%;
    }

    /* Mega menu（.mega-item/.mega-tab/.mega-panel）喺 mobile 嘅手風琴裝飾：
       desktop 嗰set 顯示規則喺 menu.css 頭段已經共用定義好，呢度淨係加返
       原本 .sub_menu_item 嘅箭嘴 icon／背景色，同壓縮返 padding 啱手機睇。 */
    .mobile_menu .mega-tab {
        background: url(../images/icon_topmenu_arrow.svg) no-repeat right 16px center #FAF8F2;
        background-size: 10px;
        /*border-bottom: 1px solid #DFDFE0;*/
        font-size: 18px;
        width: calc(100% - 16px);
        margin-left: 16px;
    }

    .mobile_menu .mega-item {
        max-width: 25%;
    }

    .mobile_menu .mega-item.active > .mega-tab {
        background: url(../images/icon_topmenu_arrow_b_active.svg) no-repeat right 16px center #FAF8F2;
        background-size: 10px;
        font-weight: 600;
        
    }

    .mobile_menu .mega-panel {
        padding: 20px 16px 0 16px!important;
        background-color: #fff;
    }

    .mobile_menu .mega-panel .grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .mobile_menu .mega-panel h2 {
        font-size: 16px;
        margin-bottom: 16px !important;
    }

    #main-header.is-scrolled .bottom_area{
        gap: 0;
    }

    #mobile_menu_search .ctn_search{
        border-bottom: none;
    }

    .search_code_icon {
        flex-shrink: 0;
    }

    .search_code {
        border: none;
        outline: none;
        background: transparent;
        width: 100%;
        font-size: 14px;
        color: #333;
        padding: 0;
    }

    .search_code::placeholder {
        color: #83878B;
    }

    .mobile_menu .search_area {
        padding: 12px 16px;
        gap: 16px;
        border-top: 1px solid #DFDFE0;
    }

    .mobile_menu .lang ul li{
        width: 100%;
        background: #fff;
        font-size: 16px;
        padding: 16px;
    }

    .mobile_menu .lang ul li.active{
        background: #E2E4E5;
    }

    .mobile_menu .lang ul li.active a{
        border-bottom: none;
    }

    .mobile_menu .lang ul li:last-child a{
        border-bottom: none;
    }

    header.is-scrolled .menu .sub_menu {
        margin-top: 0;
    }

    #main-header.is-scrolled .top_area, #main-header.is-scrolled .bottom_area {
        width: 100%;
    }

    header .bottom_area .sub, header .bottom_area .sub.active{
        background: none;
    }

    header .bottom_area .sub > a{
        background: url(../images/icon_topmenu_arrow.svg) no-repeat right 16px center;
        background-size: 10px;
    }

    header .bottom_area .sub.active > a{
        background: url(../images/icon_topmenu_arrow_b_active.svg) no-repeat right 16px center;
        background-size: 10px;
    }

}


@media (max-width: 767px) {
    .mobile_menu .mega-item {
        max-width: unset;
    }
    .mobile_menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 16px;
        width: 100%;
        background: #fff;
        border-top: 1px solid #DFDFE0;
        z-index: 100;
        height: calc(100vh - 79px);

    }
}