/*
 * MS Tech Forum Home v2.8
 * N7 / Discuz! X5
 * Knowledge-base + technical community forum index
 */

/* =========================================================
   Layout
   ========================================================= */
.ms-tech-home-pt {
    box-sizing: border-box;
    width: calc(100% - 56px);
    max-width: 1280px;
    margin: 14px auto 12px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 12px;
}

.ms-tech-home-pt .z,
.ms-tech-home-pt .z a,
.ms-tech-home-pt .z em {
    color: #98a2b3 !important;
}

.ms-tech-home-pt .z a:hover {
    color: #2563eb !important;
}

#ct.ms-tech-forum-home {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    box-sizing: border-box;
    width: calc(100% - 56px) !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
}

#ct.ms-tech-forum-home > .mn,
#ct.ms-tech-forum-home > .sd {
    float: none !important;
    box-sizing: border-box;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
}

#ct.ms-tech-forum-home > .sd {
    position: sticky;
    top: 84px;
    align-self: start;
}

/* =========================================================
   Main category cards
   ========================================================= */
.ms-tech-forum-home .comiis_flbm > .bm,
.ms-tech-forum-home #online.bm,
.ms-tech-forum-home .bm.lk {
    margin: 0 0 16px !important;
    overflow: hidden;
    border: 1px solid #eaecf0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 2px 10px rgba(16,24,40,.035) !important;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_h {
    box-sizing: border-box;
    height: 48px;
    margin: 0 20px !important;
    padding: 0 !important;
    border-bottom: 1px solid #f0f2f5 !important;
    background: transparent !important;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2 {
    position: relative;
    height: 48px;
    padding-left: 12px;
    line-height: 48px;
    color: #1d2939;
    font-size: 15px;
    font-weight: 700;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2::before {
    content: "";
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 0;
    width: 3px;
    border-radius: 999px;
    background: #2563eb;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2 a {
    color: inherit;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o {
    margin-top: 13px;
}

.ms-tech-forum-home .ms-tech-forum-category > .bm_c {
    padding: 3px 20px 7px !important;
}

/* =========================================================
   Forum rows
   ========================================================= */
.ms-tech-forum-home .fl_tb {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.ms-tech-forum-home .fl_tb td {
    box-sizing: border-box;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    border-top: 0 !important;
    border-bottom: 1px solid #f2f4f7 !important;
    background: transparent;
    transition: background .15s ease;
}

.ms-tech-forum-home .fl_tb tr:last-child > td,
.ms-tech-forum-home .fl_tb tr.fl_row:last-child > td {
    border-bottom-color: transparent !important;
}

.ms-tech-forum-home .fl_tb tr:hover > td {
    background: #f8fafc;
}

/* Icon */
.ms-tech-forum-home .fl_icn {
    width: 68px !important;
    padding-left: 7px !important;
    padding-right: 9px !important;
}

.ms-tech-forum-home .fl_icn,
.ms-tech-forum-home .fl_icn_g {
    min-height: 52px !important;
}

.ms-tech-forum-home .fl_icn a,
.ms-tech-forum-home .fl_icn_g a {
    display: block;
    width: 52px;
    height: 52px;
}

.ms-tech-forum-home .fl_icn img,
.ms-tech-forum-home .fl_icn_g img {
    display: block;
    width: 52px !important;
    height: 52px !important;
    object-fit: cover;
    border-radius: 10px !important;
    transition: transform .18s ease;
}

.ms-tech-forum-home .fl_tb tr:hover .fl_icn img,
.ms-tech-forum-home .fl_tb tr:hover .fl_icn_g img {
    transform: scale(1.035);
}

/* Name + description */
.ms-tech-forum-home .fl_tb td h2 {
    height: auto;
    min-height: 22px;
    margin: 0 0 4px;
    line-height: 22px;
    color: #1d2939;
    font-size: 15px;
    font-weight: 600;
}

.ms-tech-forum-home .fl_tb td h2 a {
    color: #1d2939;
}

.ms-tech-forum-home .fl_tb td h2 a:hover {
    color: #2563eb;
}

.ms-tech-forum-home .fl_tb td .xg2 {
    max-width: 560px;
    height: 20px;
    margin: 0;
    overflow: hidden;
    color: #98a2b3 !important;
    font-size: 12px;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-tech-forum-home .kmtoday {
    margin-top: 3px;
    margin-left: 6px;
    padding: 0 5px;
    height: 16px;
    line-height: 16px;
    font-size: 10px;
}

/* Stats */
.ms-tech-forum-home .fl_i {
    width: 105px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: right;
    vertical-align: middle;
    color: #98a2b3;
    font-size: 11px;
    white-space: nowrap;
}

.ms-tech-forum-home .fl_i .xi2 {
    color: #2563eb !important;
    font-size: 12px;
}

.ms-tech-forum-home .fl_i .xg1 {
    color: #98a2b3 !important;
}

/* Last update */
.ms-tech-forum-home .fl_by {
    width: 255px !important;
    padding-left: 12px !important;
    padding-right: 8px !important;
    vertical-align: middle;
}

.ms-tech-forum-home .fl_by > div {
    min-width: 0;
    overflow: hidden;
}

.ms-tech-forum-home .fl_by a {
    display: block;
    max-width: 100%;
    height: 20px;
    overflow: hidden;
    color: #344054 !important;
    font-size: 12px;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-tech-forum-home .fl_by a:hover {
    color: #2563eb !important;
}

.ms-tech-forum-home .fl_by cite {
    display: block;
    height: 18px;
    overflow: hidden;
    color: #98a2b3;
    font-size: 11px;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Multi-column forum mode */
.ms-tech-forum-home .flg .bm_c {
    padding-bottom: 12px !important;
}

.ms-tech-forum-home .fl_tb td.fl_g {
    padding: 13px !important;
    border-bottom: 0 !important;
    border-radius: 9px;
}

.ms-tech-forum-home .fl_tb td.fl_g:hover {
    background: #f8fafc;
}

.ms-tech-forum-home .fl_g dl {
    margin-left: 64px;
}

.ms-tech-forum-home .fl_g dt {
    font-size: 14px;
    font-weight: 600;
}

/* =========================================================
   Sidebar
   ========================================================= */
.ms-tech-forum-home .sd .bm,
.ms-tech-forum-home .sd .block,
.ms-tech-forum-home .sd .comiis_rbox {
    margin: 0 0 14px !important;
    overflow: hidden;
    border: 1px solid #eaecf0 !important;
    border-radius: 10px !important;
    background: #fff !important;
    box-shadow: 0 2px 10px rgba(16,24,40,.035) !important;
}

.ms-tech-forum-home .sd .bm_h,
.ms-tech-forum-home .sd .blocktitle,
.ms-tech-forum-home .sd .title {
    box-sizing: border-box;
    min-height: 46px;
    height: auto !important;
    margin: 0 16px !important;
    padding: 0 !important;
    border-bottom: 1px solid #f0f2f5 !important;
    background: transparent !important;
    line-height: 46px !important;
}

.ms-tech-forum-home .sd .bm_h h2,
.ms-tech-forum-home .sd .blocktitle .titletext,
.ms-tech-forum-home .sd .title .titletext {
    position: relative;
    padding-left: 11px;
    color: #1d2939 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

.ms-tech-forum-home .sd .bm_h h2::before,
.ms-tech-forum-home .sd .blocktitle .titletext::before,
.ms-tech-forum-home .sd .title .titletext::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 3px;
    border-radius: 999px;
    background: #2563eb;
}

/* Post CTA */
.ms-tech-forum-home .comiis_rbox_btn {
    height: 42px !important;
    line-height: 42px !important;
    border-radius: 8px !important;
    background: #2563eb !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(37,99,235,.12);
}

.ms-tech-forum-home .comiis_rbox_btn:hover {
    background: #1d4ed8 !important;
    opacity: 1 !important;
}

/* Text lists / latest posts */
.ms-tech-forum-home #comiis_list_r01 ul,
.ms-tech-forum-home #comiis_list_r01 .xl,
.ms-tech-forum-home #comiis_list_r01 .comiis_rbox_hotlist {
    padding-top: 8px !important;
    padding-bottom: 10px !important;
}

.ms-tech-forum-home #comiis_list_r01 li {
    min-width: 0;
    height: auto !important;
    margin: 0 !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    line-height: 22px !important;
}

.ms-tech-forum-home #comiis_list_r01 li a {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #344054;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-tech-forum-home #comiis_list_r01 li a:hover {
    color: #2563eb;
}

/* Keep the right column concise. */
.ms-tech-forum-home #comiis_list_r01 .block li:nth-child(n+7) {
    display: none;
}

/* Overview card */
.ms-tech-home-overview .bm_h {
    margin: 0 16px !important;
}

.ms-tech-home-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 16px 12px 13px;
}

.ms-tech-home-overview-grid > div {
    position: relative;
    text-align: center;
}

.ms-tech-home-overview-grid > div + div::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 1px;
    background: #f0f2f5;
}

.ms-tech-home-overview-grid strong {
    display: block;
    height: 24px;
    color: #1d2939;
    font-size: 18px;
    font-weight: 700;
    line-height: 24px;
}

.ms-tech-home-overview-grid span {
    display: block;
    margin-top: 3px;
    color: #98a2b3;
    font-size: 11px;
}

.ms-tech-home-newmember {
    margin: 0 16px;
    padding: 10px 0 13px;
    border-top: 1px solid #f0f2f5;
    color: #98a2b3;
    font-size: 11px;
}

.ms-tech-home-newmember span {
    margin-right: 7px;
}

.ms-tech-home-newmember a {
    color: #2563eb;
    font-weight: 600;
}

/* =========================================================
   Less "old forum" chrome
   ========================================================= */
.ms-tech-forum-home #online.bm,
.ms-tech-forum-home .bm.lk {
    margin-top: 0 !important;
}

.ms-tech-forum-home #online .bm_h,
.ms-tech-forum-home .bm.lk .bm_h {
    margin: 0 20px;
    border-bottom: 1px solid #f0f2f5;
    background: transparent;
}

.ms-tech-forum-home .pipe {
    color: #e4e7ec;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1120px) {
    #ct.ms-tech-forum-home {
        grid-template-columns: minmax(0, 1fr) 270px;
        gap: 18px;
    }

    .ms-tech-forum-home .fl_by {
        width: 210px !important;
    }
}

@media (max-width: 900px) {
    .ms-tech-home-pt,
    #ct.ms-tech-forum-home {
        width: calc(100% - 32px) !important;
    }

    #ct.ms-tech-forum-home {
        display: block !important;
    }

    #ct.ms-tech-forum-home > .sd {
        position: static;
        width: 100% !important;
        margin-top: 16px !important;
    }

    .ms-tech-forum-home .fl_by {
        display: none;
    }

    .ms-tech-forum-home .fl_i {
        width: 90px !important;
    }
}

@media (max-width: 640px) {
    .ms-tech-home-pt,
    #ct.ms-tech-forum-home {
        width: calc(100% - 20px) !important;
    }

    .ms-tech-forum-home .ms-tech-forum-category > .bm_c {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .ms-tech-forum-home .fl_icn {
        width: 56px !important;
        padding-left: 3px !important;
        padding-right: 6px !important;
    }

    .ms-tech-forum-home .fl_icn a,
    .ms-tech-forum-home .fl_icn img {
        width: 44px !important;
        height: 44px !important;
    }

    .ms-tech-forum-home .fl_i {
        display: none;
    }

    .ms-tech-forum-home .fl_tb td h2 {
        font-size: 14px;
    }
}


/* =========================================================
   MS Tech Forum Home v2.9
   Fix N7 grid placement
   ========================================================= */

/*
N7 #ct 的真实直接子元素顺序是：
1. #diy_chart
2. .mn
3. .sd

v2.8 没指定 grid area，导致 .mn 被放进右栏、.sd 掉到下一行。
v2.9 明确固定每个区域的位置。
*/
#ct.ms-tech-forum-home {
    grid-template-areas:
        "diy diy"
        "main side" !important;
    grid-template-columns: minmax(0, 1fr) 300px !important;
    grid-template-rows: auto auto;
    align-items: start;
}

/* DIY 区域横跨主栏和侧栏 */
#ct.ms-tech-forum-home > #diy_chart {
    grid-area: diy !important;
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
}

/* 空 DIY 不占高度 */
#ct.ms-tech-forum-home > #diy_chart:empty {
    display: none !important;
}

/* 版块主列表始终在左侧大栏 */
#ct.ms-tech-forum-home > .mn {
    grid-area: main !important;
    width: 100% !important;
    min-width: 0;
}

/* 右侧发帖 / 新鲜事 / 社区概览始终在右侧 */
#ct.ms-tech-forum-home > .sd {
    grid-area: side !important;
    width: 300px !important;
    min-width: 0;
    justify-self: stretch;
}

/* 防止 N7 原来的 float 对 Grid 产生残余干扰 */
#ct.ms-tech-forum-home > #diy_chart,
#ct.ms-tech-forum-home > .mn,
#ct.ms-tech-forum-home > .sd {
    float: none !important;
}

/* 右栏内部严格占满 300px */
#ct.ms-tech-forum-home > .sd > *,
#ct.ms-tech-forum-home > .sd .area,
#ct.ms-tech-forum-home > .sd .block {
    max-width: 100%;
    box-sizing: border-box;
}

/* 1120px 以下同步修正列宽 */
@media (max-width: 1120px) and (min-width: 901px) {
    #ct.ms-tech-forum-home {
        grid-template-columns: minmax(0, 1fr) 270px !important;
    }

    #ct.ms-tech-forum-home > .sd {
        width: 270px !important;
    }
}

/* 900px 以下恢复单栏，DIY / 主内容 / 右栏自然顺序 */
@media (max-width: 900px) {
    #ct.ms-tech-forum-home {
        display: block !important;
    }

    #ct.ms-tech-forum-home > #diy_chart,
    #ct.ms-tech-forum-home > .mn,
    #ct.ms-tech-forum-home > .sd {
        width: 100% !important;
    }
}


/* =========================================================
   MS Tech Forum Home v3.0
   Align category/sidebar headers and collapse switches
   ========================================================= */

/* 左右卡片标题栏统一为 48px */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h,
.ms-tech-forum-home .sd .bm_h,
.ms-tech-forum-home .sd .blocktitle,
.ms-tech-forum-home .sd .title {
    position: relative;
    box-sizing: border-box;
    min-height: 48px !important;
    height: 48px !important;
    margin-left: 16px !important;
    margin-right: 16px !important;
    padding: 0 !important;
    border-bottom: 1px solid #f0f2f5 !important;
    background: transparent !important;
}

/* 左侧分类原来 margin 20px，改成和右侧一致 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h {
    margin-left: 16px !important;
    margin-right: 16px !important;
}

/* 所有标题文字使用同一基线 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2,
.ms-tech-forum-home .sd .bm_h h2,
.ms-tech-forum-home .sd .blocktitle .titletext,
.ms-tech-forum-home .sd .title .titletext {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 0 0 12px !important;
    line-height: 48px !important;
    color: #1d2939 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

/* 蓝色竖线左右完全统一 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2::before,
.ms-tech-forum-home .sd .bm_h h2::before,
.ms-tech-forum-home .sd .blocktitle .titletext::before,
.ms-tech-forum-home .sd .title .titletext::before {
    content: "";
    position: absolute;
    top: 16px !important;
    bottom: auto !important;
    left: 0 !important;
    width: 3px !important;
    height: 16px !important;
    border-radius: 999px;
    background: #2563eb;
}

/* 分类标题中的 a 也强制跟随同一高度 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2 a {
    display: inline-flex;
    align-items: center;
    height: 48px;
    color: inherit;
}

/* 左侧折叠开关垂直居中 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o {
    position: absolute !important;
    top: 50% !important;
    right: 0 !important;
    float: none !important;
    margin: 0 !important;
    transform: translateY(-50%);
    line-height: 1 !important;
}

/* 兼容 N7 不同折叠按钮结构 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o img,
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o a,
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o i {
    display: block;
    margin: 0 !important;
}

/* 防止右侧标题栏内部其它元素影响竖线/文字 */
.ms-tech-forum-home .sd .bm_h > *,
.ms-tech-forum-home .sd .blocktitle > *,
.ms-tech-forum-home .sd .title > * {
    vertical-align: middle;
}

/* “社区概览”标题和“新鲜事”标题统一左边界 */
.ms-tech-forum-home .ms-tech-home-overview .bm_h,
.ms-tech-forum-home #comiis_list_r01 .bm_h {
    margin-left: 16px !important;
    margin-right: 16px !important;
}

/* 科研工作等多分类卡片同样强制开关居中 */
.ms-tech-forum-home .bmw .bm_h .o {
    position: absolute !important;
    top: 50% !important;
    right: 0 !important;
    margin: 0 !important;
    transform: translateY(-50%);
}


/* =========================================================
   MS Tech Forum Home v3.1
   Fix N7 native title marker + switch alignment
   ========================================================= */

/*
N7 原生已有：
.bm_h h2:before
.title:before

v3.0 又给 titletext/h2 做了一次定位，导致：
- 新鲜事双蓝线
- 原生 margin-top:19px 造成竖线偏低

v3.1 只保留 N7 原生一条 marker，并彻底 reset 位置。
*/

/* 标题栏直接用 flex 做垂直居中 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h,
.ms-tech-forum-home .sd .bm_h,
.ms-tech-forum-home .sd .blocktitle,
.ms-tech-forum-home .sd .title {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    height: 48px !important;
}

/* 左侧分类标题 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2,
.ms-tech-forum-home .sd .bm_h h2 {
    display: flex !important;
    flex: 1 1 auto;
    align-items: center !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
}

/* 使用 N7 原生 h2::before，但重置旧 float / margin */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2::before,
.ms-tech-forum-home .sd .bm_h h2::before {
    position: static !important;
    display: block !important;
    flex: 0 0 3px;
    float: none !important;
    width: 3px !important;
    height: 16px !important;
    margin: 0 10px 0 0 !important;
    padding: 0 !important;
    transform: none !important;
    vertical-align: middle !important;
    border-radius: 999px;
    background: #2563eb !important;
}

/* DIY 标题由 .title::before 负责蓝线 */
.ms-tech-forum-home .sd .blocktitle.title::before,
.ms-tech-forum-home .sd .title::before {
    position: static !important;
    display: block !important;
    flex: 0 0 3px;
    float: none !important;
    width: 3px !important;
    height: 16px !important;
    margin: 0 10px 0 0 !important;
    padding: 0 !important;
    transform: none !important;
    vertical-align: middle !important;
    border-radius: 999px;
    background: #2563eb !important;
}

/* v3.0 给 titletext 自己生成的第二条线彻底关闭 */
.ms-tech-forum-home .sd .blocktitle .titletext::before,
.ms-tech-forum-home .sd .title .titletext::before {
    display: none !important;
    content: none !important;
}

/* DIY 标题文字不再自己留蓝线 padding */
.ms-tech-forum-home .sd .blocktitle .titletext,
.ms-tech-forum-home .sd .title .titletext {
    display: flex !important;
    flex: 1 1 auto;
    align-items: center !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
}

/* 左侧开关作为标题栏 flex item，真正垂直居中 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o,
.ms-tech-forum-home .bmw .bm_h .o {
    position: static !important;
    top: auto !important;
    right: auto !important;
    display: flex !important;
    flex: 0 0 auto;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    float: none !important;
    height: 48px !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    line-height: 1 !important;
    transform: none !important;
}

/* 开关内部元素也不再带额外 margin */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o a,
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o img,
.ms-tech-forum-home .ms-tech-forum-category > .bm_h .o i,
.ms-tech-forum-home .bmw .bm_h .o a,
.ms-tech-forum-home .bmw .bm_h .o img,
.ms-tech-forum-home .bmw .bm_h .o i {
    margin: 0 !important;
    vertical-align: middle !important;
}

/* 标题栏左右内容都在同一中线 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h > *,
.ms-tech-forum-home .sd .bm_h > *,
.ms-tech-forum-home .sd .blocktitle > *,
.ms-tech-forum-home .sd .title > * {
    align-self: center;
}


/* =========================================================
   MS Tech Forum Home v3.2
   Correct N7 category header flex order
   ========================================================= */

/*
N7 源码顺序：
<span class="o">开关</span>
<span class="y">版主（可选）</span>
<h2>分类标题</h2>

Flex 默认按 DOM 顺序排列，所以 v3.1 的开关跑到了最左。
v3.2 只调整 order，不再碰蓝色竖线。
*/

/* 标题固定第一位 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2,
.ms-tech-forum-home .bmw > .bm_h h2 {
    order: 1 !important;
    flex: 0 1 auto !important;
}

/* 版主/辅助信息放在标题之后 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h > .y,
.ms-tech-forum-home .bmw > .bm_h > .y {
    order: 2 !important;
    flex: 0 0 auto !important;
    margin-left: 12px !important;
}

/* 折叠开关永远放到最右 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h > .o,
.ms-tech-forum-home .bmw > .bm_h > .o {
    order: 3 !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* 标题链接不要被旧 float 干扰 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2,
.ms-tech-forum-home .ms-tech-forum-category > .bm_h h2 a,
.ms-tech-forum-home .bmw > .bm_h h2,
.ms-tech-forum-home .bmw > .bm_h h2 a {
    float: none !important;
}

/* 开关保持 48px 标题栏垂直居中 */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h > .o,
.ms-tech-forum-home .bmw > .bm_h > .o {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    height: 48px !important;
    padding: 0 !important;
    transform: none !important;
}


/* =========================================================
   MS Tech Forum Home v3.3
   Remove unused top DIY row / tighten vertical rhythm
   ========================================================= */

/*
之前 #diy_chart 占据 Grid 第一行：
DIY  DIY
主栏 右栏

即使没有可见 DIY 内容，N7/Discuz 的 DIY 容器仍可能产生高度，
再叠加 row gap，造成面包屑下方约 100px 的空白。

v3.3 已从模板删除该空 DIY 区域。
Grid 现在只保留真正需要的一行。
*/
#ct.ms-tech-forum-home {
    grid-template-areas: "main side" !important;
    grid-template-columns: minmax(0, 1fr) 300px !important;
    grid-template-rows: auto !important;
    column-gap: 24px !important;
    row-gap: 0 !important;
    margin-top: 0 !important;
}

/* 防止旧缓存/DIY 注入重新撑高首页顶部 */
#ct.ms-tech-forum-home > #diy_chart {
    display: none !important;
    grid-area: auto !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* 面包屑与主内容之间只保留紧凑阅读间距 */
.ms-tech-home-pt {
    margin-top: 12px !important;
    margin-bottom: 18px !important;
}

/* 主内容与右栏从同一顶线开始 */
#ct.ms-tech-forum-home > .mn,
#ct.ms-tech-forum-home > .sd {
    margin-top: 0 !important;
    align-self: start !important;
}

/* 首页第一张卡片不再有额外上边距 */
.ms-tech-forum-home .comiis_flbm > .bm:first-child,
.ms-tech-forum-home .sd > *:first-child {
    margin-top: 0 !important;
}

/* 中等屏宽保持相同紧凑逻辑 */
@media (max-width: 1120px) and (min-width: 901px) {
    #ct.ms-tech-forum-home {
        grid-template-areas: "main side" !important;
        grid-template-columns: minmax(0, 1fr) 270px !important;
        column-gap: 18px !important;
        row-gap: 0 !important;
    }
}


/* =========================================================
   MS Tech Forum Home v3.4
   Remove the REAL blank block between breadcrumb and content
   ========================================================= */

/*
N7 forum/discuz.php 中，面包屑 #pt 后面还有：

<div class="wp">
    <div id="diy1" class="area"></div>
</div>

它与截图中的空白位置完全一致。
v3.3 删除的是 #ct 内的 diy_chart，因此没有改变这里。
v3.4 已从模板直接删除 diy1。
*/

/* 缓存/DIY 旧样式兜底 */
#diy1,
#diy1.area,
body #diy1,
.pg_forum #diy1 {
    display: none !important;
    position: static !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
}

/* 面包屑之后直接进入主体 */
.ms-tech-home-pt {
    margin-bottom: 14px !important;
}

#ct.ms-tech-forum-home {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 如果 DIY 缓存给紧邻的空 wp 容器写了高度，也不允许撑开 */
.ms-tech-home-pt + .wp:has(> #diy1) {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 主栏和右栏首卡片顶线完全一致 */
#ct.ms-tech-forum-home > .mn > .comiis_flbm,
#ct.ms-tech-forum-home > .sd {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* =========================================================
   MS N7 forum collapse switch v3.9
   Restore the original N7/Discuz dzicon symbols.
   Only fix the layout/centering; do not redraw the icon.
   Supports both category (.o > em) and online (.o > a > em).
   ========================================================= */
.ms-tech-forum-home .ms-tech-forum-category > .bm_h > .o,
.ms-tech-forum-home .bmw > .bm_h > .o {
    position: static !important;
    float: none !important;
    display: flex !important;
    flex: 0 0 30px !important;
    align-self: stretch !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    line-height: normal !important;
    transform: none !important;
}

/* Some N7 fold switches (online list) wrap the em in an anchor. */
.ms-tech-forum-home .bm_h > .o > a {
    float: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
    text-decoration: none !important;
}

.ms-tech-forum-home .bm_h > .o > em.tg_yes,
.ms-tech-forum-home .bm_h > .o > em.tg_no,
.ms-tech-forum-home .bm_h > .o > a > em.tg_yes,
.ms-tech-forum-home .bm_h > .o > a > em.tg_no {
    position: static !important;
    float: none !important;
    display: flex !important;
    flex: 0 0 30px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 48px !important;
    min-width: 30px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    font-family: "dzicon" !important;
    font-size: 26px !important;
    font-style: normal !important;
    font-weight: normal !important;
    line-height: 26px !important;
    vertical-align: middle !important;
    transform: none !important;
    overflow: visible !important;
    cursor: pointer;
}

/* Restore Discuz/N7's original glyphs explicitly. */
.ms-tech-forum-home .bm_h > .o > em.tg_yes::before,
.ms-tech-forum-home .bm_h > .o > a > em.tg_yes::before {
    content: "\f108" !important;
}

.ms-tech-forum-home .bm_h > .o > em.tg_no::before,
.ms-tech-forum-home .bm_h > .o > a > em.tg_no::before {
    content: "\f109" !important;
}

.ms-tech-forum-home .bm_h > .o > em.tg_yes::before,
.ms-tech-forum-home .bm_h > .o > em.tg_no::before,
.ms-tech-forum-home .bm_h > .o > a > em.tg_yes::before,
.ms-tech-forum-home .bm_h > .o > a > em.tg_no::before {
    position: static !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    font-family: "dzicon" !important;
    font-size: 26px !important;
    font-style: normal !important;
    font-weight: normal !important;
    line-height: 26px !important;
    transform: none !important;
}

/* Remove the geometric helper stroke from the previous patch. */
.ms-tech-forum-home .bm_h > .o > em.tg_yes::after,
.ms-tech-forum-home .bm_h > .o > em.tg_no::after,
.ms-tech-forum-home .bm_h > .o > a > em.tg_yes::after,
.ms-tech-forum-home .bm_h > .o > a > em.tg_no::after {
    content: none !important;
    display: none !important;
}
