/* ============================================================
   智慧公寓管理系统 · 北京财贸职业学院
   设计系统 v2 —— 一套样式同时适配手机与电脑
   ------------------------------------------------------------
   约定：
   1. 颜色一律走变量，不写死色值，便于整体换肤与暗色模式；
   2. 组件类名保持稳定，页面只负责组合，不重复定义样式；
   3. 断点统一 900px：小于为移动端（抽屉侧栏），大于为桌面端（固定侧栏）。
   ============================================================ */

:root {
    /* ---- 品牌色阶 ---- */
    --brand-900: #0C3A66;
    --brand-800: #10487C;
    --brand-700: #15528F;
    --brand-600: #1A67B3;
    --brand-500: #2A7FD4;
    --brand-300: #7FB3E3;
    --brand-100: #E3EEF9;
    --brand-50: #F2F7FC;

    /* ---- 点缀色 ---- */
    --accent: #C08A22;
    --accent-soft: #FBF2DC;

    /* ---- 语义色 ---- */
    --ok: #0F9D6B;
    --ok-soft: #E6F6F0;
    --warn: #CF7A0C;
    --warn-soft: #FDF3E2;
    --danger: #D34040;
    --danger-soft: #FCECEC;
    --info: #2A7FD4;
    --info-soft: #E9F2FB;
    --purple: #7355D6;
    --purple-soft: #F0ECFD;

    /* ---- 中性色 ---- */
    --bg: #F2F5F9;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --surface-3: #EDF2F8;
    /* 分组容器底：比页面 bg 深一档、比 --line 浅，白卡压上去才分得开。
       起手写的 #E8EEF5 用户反馈偏深，收到 #EBF0F7（与页面差 7 阶、与白卡差 20 阶） */
    --surface-4: #EBF0F7;
    --line: #E3E9F0;
    --line-strong: #CFD9E4;
    --ink: #17263A;
    --ink-2: #46586C;
    --ink-3: #78889A;
    --ink-4: #A3B0BF;

    /* ---- 形状与投影 ---- */
    --r-xs: 7px;
    --r-sm: 9px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --sh-flat: 0 1px 2px rgba(16, 40, 70, .05);
    --sh-1: 0 1px 2px rgba(16, 40, 70, .05), 0 2px 6px rgba(16, 40, 70, .04);
    --sh-2: 0 2px 6px rgba(16, 40, 70, .06), 0 10px 26px rgba(16, 40, 70, .08);
    --sh-3: 0 14px 40px rgba(16, 40, 70, .16);

    /* ---- 布局 ---- */
    --sidebar-w: 232px;
    --header-h: 60px;

    --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover {
    color: var(--brand-700);
}

/* 滚动条：细一些，别抢视线 */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 9px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-4);
    background-clip: content-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* 线性图标：统一描边，颜色跟随文字 */
.icon {
    width: 1em;
    height: 1em;
    flex: none;
    display: inline-block;
    vertical-align: -.14em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================================
   顶栏
   ============================================================ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: linear-gradient(100deg, #0E4373 0%, #15528F 48%, #1E6FBE 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    z-index: 30;
    /* 只留内侧高光，去掉向下的投影：投影会落在侧栏顶上，
       而左上角品牌块在顶栏内部、吃不到这条投影，两者就差出一条灰带（2026-10-29 实拍发现）。 */
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    min-width: 0;
}

.topbar .brand:hover {
    color: #fff;
}

/* 品牌区容器：窄屏就是普通行内一块（蓝底白字），宽屏才变成「侧栏向上延伸的一块」，见下方 900px 媒体查询 */
.topbar .brand-block {
    display: flex;
    align-items: center;
    min-width: 0;
}

.topbar .mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    /* 里面是一个「财」字，不是线性图标：字比线条粗、缩到 34px 也认得出 */
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    /* 必须显式给白色：这块在浅色主题下继承的是深墨色标题色（.brand-block .brand），
       深蓝字压在蓝方块上看不清——上一版楼栋图标也是吃了这个亏 */
    color: #fff;
    flex: none;
}

.topbar .brand-text {
    min-width: 0;
    line-height: 1.25;
}

.topbar .brand-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .brand-text span {
    display: block;
    font-size: 11px;
    opacity: .74;
    white-space: nowrap;
    letter-spacing: .6px;
    /* 品牌区宽度锁死成侧栏宽（232px），副标题「北京财贸职业学院 · 通州校区」差几个像素就顶出去，
       这里必须能省略，否则会被 .brand-block 的 overflow:hidden 从中间切断 */
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .spacer {
    flex: 1;
    min-width: 0;
}

/* 校区切换器：顶栏上的分段开关，当前校区为实心白底 */
.topbar .campus-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    margin-right: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
}

.topbar .campus-switch a {
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.2;
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}

.topbar .campus-switch a:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.topbar .campus-switch a.is-on {
    background: #fff;
    color: #185FA5;
    font-weight: 500;
}

@media (max-width: 900px) {
    .topbar .campus-switch {
        display: none;
    }
}

.topbar .who {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 5px;
    border-radius: 40px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .14);
}

.topbar .who .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex: none;
}

.topbar .who .who-text {
    line-height: 1.2;
    min-width: 0;
}

.topbar .who .who-text b {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.topbar .who .who-text i {
    display: block;
    font-style: normal;
    font-size: 10.5px;
    opacity: .72;
    white-space: nowrap;
}

.menu-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 0 7px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 9px;
    cursor: pointer;
    flex: none;
}

.menu-btn i {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.menu-btn i:nth-child(2) {
    width: 70%;
}

/* ============================================================
   侧边栏
   ============================================================ */

.sidebar {
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    padding: 0 10px 40px;
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.4, 0, .2, 1),
                width .4s cubic-bezier(.22, 1, .36, 1),
                background .34s cubic-bezier(.33, 1, .68, 1),
                border-color .34s cubic-bezier(.33, 1, .68, 1);
    z-index: 25;

    /* 侧栏自己的配色变量：浅色是默认，深色只在 html[data-nav-theme="dark"] 里改这一组，
       下面所有规则都引用 --sb-*，不要再出现 var(--ink-2) 这类直接引用，否则深色要改十几处。 */
    --sb-ink: var(--ink-2);
    --sb-dim: var(--ink-3);
    --sb-ico: var(--ink-4);
    --sb-hover: var(--brand-50);
    --sb-hover-ink: var(--brand-700);
    --sb-hover-ico: var(--brand-500);
    --sb-active: var(--brand-100);
    --sb-active-ink: var(--brand-800);
    --sb-active-bar: var(--brand-600);
    --sb-line: var(--line);
    --sb-bar: var(--surface);
    --ease-spring: cubic-bezier(.22, 1, .36, 1);
    --ease-soft: cubic-bezier(.33, 1, .68, 1);
}

.sidebar.open {
    transform: translateX(0);
    box-shadow: var(--sh-3);
}

/* 深色侧栏：底色取品牌 900，文字走浅蓝白。
   只改这一组变量，其余规则自动跟随。 */
html[data-nav-theme="dark"] .sidebar {
    background: #0C3A66;
    border-right-color: #082C50;
    --sb-ink: #D9E6F5;
    --sb-dim: #93AECE;
    --sb-ico: #7E9BBE;
    --sb-hover: rgba(255, 255, 255, .09);
    --sb-hover-ink: #FFFFFF;
    --sb-hover-ico: #FFFFFF;
    --sb-active: rgba(255, 255, 255, .15);
    --sb-active-ink: #FFFFFF;
    --sb-active-bar: #7FB3E3;
    --sb-line: rgba(255, 255, 255, .13);
    --sb-bar: #0C3A66;
}

/* ---------------- 顶部工具条：切配色 / 收起整栏 ---------------- */

.sb-tools {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 8px 2px 4px;
    background: var(--sb-bar);
    transition: padding .4s var(--ease-spring), background .34s var(--ease-soft);
}

.sb-tool {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--sb-ico);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .26s var(--ease-soft), color .26s var(--ease-soft),
                transform .3s var(--ease-spring);
}

.sb-tool:hover {
    background: var(--sb-hover);
    color: var(--sb-hover-ink);
    transform: scale(1.06);
}

.sb-tool:active {
    transform: scale(.92);
}

.sb-tool:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 1px;
}

.sb-tool .icon {
    font-size: 15px;
    transition: transform .44s var(--ease-spring);
}

/* ---------------- 一级菜单：可折叠父节点 ---------------- */

.nav-sec {
    margin-top: 4px;
}

.nav-sec-head {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--sb-ink);
    padding: 9px;
    border-radius: 11px;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: background .26s var(--ease-soft), color .26s var(--ease-soft),
                padding .4s var(--ease-spring);
}

.nav-sec-head:hover {
    background: var(--sb-hover);
    color: var(--sb-hover-ink);
}

.nav-sec-head:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: -2px;
}

.nav-sec-head .icon {
    font-size: 16px;
    flex: none;
    color: var(--sb-ico);
    transition: color .26s var(--ease-soft), transform .34s var(--ease-spring);
}

.nav-sec-head:hover .icon {
    color: var(--sb-hover-ico);
    transform: scale(1.06);
}

.nav-sec-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity .3s var(--ease-soft);
}

.nav-sec-arw {
    width: 12px;
    height: 12px;
    flex: none;
    color: var(--sb-ico);
    transition: transform .42s var(--ease-spring), color .26s var(--ease-soft);
}

.nav-sec.is-closed .nav-sec-arw {
    transform: rotate(-90deg);
}

/* 当前页所在段：图标上色 + 左侧一条竖条。
   竖条只做标识，不用整块底，免得和下面二级项的选中态抢注意力。 */
.nav-sec.has-active .nav-sec-head {
    color: var(--sb-active-ink);
}

.nav-sec.has-active .nav-sec-head .icon {
    color: var(--sb-active-bar);
}

.nav-sec.has-active .nav-sec-head::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    border-radius: 0 3px 3px 0;
    background: var(--sb-active-bar);
}

/* 竖条「长出来」只在用户手动展开那一段时播；页面加载时直接是最终态，
   否则每点一次菜单、整页刷新后这条又要重新长一次，看着像整列都在刷新 */
.nav-sec.is-anim.has-active .nav-sec-head::before {
    animation: sbBar .5s var(--ease-spring) both;
}

@keyframes sbBar {
    from { height: 0; opacity: 0; }
    to { height: 16px; opacity: 1; }
}

/* ---------------- 二级：高度渐变展开 ---------------- */

.nav-sec-body {
    margin: 0 0 2px 17px;
    padding-left: 11px;
    border-left: 1px solid var(--sb-line);
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows .42s var(--ease-spring),
                opacity .34s var(--ease-soft),
                margin-left .34s var(--ease-soft),
                padding-left .34s var(--ease-soft);
}

.nav-sec.is-closed .nav-sec-body {
    grid-template-rows: 0fr;
    opacity: 0;
}

/* 首屏兜底：脚本把「哪些段是收起的」标上去之前不要播过渡，
   否则每个页面加载时都可能看到菜单先展开、再收回（脚本在 body 末尾，偶尔会晚一帧） */
html:not(.nav-js-ready) .nav-sec-body {
    transition: none;
}

.nav-sec-inner {
    overflow: hidden;
    display: grid;
    gap: 1px;
    min-height: 0;
}

/* 子项错开 30ms 轻推入场：只在用户手动展开某一段时播（.is-anim 由脚本点开时加、收起时去掉）。
   原先写成「所有展开状态的段都播」，结果每次点菜单都是一次整页请求，
   刷新后整列菜单再淡入一遍，看起来像整个列表跟着刷新。 */
.nav-sec.is-anim:not(.is-closed) .nav-sec-inner > * {
    animation: sbItem .4s var(--ease-spring) both;
}

.nav-sec-inner > *:nth-child(1) { animation-delay: .03s; }
.nav-sec-inner > *:nth-child(2) { animation-delay: .06s; }
.nav-sec-inner > *:nth-child(3) { animation-delay: .09s; }
.nav-sec-inner > *:nth-child(4) { animation-delay: .12s; }
.nav-sec-inner > *:nth-child(5) { animation-delay: .15s; }
.nav-sec-inner > *:nth-child(6) { animation-delay: .18s; }
.nav-sec-inner > *:nth-child(7) { animation-delay: .21s; }
.nav-sec-inner > *:nth-child(8) { animation-delay: .24s; }

@keyframes sbItem {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: none; }
}

/* ---------------- 侧栏内的链接 ---------------- */

.sidebar a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7.5px 9px;
    border-radius: 9px;
    color: var(--sb-dim);
    font-size: 13px;
    margin-bottom: 1px;
    transition: background .28s var(--ease-soft), color .28s var(--ease-soft),
                padding-left .3s var(--ease-spring);
}

.sidebar a .icon {
    font-size: 16px;
    flex: none;
    color: var(--sb-ico);
    transition: color .26s var(--ease-soft);
}

.sidebar a:hover {
    background: var(--sb-hover);
    color: var(--sb-hover-ink);
    padding-left: 12px;
}

.sidebar a:hover .icon {
    color: var(--sb-hover-ico);
}

.sidebar a.is-active {
    background: linear-gradient(90deg, var(--sb-active), rgba(255, 255, 255, 0) 96%);
    color: var(--sb-active-ink);
    font-weight: 600;
}

html[data-nav-theme="dark"] .sidebar a.is-active {
    background: var(--sb-active);
}

.sidebar a.is-active .icon {
    color: var(--sb-active-bar);
}

/* 竖条压在左侧那条分隔线上（.nav-sec-body 的 border-left），不是贴在文字边上 */
.sidebar a.is-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 15px;
    border-radius: 0 2px 2px 0;
    background: var(--sb-active-bar);
}

.sidebar a.danger {
    color: var(--danger);
}

.sidebar a.danger .icon {
    color: var(--danger);
}

/* 未读数：靠右，带一圈缓慢呼吸的红色描边，别做太急 */
.sidebar a .tag.danger {
    margin-left: auto;
    animation: sbPulse 2.6s var(--ease-soft) infinite;
}

@keyframes sbPulse {
    0%   { box-shadow: 0 0 0 0 rgba(211, 64, 64, .45); }
    70%  { box-shadow: 0 0 0 6px rgba(211, 64, 64, 0); }
    100% { box-shadow: 0 0 0 0 rgba(211, 64, 64, 0); }
}

/* ---------------- 收起成图标栏（只在宽屏，窄屏侧栏是抽屉） ---------------- */

@media (min-width: 900px) {

    html[data-nav-rail="1"] {
        --sidebar-w: 62px;
    }

    html[data-nav-rail="1"] .sb-tools {
        justify-content: center;
        flex-direction: column;
        gap: 2px;
        padding: 8px 0 4px;
    }

    html[data-nav-rail="1"] #navRailBtn .icon {
        transform: rotate(180deg);
    }

    html[data-nav-rail="1"] .nav-sec-head {
        justify-content: center;
        padding: 11px 0;
        margin-top: 6px;
    }

    /* 必须 display:none，不能只给 width:0：
       .nav-sec-label 是 flex:1，宽度 0 但会继续撑满剩余空间，
       结果图标被推到左边、看起来没居中 */
    html[data-nav-rail="1"] .nav-sec-label,
    html[data-nav-rail="1"] .nav-sec-arw {
        display: none;
    }

    html[data-nav-rail="1"] .nav-sec-head .icon {
        font-size: 19px;
    }

    html[data-nav-rail="1"] .nav-sec-body {
        grid-template-rows: 0fr;
        opacity: 0;
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }

    html[data-nav-rail="1"] .nav-sec.has-active .nav-sec-head {
        background: var(--sb-active);
    }

    /* 图标栏里当前段只用底色标识，不挂竖条也不加小圆点 */
    html[data-nav-rail="1"] .nav-sec.has-active .nav-sec-head::before {
        display: none;
    }

    /* 悬停浮出段名：::after 给气泡，::before 已经被当前段的标识占着，所以不做小尖角 */
    html[data-nav-rail="1"] .nav-sec-head:hover::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 9px);
        top: 50%;
        white-space: nowrap;
        padding: 6px 11px;
        border-radius: 9px;
        background: #12233A;
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: .2px;
        box-shadow: var(--sh-2);
        z-index: 60;
        pointer-events: none;
        opacity: 0;
        transform: translateY(-50%) translateX(-8px);
        animation: sbTip .34s var(--ease-spring) .09s forwards;
    }

    @keyframes sbTip {
        to { opacity: 1; transform: translateY(-50%) translateX(0); }
    }

    /* 主区与顶栏让位：宽度跟着 --sidebar-w 走，这里只补一条过渡 */
    .topbar,
    .main {
        transition: padding-left .4s var(--ease-spring, cubic-bezier(.22, 1, .36, 1));
    }
}

/* ---------------- 品牌区：侧栏向上延伸的一块 ----------------
   宽屏时左上角这块等于侧栏的「头」：宽度 = --sidebar-w、底色跟侧栏走，
   和侧栏拼成 L 形。顶栏的 padding-left 已经让开了同样的宽度，所以别的元素不会压上来。
   侧栏收成图标栏时这块跟着收到 62px，只留 logo。 */
@media (min-width: 900px) {

    .topbar .brand-block {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-w);
        padding: 0 14px;
        background: var(--surface);
        border-right: 1px solid var(--line);
        overflow: hidden;
        transition: width .4s var(--ease-spring, cubic-bezier(.22, 1, .36, 1)),
                    padding .4s var(--ease-spring, cubic-bezier(.22, 1, .36, 1)),
                    background .34s var(--ease-soft, cubic-bezier(.33, 1, .68, 1)),
                    border-color .34s var(--ease-soft, cubic-bezier(.33, 1, .68, 1));
    }

    /* 浅色：白底 + 深蓝墨字，logo 块用实心品牌蓝（和深蓝顶栏上的半透明白块区分开） */
    .topbar .brand-block .brand {
        color: var(--ink);
    }

    .topbar .brand-block .brand:hover {
        color: var(--ink);
    }

    .topbar .brand-block .mark {
        background: linear-gradient(135deg, #1E6FBE 0%, #15528F 100%);
        border-color: transparent;
        box-shadow: 0 3px 9px rgba(21, 82, 143, .26);
    }

    .topbar .brand-block .brand-text span {
        color: var(--ink-3);
        opacity: 1;
    }

    /* 深蓝：整块换成侧栏同一个色，和侧栏无缝，接缝处只留一条更深的细线 */
    html[data-nav-theme="dark"] .topbar .brand-block {
        background: #0C3A66;
        border-right-color: #082C50;
    }

    html[data-nav-theme="dark"] .topbar .brand-block .brand,
    html[data-nav-theme="dark"] .topbar .brand-block .brand:hover {
        color: #fff;
    }

    html[data-nav-theme="dark"] .topbar .brand-block .mark {
        background: rgba(255, 255, 255, .14);
        border-color: rgba(255, 255, 255, .22);
        box-shadow: none;
    }

    html[data-nav-theme="dark"] .topbar .brand-block .brand-text span {
        color: #93AECE;
    }

    /* 图标栏：只剩 logo，居中 */
    html[data-nav-rail="1"] .topbar .brand-block {
        padding: 0;
        justify-content: center;
    }

    html[data-nav-rail="1"] .topbar .brand-text {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar * {
        animation: none !important;
        transition: none !important;
    }
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 30, 50, .42);
    backdrop-filter: blur(2px);
    z-index: 20;
    display: none;
}

.backdrop.show {
    display: block;
}

/* ============================================================
   主区域与页头
   ============================================================ */

.main {
    padding: calc(var(--header-h) + 18px) 14px 56px;
    max-width: 1440px;
    margin: 0 auto;
}

/* 学生列表 15 列，按 1440 收口会把「操作」挤出视口，只能横向拖。
   这一页单独放宽到 1800：宽屏一屏看完，窄屏照旧按容器宽度走。
   放宽的是「数据表」页，驾驶舱等看板页仍是 1440，不跟着变形。 */
.main.main-wide {
    max-width: 1800px;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.page-head h1 {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -.2px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.page-head h1 .icon {
    font-size: 20px;
    color: var(--brand-600);
}

.page-head .sub {
    font-size: 12.5px;
    color: var(--ink-3);
}

.page-head .spacer {
    flex: 1;
    min-width: 0;
}

.crumb {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-bottom: 4px;
}

/* ============================================================
   卡片
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 18px;
    margin-bottom: 16px;
}

.card > h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14.5px;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -.1px;
}

.card > h2 .icon {
    font-size: 16px;
    color: var(--brand-600);
}

.card > h2 .spacer {
    flex: 1;
}

.card.flush {
    padding: 0;
    overflow: hidden;
}

.card.flush > h2 {
    padding: 16px 18px 0;
    margin-bottom: 12px;
}

.card.flush .table-wrap {
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--line);
}

.card.flat {
    box-shadow: none;
}

/* ============================================================
   统计卡
   ============================================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 15px 16px;
    box-shadow: var(--sh-1);
    transition: transform .16s, box-shadow .16s;
}

.stat:hover {
    transform: translateY(-1px);
    box-shadow: var(--sh-2);
}

.stat::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--brand-500);
    opacity: .9;
}

.stat.tint-ok::after {
    background: var(--ok);
}

.stat.tint-warn::after {
    background: var(--warn);
}

.stat.tint-danger::after {
    background: var(--danger);
}

.stat.tint-purple::after {
    background: var(--purple);
}

.stat.tint-accent::after {
    background: var(--accent);
}

.stat .label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 7px;
}

.stat .value {
    font-size: 25px;
    font-weight: 650;
    line-height: 1.15;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}

.stat .value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-3);
    margin-left: 3px;
    letter-spacing: 0;
}

.stat .foot {
    font-size: 11.5px;
    color: var(--ink-4);
    margin-top: 5px;
}

/* 脚注里的补充数字做成小胶囊。
   之前模板写的是 <b class="warn">，但 .warn 在项目里只以组合类存在（.btn.warn / .tag.warn），
   单独写没有任何样式，渲染出来就是「加粗的浅灰 11.5px」，白卡上几乎看不见（2026-10-29 反馈） */
.stat .foot .chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
    vertical-align: 1px;
}

.stat .foot .chip-warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.stat .value.ok,
.value-ok {
    color: var(--ok);
}

.stat .value.warn,
.value-warn {
    color: var(--warn);
}

.stat .value.danger,
.value-danger {
    color: var(--danger);
}

.stat .value.brand,
.value-brand {
    color: var(--brand-600);
}

.stat .value.purple,
.value-purple {
    color: var(--purple);
}

.stat .value.accent,
.value-accent {
    color: var(--accent);
}

/* ============================================================
   表单
   ============================================================ */

.field {
    margin-bottom: 13px;
    min-width: 0;
}

.field > label {
    display: block;
    font-size: 12.5px;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 500;
}

.field .hint {
    font-size: 11.5px;
    color: var(--ink-4);
    margin-top: 5px;
    line-height: 1.5;
}

input[type=text],
input[type=password],
input[type=number],
input[type=date],
input[type=tel],
input[type=search],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .14s, box-shadow .14s;
}

textarea {
    min-height: 84px;
    resize: vertical;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
    color: var(--ink-4);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(42, 127, 212, .14);
}

input:disabled,
select:disabled,
input[readonly] {
    background: var(--surface-3);
    color: var(--ink-3);
    cursor: not-allowed;
}

input[type=checkbox],
input[type=radio] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-600);
    cursor: pointer;
    vertical-align: -2px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378889A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* 工具栏：一排筛选控件 */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.toolbar .field {
    margin-bottom: 0;
    flex: 0 1 150px;
}

.toolbar .field.wide {
    flex: 1 1 220px;
    min-width: 180px;
}

.toolbar .field.narrow {
    flex: 0 1 110px;
}

.toolbar .field.auto {
    flex: 0 0 auto;
}

.toolbar .sep {
    flex: 1;
    min-width: 0;
}

/* 表单栅格 */
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 0 14px;
}

.grid-2 {
    grid-template-columns: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr;
}

.grid-4 {
    grid-template-columns: 1fr;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 4px;
}

/* 注意：选择器带上 .field > 前缀，否则会被「.field > label { display:block }」按优先级覆盖 */
.field > label.checkline,
.checkline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--ink-2);
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

/* 指标名后的小问号提示 */
.hint-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    margin-left: 3px;
    border-radius: 50%;
    background: var(--line-strong);
    color: var(--ink-3);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    vertical-align: super;
    text-decoration: none;
}

/* ============================================================
   按钮
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    background: var(--brand-600);
    color: #fff;
    white-space: nowrap;
    transition: background .14s, box-shadow .14s, transform .1s, border-color .14s;
}

.btn:hover {
    background: var(--brand-700);
    color: #fff;
}

.btn:active {
    transform: translateY(1px);
}

.btn .icon {
    font-size: 15px;
}

.btn.ghost {
    background: var(--surface);
    color: var(--ink-2);
    border-color: var(--line-strong);
}

.btn.ghost:hover {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: var(--brand-300);
}

.btn.soft {
    background: var(--brand-100);
    color: var(--brand-800);
}

.btn.soft:hover {
    background: #D6E6F8;
    color: var(--brand-900);
}

.btn.ok {
    background: var(--ok);
}

.btn.ok:hover {
    background: #0C8257;
}

.btn.warn {
    background: var(--warn);
}

.btn.warn:hover {
    background: #B3680A;
}

.btn.danger {
    background: var(--danger);
}

.btn.danger:hover {
    background: #B93232;
}

.btn.danger-ghost {
    background: var(--surface);
    color: var(--danger);
    border-color: #F0C8C8;
}

.btn.danger-ghost:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn.sm {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: var(--r-xs);
}

.btn.lg {
    padding: 11px 20px;
    font-size: 15px;
}

.btn.block {
    width: 100%;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================================
   表格
   ============================================================ */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    white-space: nowrap;
}

thead th {
    background: var(--surface-2);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .3px;
    color: var(--ink-3);
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody td {
    padding: 10px 13px;
    border-bottom: 1px solid var(--surface-3);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--brand-50);
}

tbody tr.is-picked {
    background: var(--brand-100);
}

/* 勾选列（批量操作）：列窄、居中，行选中时整行高亮 */
th.pick,
td.pick {
    width: 40px;
    padding-right: 0;
    text-align: center;
}

th.pick input,
td.pick input {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--brand-600);
    vertical-align: middle;
}

td.pick input:disabled {
    cursor: not-allowed;
    opacity: .35;
}

/* ------------------------------------------------------------
   宽表自适应（用于学生列表这类 15 列以上的表）
   ------------------------------------------------------------
   设计取舍：
   1. 所有单元格一律不换行 —— 一行一条记录，行高统一，按钮好点；
   2. 左右内边距压到 8px（普通表格是 13px），把 16 列的总宽从 1311px
      压到 1150px 左右，正好落在内容区 1164px 之内，宽屏不出现横向滚动；
   3. 窗口不够宽时自动折叠次要列（.col-optional），而不是把文字挤成两行；
      折叠期间页面会显示一条提示，避免误以为数据丢了。
   ------------------------------------------------------------ */
table.fit {
    table-layout: auto;
}

table.fit th,
table.fit td {
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 8px;
}

/* 操作列要在最右侧，留一点余量避免按钮贴边 */
table.fit th.act,
table.fit td.act {
    padding-left: 12px;
    padding-right: 14px;
}

table.fit td.act .btn.sm {
    padding-left: 8px;
    padding-right: 8px;
}

/* 操作列固定在右侧（学生列表）。
   列多时总宽超过内容区，表格要横向滚动，「详情 / 编辑」被推到视口外，
   得先把滚动条拖到底才点得到——长名单里非常难用。固定后滚到哪儿都能点。
   手机端（≤899px）表格会转成卡片，用不到这条，也不该让 sticky 参与卡片布局。 */
@media (min-width: 900px) {
    table.fit.sticky-act th.act,
    table.fit.sticky-act td.act {
        position: sticky;
        right: 0;
        background: var(--surface);
        /* 左边一条细线常驻：不溢出时就是列分隔线；溢出滚动时柔光让"这列是固定的"看得出来 */
        box-shadow: inset 1px 0 0 var(--line), -6px 0 10px -8px rgba(16, 40, 66, .18);
    }

    table.fit.sticky-act thead th.act {
        background: var(--surface-2);
        z-index: 2;
    }

    table.fit.sticky-act tbody td.act {
        z-index: 1;
    }

    /* 固定列自带底色，行 hover / 选中要单独跟一遍，否则出现一条不掉色的白块 */
    table.fit.sticky-act tbody tr:hover td.act {
        background: var(--brand-50);
    }

    table.fit.sticky-act tbody tr.is-picked td.act {
        background: var(--brand-100);
    }
}

/* 「窄屏已折叠」提示：默认不显示 */
.only-narrow {
    display: none;
}

/* 内容区最宽 1164px（.main max-width 1440 - 侧栏 232 - 内边距），
   低于此宽度时折叠次要列，保证每行仍然只有一行 */
@media (max-width: 1439px) {
    table.fit .col-optional {
        display: none;
    }

    .only-narrow {
        display: inline-flex;
    }
}

td.wrap,
th.wrap {
    white-space: normal;
    min-width: 180px;
}

td.mono,
.mono {
    font-family: var(--mono);
    font-size: 12.5px;
    letter-spacing: -.3px;
}

td.num,
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.act {
    text-align: right;
}

.empty {
    text-align: center;
    color: var(--ink-4);
    padding: 44px 14px;
    font-size: 13.5px;
}

.empty .icon {
    display: block;
    margin: 0 auto 10px;
    font-size: 30px;
    color: var(--line-strong);
}

/* 表单内嵌的轻量空状态 */
.empty.sm {
    padding: 22px 14px;
    margin: 0;
    font-size: 13px;
    background: var(--surface-2);
    border: 1px dashed var(--line);
    border-radius: var(--r-sm);
    color: var(--ink-3);
}

.empty.sm .icon {
    display: inline-block;
    margin: 0 6px 0 0;
    font-size: 15px;
    vertical-align: -3px;
}

.row-actions {
    display: inline-flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ============================================================
   徽标
   ============================================================ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.75;
    background: var(--surface-3);
    color: var(--ink-2);
    font-weight: 500;
    white-space: nowrap;
}

.tag .icon {
    font-size: 12px;
}

.tag.ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.tag.warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.tag.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.tag.brand {
    background: var(--brand-100);
    color: var(--brand-700);
}

.tag.info {
    background: var(--info-soft);
    color: var(--info);
}

.tag.purple {
    background: var(--purple-soft);
    color: var(--purple);
}

.tag.accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.tag.dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

/* ============================================================
   分页
   ============================================================ */

.pager {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 13px;
    color: var(--ink-3);
}

.pager .spacer {
    flex: 1;
    min-width: 0;
}

.pager .pager-info b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.pager-links {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.pager-links a,
.pager-links span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: var(--r-xs);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.pager-links a:hover {
    background: var(--brand-50);
    border-color: var(--brand-300);
    color: var(--brand-700);
}

.pager-links .is-current {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    font-weight: 600;
}

.pager-links .is-disabled {
    opacity: .45;
    pointer-events: none;
}

/* ============================================================
   提示条
   ============================================================ */

.alert {
    display: flex;
    gap: 9px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.55;
}

.alert .icon {
    font-size: 16px;
    flex: none;
    margin-top: 1px;
}

.alert.err {
    background: var(--danger-soft);
    color: #96302F;
}

.alert.info {
    background: var(--brand-50);
    color: var(--brand-800);
}

.alert.warn {
    background: var(--warn-soft);
    color: #8A5508;
}

.alert.ok {
    background: var(--ok-soft);
    color: #0B7350;
}

/* ============================================================
   吐司
   ============================================================ */

.toast-host {
    position: fixed;
    top: calc(var(--header-h) + 14px);
    right: 14px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: min(370px, calc(100vw - 28px));
    pointer-events: none;
}

.toast {
    background: #1B2C41;
    color: #fff;
    padding: 12px 15px;
    border-radius: var(--r);
    font-size: 13.5px;
    box-shadow: var(--sh-3);
    animation: toastIn .2s cubic-bezier(.34, 1.3, .64, 1);
    line-height: 1.5;
}

.toast.ok {
    background: var(--ok);
}

.toast.err {
    background: var(--danger);
}

/* 警告级提示：事情做成了，但有一处需要人工过一眼（如账号房间范围会少几间） */
.toast.warn {
    background: var(--warn);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }
}

/* ============================================================
   宿舍地图
   ============================================================ */

/* ------------------------------------------------------------
   宿舍地图：按楼层分块，房间按状态着色
   红=住满 / 蓝=未住满 / 绿=空房可用 / 灰虚线=功能房
   ------------------------------------------------------------ */

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 9px;
}

/* 楼层分块 */
.floor-block + .floor-block {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}

.floor-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.floor-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--ink);
    letter-spacing: -.2px;
}

.floor-dots {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 12px;
    color: var(--ink-3);
}

.fdot {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.fdot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-4);
}

.fdot.full::before {
    background: var(--danger);
}

.fdot.part::before {
    background: var(--brand-500);
}

.fdot.vacant::before {
    background: var(--ok);
}

.fdot b {
    color: var(--ink-2);
    font-weight: 650;
}

/* 每层数量：间 · 床 · 在住 · 空床 · 入住率 */
.floor-nums {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--ink-3);
}

.floor-nums > span {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
}

.floor-nums > span + span::before {
    content: "·";
    margin-right: 8px;
    color: var(--ink-4);
}

.floor-nums b {
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 650;
    color: var(--ink);
}

.floor-nums .is-free b {
    color: var(--warn);
}

.floor-nums .is-free.none b {
    color: var(--ink-4);
}

.floor-nums .is-rate b {
    color: var(--brand-500);
}

.floor-nums .is-hidden {
    color: var(--ink-4);
}

/* 房间格 */
.room-cell {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 11px 11px;
    background: var(--surface);
    cursor: pointer;
    transition: transform .14s, box-shadow .14s, border-color .14s;
}

.room-cell:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-2);
}

/* 辅导员无权限的房间：保留房号占位，不让楼层缺块，但点不进去也看不到住人数据 */
.room-cell.noaccess {
    background: var(--bg-2, #f3f5f9);
    border-style: dashed;
    cursor: not-allowed;
    opacity: .55;
}

.room-cell.noaccess:hover {
    transform: none;
    box-shadow: none;
}

.room-cell.noaccess .no {
    color: var(--ink-3);
    font-weight: 500;
}

.room-cell .no {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.3px;
    line-height: 1.2;
}

.room-cell .meta {
    font-size: 11.5px;
    margin-top: 3px;
    color: var(--ink-3);
}

.room-cell .bar {
    height: 4px;
    border-radius: 3px;
    background: rgba(0, 0, 0, .06);
    margin-top: 8px;
    overflow: hidden;
}

.room-cell .bar i {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width .25s;
}

/* 住满：红 */
.room-cell.full {
    background: var(--danger-soft);
    border-color: #F0C4C4;
}

.room-cell.full .no {
    color: #B93030;
}

.room-cell.full .meta {
    color: #C05757;
}

.room-cell.full .bar i {
    background: var(--danger);
}

/* 未住满：蓝 */
.room-cell.part {
    background: var(--info-soft);
    border-color: #C5DCF2;
}

.room-cell.part .no {
    color: var(--brand-700);
}

.room-cell.part .meta {
    color: #5B7B95;
}

.room-cell.part .bar i {
    background: var(--brand-500);
}

/* 空房可用：绿 */
.room-cell.vacant {
    background: var(--ok-soft);
    border-color: #B9E3D2;
}

.room-cell.vacant .no {
    color: #0B7E55;
}

.room-cell.vacant .meta {
    color: #4E9078;
}

.room-cell.vacant .bar i {
    background: var(--ok);
}

/* 功能房：虚线弱化，不可住宿 */
.room-cell.func {
    background: var(--surface-2);
    border-style: dashed;
    cursor: default;
}

.room-cell.func:hover {
    transform: none;
    box-shadow: none;
}

.room-cell.func .no {
    color: var(--ink-3);
    font-weight: 600;
}

.room-cell.func .meta {
    color: var(--ink-4);
    font-size: 12px;
}

/* 图例 */
.map-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--ink-2);
}

.map-legend .sw {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: -1px;
    border: 1px solid transparent;
}

.map-legend .sw.full {
    background: var(--danger-soft);
    border-color: #F0C4C4;
}

.map-legend .sw.part {
    background: var(--info-soft);
    border-color: #C5DCF2;
}

.map-legend .sw.vacant {
    background: var(--ok-soft);
    border-color: #B9E3D2;
}

.map-legend .sw.func {
    background: transparent;
    border: 1px dashed var(--line-strong);
}

/* 房间弹窗内的在住学生卡片 */
.stu-list {
    display: grid;
    gap: 8px;
}

.stu-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .14s, background .14s, box-shadow .14s;
}

.stu-card:hover {
    border-color: var(--brand-500);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

.stu-ava {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-700);
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 650;
}

.stu-main {
    flex: 1 1 auto;
    min-width: 0;
}

.stu-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.stu-bed {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ok);
    background: var(--ok-soft);
    border-radius: 4px;
    padding: 1px 6px;
}

.stu-sub {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stu-go {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 12px;
    color: var(--ink-4);
}

.stu-card:hover .stu-go {
    color: var(--brand-500);
}

.stu-go .icon {
    width: 14px;
    height: 14px;
}

.stu-sec {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.stu-sec:not(:first-child) {
    margin-top: 20px;
}

/* ============================================================
   图表
   ============================================================ */

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 中枢的学院分布：条形加高、字放大一档，站着扫一眼也能看清 */
.bars-lg {
    gap: 14px;
}

.bars-lg .bar-row {
    grid-template-columns: minmax(96px, 158px) 1fr 68px;
    font-size: 15px;
}

.bars-lg .bar-track {
    height: 22px;
    border-radius: 11px;
}

.bars-lg .bar-track i {
    border-radius: 11px;
}

.bars-lg .bar-value {
    font-size: 16px;
    font-weight: 600;
}

/* 性别只有男/女两行，条再粗一档，整块才不会显空 */
.bars-xl {
    gap: 20px;
    padding: 8px 0;
}

.bars-xl .bar-row {
    grid-template-columns: minmax(56px, 86px) 1fr 92px;
    font-size: 16px;
}

.bars-xl .bar-label {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
}

.bars-xl .bar-track {
    height: 40px;
    border-radius: 20px;
}

.bars-xl .bar-track i {
    border-radius: 20px;
}

.bars-xl .bar-value {
    font-size: 20px;
    font-weight: 700;
}

/* 并排两张图等高，内容少的（性别）垂直居中撑满，不顶着上沿 */
.chart-grid.two > .card {
    display: flex;
    flex-direction: column;
}

.chart-grid.two > .card .bars {
    flex: 1;
    justify-content: center;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(80px, 128px) 1fr 52px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.bar-label {
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    display: block;
    height: 15px;
    background: var(--surface-3);
    border-radius: 8px;
    overflow: hidden;
}

.bar-track i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-600));
    border-radius: 8px;
    transition: width .35s cubic-bezier(.4, 0, .2, 1);
}

.bar-track i.ok {
    background: linear-gradient(90deg, #35BE8C, var(--ok));
}

.bar-track i.warn {
    background: linear-gradient(90deg, #E8A33C, var(--warn));
}

.bar-track i.purple {
    background: linear-gradient(90deg, #9C86E8, var(--purple));
}

.bar-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    font-weight: 500;
}

/* ============================================================
   驾驶舱：核心指标脚注进度条 + 楼栋资源卡片墙
   ============================================================ */

/* 入住率卡片里的迷你进度条 */
.mini-track {
    height: 5px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}

.mini-track i {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #C08A22, var(--accent));
    transition: width .35s ease;
}

.mini-track i.accent {
    background: linear-gradient(90deg, #D8A53C, var(--accent));
}

/* 楼栋资源卡片墙 */
.building-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.building-card {
    display: block;
    color: inherit;
    text-decoration: none;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--sh-1);
    transition: border-color .14s, box-shadow .14s, transform .14s;
}

.building-card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--sh-2);
    transform: translateY(-1px);
}

.building-card:hover .bc-foot {
    color: var(--brand-500);
}

/* 卡片底部的「查看宿舍地图」提示 */
.bc-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    font-size: 12px;
    color: var(--ink-4);
}

.bc-foot .icon {
    width: 14px;
    height: 14px;
}

.bc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.bc-name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 15.5px;
    font-weight: 650;
    color: var(--ink);
}

.bc-name .icon {
    color: var(--brand-500);
    font-size: 18px;
}

.bc-rate {
    font-size: 30px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1;
}

.bc-rate small {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

.bc-rate.ok { color: var(--ok); }
.bc-rate.warn { color: var(--warn); }
.bc-rate.danger { color: var(--danger); }

/* 床位堆叠条：已住/空闲双色分段，宽度按真实占比 */
.bc-stack {
    display: flex;
    height: 14px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-3);
    margin-bottom: 9px;
}

.bc-stack i {
    display: block;
    height: 100%;
    transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

.bc-stack .seg-occ {
    background: linear-gradient(90deg, var(--brand-500), var(--brand-600));
}

.bc-stack .seg-empty {
    background: var(--line-strong);
}

/* 堆叠条图例 */
.bc-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--ink-2);
    margin-bottom: 13px;
}

.bc-legend b {
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    margin-left: 3px;
    vertical-align: -1px;
    font-variant-numeric: tabular-nums;
}

.bc-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: -1px;
}

.bc-legend .dot.occ {
    background: var(--brand-500);
}

.bc-legend .dot.emp {
    background: var(--line-strong);
}

.bc-legend .bc-total {
    margin-left: auto;
    color: var(--ink-3);
}

.bc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 12px;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}

/* 有贯通（一年制）学生的楼栋多一格「贯通」，改三列，避免第三格掉到第二行 */
.bc-grid.three {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 8px;
}

.bc-grid.three .bm-value {
    font-size: 16.5px;
}

/* 三列时每格约 105px，「已住（不含贯通）」9 个字必须靠缩小字号 + 收紧字距才放得下 */
.bc-grid.three .bm-label {
    font-size: 10.5px;
    letter-spacing: -0.2px;
}

.bc-metric {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bm-label {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-bottom: 2px;
    white-space: nowrap;
}

.bm-value {
    font-size: 18px;
    font-weight: 650;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.bm-value small {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-4);
    margin-left: 2px;
    letter-spacing: 0;
}

/* ============================================================
   弹窗
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 30, 50, .48);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 60;
}

.modal.show {
    display: flex;
    animation: modalIn .16s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
    }
}

.modal-box {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--sh-3);
    animation: boxIn .2s cubic-bezier(.34, 1.2, .64, 1);
}

.modal-box.wide {
    max-width: 720px;
}

@keyframes boxIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }
}

.modal-box > h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-box > h3 .icon {
    font-size: 18px;
    color: var(--brand-600);
}

.modal-actions {
    display: flex;
    gap: 9px;
    justify-content: flex-end;
    margin-top: 18px;
}

/* ============================================================
   键值信息
   ============================================================ */

.kv {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 8px 12px;
    font-size: 13.5px;
}

.kv dt {
    color: var(--ink-3);
    font-size: 12.5px;
}

.kv dd {
    color: var(--ink);
    word-break: break-all;
}

.info-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--ink-2);
}

.info-strip b {
    color: var(--ink);
}

/* 成员小标签 */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-2);
}

.chip b {
    color: var(--ink);
    font-weight: 600;
}

.chip .bed {
    font-size: 11px;
    color: var(--brand-600);
    background: var(--brand-100);
    border-radius: 20px;
    padding: 0 6px;
}

/* 功能房清单里的可点击卡片（宿舍地图页） */
.func-chip {
    cursor: pointer;
    transition: border-color .12s, background .12s;
}

.func-chip:hover {
    border-color: var(--brand-500);
    background: var(--brand-50);
    color: var(--brand-700);
}

.func-chip .icon {
    color: var(--brand-600);
}

/* ------------------------------------------------------------
   分段切换（如离校统计的 按年 / 按月 / 按日）
   用法：<div class="seg"><button class="is-on">按年</button>…</div>
   ------------------------------------------------------------ */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--surface-3);
    border-radius: var(--r);
    margin-bottom: 14px;
}

.seg button {
    border: none;
    background: transparent;
    font: inherit;
    font-size: 12.5px;
    color: var(--ink-2);
    padding: 5px 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.seg button:hover {
    color: var(--brand-700);
}

.seg button.is-on {
    background: var(--surface);
    color: var(--brand-700);
    font-weight: 600;
    box-shadow: var(--sh-1);
}

/* 床位选择 */
.bed-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bed-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 13.5px;
    cursor: pointer;
    user-select: none;
    transition: all .14s;
}

.bed-opt:hover {
    border-color: var(--brand-300);
    background: var(--brand-50);
}

.bed-opt input {
    display: none;
}

.bed-opt.is-on {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    font-weight: 600;
}

.bed-opt.is-off {
    background: var(--surface-3);
    color: var(--ink-4);
    cursor: not-allowed;
    text-decoration: line-through;
}

/* 照片缩略图 */
.photo-thumb {
    width: 46px;
    height: 46px;
    border-radius: var(--r-xs);
    object-fit: cover;
    border: 1px solid var(--line);
    background: var(--surface-3);
    cursor: zoom-in;
}

/* 文件拖放区 */
.drop {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--r);
    padding: 28px 18px;
    text-align: center;
    background: var(--surface-2);
    transition: all .16s;
    cursor: pointer;
}

.drop:hover,
.drop.is-over {
    border-color: var(--brand-500);
    background: var(--brand-50);
}

.drop .icon {
    font-size: 30px;
    color: var(--brand-500);
    display: block;
    margin: 0 auto 10px;
}

.drop strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.drop span {
    font-size: 12.5px;
    color: var(--ink-3);
}

.drop input[type=file] {
    display: none;
}

.file-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 11px;
    border-radius: 20px;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 12.5px;
}

/* 结果提示 */
.report {
    margin-top: 14px;
}

.report-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 13px;
    margin-bottom: 8px;
}

.report-row b {
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   登录页
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 16px;
    background: radial-gradient(1200px 600px at 15% 12%, rgba(42, 127, 212, .35), transparent 60%),
    radial-gradient(900px 500px at 88% 88%, rgba(192, 138, 34, .22), transparent 62%),
    linear-gradient(150deg, #0B3359 0%, #124A7E 46%, #1B6DBA 100%);
}

.login-card {
    width: 100%;
    max-width: 396px;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 34px 28px 26px;
    box-shadow: 0 26px 60px rgba(6, 26, 48, .38);
}

.login-card .logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(140deg, var(--brand-600), var(--brand-800));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 26px;
    box-shadow: 0 10px 24px rgba(21, 82, 143, .32);
}

.login-card h1 {
    font-size: 20px;
    font-weight: 650;
    text-align: center;
    letter-spacing: -.2px;
}

.login-card .school {
    text-align: center;
    font-size: 13.5px;
    color: var(--ink-2);
    margin-top: 5px;
}

.login-card .campus {
    text-align: center;
    font-size: 11.5px;
    color: var(--accent);
    letter-spacing: 2.4px;
    margin: 6px 0 24px;
    text-transform: uppercase;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
    border-radius: var(--r);
}

.login-card .field input {
    padding: 11px 13px;
    font-size: 14.5px;
}

.login-foot {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, .72);
    margin-top: 20px;
    line-height: 1.8;
}

.login-foot a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   工具类
   ============================================================ */

.spacer {
    flex: 1;
    min-width: 0;
}

.muted {
    color: var(--ink-3);
}

.faint {
    color: var(--ink-4);
}

.nowrap {
    white-space: nowrap;
}

.mt-0 {
    margin-top: 0;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.text-sm {
    font-size: 12.5px;
}

.text-right {
    text-align: right;
}

.center {
    text-align: center;
}

.flex {
    display: flex;
}

.between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.wrap-gap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.hide {
    display: none !important;
}

/* ============================================================
   响应式
   ============================================================ */

@media (min-width: 560px) {
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

@media (min-width: 900px) {
    .topbar {
        padding-left: calc(var(--sidebar-w) + 18px);
    }

    .menu-btn {
        display: none;
    }

    .sidebar {
        transform: translateX(0);
    }

    .backdrop {
        display: none !important;
    }

    .main {
        padding-left: calc(var(--sidebar-w) + 18px);
        padding-right: 26px;
    }

    .chart-grid.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 899px) {
    .main {
        padding-top: calc(var(--header-h) + 14px);
        padding-bottom: 44px;
    }

    .page-head h1 {
        font-size: 18px;
    }

    .topbar .who .who-text i {
        display: none;
    }

    .toolbar .field,
    .toolbar .field.wide,
    .toolbar .field.narrow {
        flex: 1 1 46%;
        min-width: 128px;
    }

    .toolbar .btn {
        flex: 1 1 100%;
    }

    .stat .value {
        font-size: 22px;
    }

    .card {
        padding: 15px;
        border-radius: var(--r);
    }

    .modal-box {
        padding: 17px;
        max-height: 92vh;
    }

    .bar-row {
        grid-template-columns: minmax(66px, 96px) 1fr 46px;
    }
}

/* ============================================================
   通知中心
   ============================================================ */

/* 顶栏铃铛与未读角标 */
.bell {
    position: relative;
}

.bell .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--brand-500);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--brand-800);
}

.bell .badge.is-danger {
    background: var(--danger);
}

/* 通知列表 */
.notice-list {
    display: flex;
    flex-direction: column;
}

.notice {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.notice:last-child {
    border-bottom: 0;
}

.notice.is-unread {
    background: var(--brand-50);
}

.notice-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--ink-3);
    font-size: 15px;
}

.notice.lv-success .notice-dot {
    background: var(--ok-soft);
    color: var(--ok);
}

.notice.lv-warning .notice-dot {
    background: var(--warn-soft);
    color: var(--warn);
}

.notice.lv-danger .notice-dot {
    background: var(--danger-soft);
    color: var(--danger);
}

.notice-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.notice-body {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--ink-2);
    word-break: break-word;
}

.notice-meta {
    margin-top: 5px;
    font-size: 12px;
    color: var(--ink-4);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.notice-act {
    display: flex;
    gap: 6px;
    align-items: center;
}

.unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    flex: none;
}

/* 驾驶舱摘要 */
.notice-brief {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notice-brief-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 11px 13px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    border-left: 3px solid var(--danger);
}

.notice-brief-item b {
    display: block;
    font-size: 13.5px;
    color: var(--ink);
}

.notice-brief-item span {
    display: block;
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--ink-2);
}

/* 打印：去掉干扰元素，方便贴到墙上 */
@media print {
    .topbar,
    .sidebar,
    .backdrop,
    .pager,
    .btn,
    .toolbar,
    .toast-host {
        display: none !important;
    }

    .main {
        padding: 0;
        max-width: none;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }

    body {
        background: #fff;
    }
}

/* ============================================================
   登录页 · 大气化双栏布局（左品牌区 + 右登录表单）
   ============================================================ */
.login-shell {
    width: 100%;
    max-width: 900px;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--surface);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 34px 90px rgba(4, 22, 42, .5);
}

.login-brand {
    position: relative;
    overflow: hidden;
    padding: 48px 42px 38px;
    display: flex;
    flex-direction: column;
    color: #fff;
    background: linear-gradient(155deg, #0E3D68 0%, #14507F 52%, #1C6FB6 100%);
}

.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-brand::before {
    width: 320px;
    height: 320px;
    right: -110px;
    top: -110px;
    background: radial-gradient(circle, rgba(120, 190, 255, .30), transparent 68%);
}

.login-brand::after {
    width: 260px;
    height: 260px;
    left: -90px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(255, 205, 120, .20), transparent 70%);
}

.brand-logo {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .26);
    box-shadow: 0 14px 34px rgba(4, 22, 42, .35);
    margin-bottom: 24px;
}

.brand-title {
    position: relative;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: .5px;
}

.brand-school {
    position: relative;
    font-size: 14.5px;
    color: rgba(255, 255, 255, .85);
    margin-top: 9px;
}

.brand-slogan {
    position: relative;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .6);
    letter-spacing: 2px;
    margin-top: 6px;
}

.brand-points {
    position: relative;
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.brand-points li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13.5px;
    color: rgba(255, 255, 255, .92);
}

.brand-points .icon {
    width: 18px;
    height: 18px;
    color: #8fd0ff;
    flex: none;
}

.brand-foot {
    position: relative;
    margin-top: auto;
    padding-top: 30px;
    font-size: 12px;
    color: rgba(255, 255, 255, .55);
    letter-spacing: 1.5px;
}

.login-pane {
    padding: 52px 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-pane form {
    width: 100%;
}

.login-pane h2 {
    font-size: 23px;
    font-weight: 650;
    letter-spacing: -.2px;
}

.login-pane .pane-sub {
    font-size: 13px;
    color: var(--ink-3);
    margin: 7px 0 24px;
}

.login-pane .field input {
    padding: 12px 14px;
    font-size: 15px;
}

.login-pane .btn {
    width: 100%;
    padding: 13px;
    font-size: 15.5px;
    margin-top: 10px;
}

/* 登录脚注现位于白底面板，改为深色文字（覆盖旧深底白字版式） */
.login-foot {
    text-align: center;
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 24px;
    line-height: 1.8;
}

.login-foot a {
    color: var(--brand-600);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 登录页「学生住宿申请入口」：次要入口卡片，整块可点，跳转审批系统 */
.login-alt {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
    text-decoration: none;
    transition: border-color .18s, background .18s;
}

.login-alt:hover {
    border-color: var(--brand-300);
    background: var(--brand-50);
}

.login-alt .la-ico {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 19px;
}

.login-alt .la-txt {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.login-alt .la-t {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.4;
}

.login-alt .la-s {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.4;
}

.login-alt .la-go {
    flex: none;
    display: grid;
    place-items: center;
    color: var(--brand-500);
    font-size: 17px;
    transition: transform .18s;
}

.login-alt:hover .la-go {
    transform: translateX(2px);
}

/* 窄屏降级为单栏：隐藏品牌区装饰，仅保留主标题 */
@media (max-width: 760px) {
    .login-shell {
        grid-template-columns: 1fr;
        max-width: 460px;
    }

    .login-brand {
        padding: 30px 26px 26px;
    }

    .brand-points,
    .brand-foot {
        display: none;
    }

    .brand-logo {
        width: 64px;
        height: 64px;
        font-size: 32px;
        margin-bottom: 16px;
    }

    .login-pane {
        padding: 30px 26px 26px;
    }
}

/* ============================================================
   小宇 · 管理端助手
   ------------------------------------------------------------
   容器上挂 data-state，三种形态互斥：
     closed  收起 → 右下角悬浮球
     open    展开 → 对话面板
     hidden  隐藏 → 贴着右边的小标签（随时能叫回来）
   层级 45：在顶栏(30)之上、弹窗(60)之下，弹窗打开时不会挡路。
   ============================================================ */

/* 根容器用 #xy 而不是 .xy —— .xy 太短，一旦被挂到别的节点上就会命中 position:fixed */
#xy {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 45;
    font-size: 13.5px;
}

/* ---------------- 悬浮球 ---------------- */

.xy-ball {
    position: relative;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(12, 58, 102, .26), 0 0 0 1px rgba(21, 82, 143, .08);
    transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s,
                opacity .2s, visibility .2s;
}

.xy-ball img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.xy-ball:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 26px rgba(12, 58, 102, .32);
}

/* 呼吸圈只闪三下就停，起「我在这儿」的提示作用，不长期干扰 */
.xy-beat {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(42, 127, 212, .5);
    pointer-events: none;
    animation: xyBeat 2.2s ease-out 3;
}

@keyframes xyBeat {
    0%   { transform: scale(.86); opacity: .85; }
    70%  { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(1.18); opacity: 0; }
}

/* ---------------- 隐藏后的贴边标签 ---------------- */

.xy-tab {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 9px 11px 9px 13px;
    border: 0;
    border-radius: 999px 0 0 999px;
    background: linear-gradient(120deg, var(--brand-700), var(--brand-500));
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    /* 不许换行：容器只有 58px 宽，不加这句「小宇」会被折成竖排两行 */
    white-space: nowrap;
    cursor: pointer;
    box-shadow: -3px 4px 14px rgba(12, 58, 102, .26);
    opacity: .8;
    transition: opacity .2s, transform .2s, visibility .2s;
}

.xy-tab:hover {
    opacity: 1;
    transform: translateX(-3px);
}

.xy-tab .icon {
    font-size: 15px;
}

/* ---------------- 对话面板 ---------------- */

.xy-panel {
    /* 用 fixed 而不是 absolute：面板要能被拖到屏幕任意位置，
       位置由 inline 的 left/top 控制（拖过之后），没拖过就走下面的默认位。 */
    position: fixed;
    right: 22px;
    bottom: 22px;
    display: flex;
    flex-direction: column;
    width: min(440px, calc(100vw - 44px));
    height: min(660px, calc(100vh - 120px));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.97);
    transform-origin: 100% 100%;
    transition: opacity .2s ease, transform .22s cubic-bezier(.34, 1.3, .64, 1),
                visibility .22s;
}

/* 拖动中：关掉过渡和文字选中，让面板贴着鼠标走 */
.xy-panel.is-drag {
    transition: none;
    user-select: none;
}

/* 三态互斥 */
#xy[data-state="open"] .xy-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

#xy[data-state="open"] .xy-ball {
    opacity: 0;
    visibility: hidden;
    transform: scale(.5);
    pointer-events: none;
}

#xy[data-state="open"] .xy-tab,
#xy[data-state="closed"] .xy-tab,
#xy[data-state="closed"] .xy-panel,
#xy[data-state="hidden"] .xy-panel {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#xy[data-state="hidden"] .xy-ball {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#xy[data-state="hidden"] .xy-tab {
    opacity: .8;
    visibility: visible;
    pointer-events: auto;
}

/* ---------------- 面板头部 ---------------- */

.xy-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    background: linear-gradient(110deg, #123F6E 0%, #17538F 52%, #236FB8 100%);
    color: #fff;
    /* 头部是拖动把手：抓手光标 + 不许选中文字（拖动时会连选一串） */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* 头像别抢指针：否则拖到脸上时会触发图片原生拖拽而不是移动面板 */
.xy-head img {
    pointer-events: none;
}

.xy-panel.is-drag .xy-head {
    cursor: grabbing;
}

.xy-face {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}

.xy-who {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.35;
}

.xy-who b {
    font-size: 14.5px;
    letter-spacing: .3px;
}

.xy-who span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, .78);
}

.xy-on {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ADE80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, .3);
}

.xy-head .xy-ico:first-of-type {
    margin-left: auto;
}

.xy-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--r-xs);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .16s;
}

.xy-ico:hover {
    background: rgba(255, 255, 255, .3);
}

.xy-ico .icon {
    font-size: 15px;
}

/* ---------------- 消息区 ---------------- */

.xy-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px 10px;
    overflow-y: auto;
    background: var(--surface-2);
}

.xy-body::-webkit-scrollbar {
    width: 8px;
}

.xy-body::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: var(--line-strong);
}

.xy-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: xyIn .22s ease;
}

.xy-msg.me {
    justify-content: flex-end;
}

@keyframes xyIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.xy-mini {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 1px 4px rgba(12, 58, 102, .18);
}

.xy-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: calc(100% - 40px);
}

.xy-bub {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px 12px 12px 3px;
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.62;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: var(--sh-1);
}

.xy-msg.me .xy-bub {
    border-color: transparent;
    border-radius: 12px 12px 3px 12px;
    background: linear-gradient(120deg, var(--brand-600), var(--brand-500));
    color: #fff;
    box-shadow: 0 3px 10px rgba(26, 103, 179, .26);
}

/* 打字中的三个点 */
.xy-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 13px;
}

.xy-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-300);
    animation: xyDot 1.2s infinite ease-in-out;
}

.xy-dot:nth-child(2) { animation-delay: .16s; }
.xy-dot:nth-child(3) { animation-delay: .32s; }

@keyframes xyDot {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

/* ---------------- 富内容块 ---------------- */

.xy-block {
    min-width: 0;
}

.xy-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--sh-1);
}

.xy-card h4 {
    margin: 0;
    padding: 8px 11px;
    border-bottom: 1px solid var(--line);
    background: var(--brand-50);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2px;
}

.xy-kv {
    display: flex;
    flex-direction: column;
}

.xy-kv-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 11px;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
}

.xy-kv-row:last-child {
    border-bottom: 0;
}

.xy-kv-row span {
    flex: none;
    color: var(--ink-3);
}

.xy-kv-row b {
    margin-left: auto;
    color: var(--ink);
    font-weight: 600;
    text-align: right;
}

.xy-tbl {
    max-height: 232px;
    overflow: auto;
}

/* 列多时是可以左右滑的，这里把横滚条做成常显，免得用户以为内容被截断了 */
.xy-tbl::-webkit-scrollbar {
    width: 6px;
    height: 9px;
}

.xy-tbl::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 5px;
}

.xy-tbl::-webkit-scrollbar-thumb:hover {
    background: var(--ink-3);
}

.xy-tbl::-webkit-scrollbar-corner {
    background: transparent;
}

.xy-tbl table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.xy-tbl th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 9px;
    border-bottom: 1px solid var(--line-strong);
    background: var(--surface-3);
    color: var(--ink-2);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.xy-tbl td {
    max-width: 150px;
    padding: 6px 9px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xy-tbl tr:last-child td {
    border-bottom: 0;
}

.xy-tbl tbody tr:hover td {
    background: var(--brand-50);
}

.xy-list {
    margin: 0;
    padding: 9px 11px 10px 27px;
    list-style: disc;
    color: var(--ink);
    font-size: 13px;
}

.xy-list li {
    line-height: 1.78;
}

.xy-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: var(--r);
    font-size: 12.8px;
    line-height: 1.6;
}

.xy-note .icon {
    flex: none;
    margin-top: 2px;
    font-size: 14px;
}

.xy-note.warn {
    border-color: #F0D8AE;
    background: var(--warn-soft);
    color: #8A5410;
}

.xy-note.ok {
    border-color: #BEE6D6;
    background: var(--ok-soft);
    color: #0B6B4B;
}

/* ---------------- 高危动作确认条 ---------------- */

.xy-act {
    overflow: hidden;
    border: 1px solid #E9B7B7;
    border-radius: var(--r);
    background: var(--danger-soft);
    animation: xyIn .22s ease;
}

.xy-act-t {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px 8px;
    color: #9E2B2B;
    font-size: 13px;
    font-weight: 600;
}

.xy-act-t .icon {
    flex: none;
    font-size: 15px;
}

.xy-act-b {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 11px 11px;
}

.xy-act-done {
    padding-bottom: 2px;
    color: var(--ink-3);
    font-size: 12.5px;
}

/* ---------------- 快捷指令 ---------------- */

.xy-chips {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 12px 0;
    background: var(--surface-2);
}

.xy-chips:empty {
    display: none;
}

.xy-chip {
    max-width: 100%;
    padding: 5px 10px;
    overflow: hidden;
    border: 1px solid var(--brand-300);
    border-radius: 999px;
    background: var(--surface);
    color: var(--brand-700);
    font: inherit;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s, border-color .16s;
}

.xy-chip:hover {
    border-color: var(--brand-500);
    background: var(--brand-100);
}

/* ---------------- 输入区 ---------------- */

.xy-input {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

.xy-input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}

.xy-input input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(42, 127, 212, .14);
}

.xy-send {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(130deg, var(--brand-600), var(--brand-500));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 103, 179, .3);
    transition: transform .16s, box-shadow .16s, opacity .16s;
}

.xy-send:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 6px 16px rgba(26, 103, 179, .42);
}

.xy-send:disabled {
    opacity: .5;
    cursor: default;
    transform: none;
}

.xy-send .icon {
    font-size: 17px;
}

/* ---------------- 放大态：屏幕正中的大浮窗 ----------------
   小窗看长帮助文本、宽表格会挤，点面板右上角的放大按钮切到居中大浮窗。
   尺寸只改宽高，字号整体上调，保证文字和表格都读得清。 */

#xy[data-size="large"] .xy-panel {
    width: min(58vw, 1040px);
    height: min(90vh, 940px);
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    /* 用独立的 translate 属性做居中偏移，不占用 transform——
       transform 还要留给弹出/收起动画，两者互不干扰。
       拖动时 JS 会把它设成 none，位置就完全交给 left/top。 */
    translate: -50% -50%;
    transform-origin: 50% 50%;
}

#xy[data-size="large"] .xy-head {
    gap: 11px;
    padding: 14px 16px;
}

#xy[data-size="large"] .xy-face {
    width: 46px;
    height: 46px;
}

#xy[data-size="large"] .xy-who b {
    font-size: 16px;
}

#xy[data-size="large"] .xy-who span {
    font-size: 12.5px;
}

#xy[data-size="large"] .xy-ico {
    width: 34px;
    height: 34px;
}

#xy[data-size="large"] .xy-ico .icon {
    font-size: 17px;
}

#xy[data-size="large"] .xy-body {
    gap: 14px;
    padding: 18px 18px 14px;
}

#xy[data-size="large"] .xy-mini {
    width: 34px;
    height: 34px;
}

#xy[data-size="large"] .xy-col {
    gap: 10px;
    max-width: calc(100% - 48px);
}

#xy[data-size="large"] .xy-bub {
    padding: 11px 15px;
    font-size: 15px;
    line-height: 1.72;
}

#xy[data-size="large"] .xy-card h4 {
    padding: 9px 13px;
    font-size: 13.5px;
}

#xy[data-size="large"] .xy-kv-row {
    padding: 9px 13px;
    font-size: 14.5px;
}

#xy[data-size="large"] .xy-tbl {
    max-height: 380px;
}

#xy[data-size="large"] .xy-tbl table {
    font-size: 14px;
}

#xy[data-size="large"] .xy-tbl th,
#xy[data-size="large"] .xy-tbl td {
    padding: 8px 12px;
}

#xy[data-size="large"] .xy-tbl td {
    max-width: 280px;
}

#xy[data-size="large"] .xy-list {
    padding: 11px 13px 12px 30px;
    font-size: 14.5px;
}

#xy[data-size="large"] .xy-note {
    padding: 11px 13px;
    font-size: 14px;
}

#xy[data-size="large"] .xy-note .icon {
    font-size: 16px;
}

#xy[data-size="large"] .xy-act-t {
    font-size: 14.5px;
}

#xy[data-size="large"] .xy-chip {
    padding: 7px 13px;
    font-size: 13.5px;
}

#xy[data-size="large"] .xy-input {
    gap: 10px;
    padding: 12px 18px 16px;
}

#xy[data-size="large"] .xy-input input {
    height: 44px;
    font-size: 15px;
}

#xy[data-size="large"] .xy-send {
    width: 44px;
    height: 44px;
}

/* 中等屏幕：58vw 会显得窄，放宽一些 */
@media (min-width: 561px) and (max-width: 1024px) {
    #xy[data-size="large"] .xy-panel {
        width: min(88vw, 1040px);
    }
}

/* ---------------- 窄屏 ---------------- */

@media (max-width: 560px) {
    #xy {
        right: 12px;
        bottom: 12px;
    }

    .xy-panel {
        right: 12px;
        bottom: 12px;
        width: min(440px, calc(100vw - 24px));
        height: min(70vh, 560px);
    }

    /* 手机上「半个屏幕」没意义，放大就是接近全屏 */
    #xy[data-size="large"] .xy-panel {
        width: calc(100vw - 24px);
        height: min(84vh, 700px);
    }

    #xy[data-size="large"] .xy-tbl td {
        max-width: 180px;
    }
}

/* ============================================================
   手机端卡片模式（≤899px）
   ------------------------------------------------------------
   窄屏上表格必然横向溢出（学生列表要横滑 2.2 屏才看得到姓名和
   操作），这里把每行渲染成一张卡片，点卡片进全屏详情，带「返回」
   并支持手机物理返回键。

   原表格保留在 DOM 里、只是被隐藏，所以：
     · 桌面端完全不受影响
     · 打印仍走原表格
     · 旋转屏幕 / 拉宽窗口会自动还原
   ============================================================ */

.mcards {
    display: none;
}

/* 只在手机上出现的提示（如「请在电脑上导入」） */
.only-mobile {
    display: none;
}

@media (max-width: 899px) {
    .only-mobile {
        display: block;
    }
}

@media (max-width: 899px) {

    /* 卡片区顶到卡片内容底部，留出小宇浮球的空间 */
    .main {
        padding-bottom: 96px;
    }

    .table-wrap.is-carded {
        display: none;
    }

    .mcards {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px 14px;
    }

    .card.flush .mcards {
        padding-bottom: 16px;
    }

    .mcard {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 13px 14px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--r);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: border-color .15s ease, background .15s ease, transform .12s ease;
    }

    .mcard:active {
        transform: scale(.985);
        border-color: var(--brand-300);
        background: var(--brand-50);
    }

    .mcard:focus-visible {
        outline: 2px solid var(--brand-500);
        outline-offset: 2px;
    }

    .mcard-main {
        flex: 1;
        min-width: 0;
    }

    .mcard-title {
        display: flex;
        align-items: center;
        gap: 7px;
        flex-wrap: wrap;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.35;
        color: var(--ink);
    }

    .mcard-title .tag {
        font-weight: 500;
    }

    .mcard-sub {
        margin-top: 4px;
        font-size: 12.5px;
        color: var(--ink-3);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mcard-arrow {
        flex: none;
        font-size: 16px;
        color: var(--ink-4);
    }

    .mcard-empty {
        padding: 44px 16px;
        text-align: center;
        color: var(--ink-3);
        font-size: 13.5px;
    }

    .mcard-empty .icon {
        display: block;
        margin: 0 auto 8px;
        font-size: 26px;
        color: var(--ink-4);
    }

    /* 手机端没有表格了，「已折叠 N 个次要列」这句提示就没意义 */
    .page-head .only-narrow {
        display: none !important;
    }

    /* 导入 / 导出这类「在电脑上做」的入口，手机端不出现 */
    .hide-mobile,
    .sidebar a[href="/admin/import"] {
        display: none !important;
    }

    /* grid 子项默认 min-width:auto，内容较宽时会把整页撑破 */
    .grid-2 > *,
    .grid-3 > *,
    .grid-4 > * {
        min-width: 0;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    /* 小屏顶栏：副标题、角色文字、按钮文字全部收起，只留图标 */
    @media (max-width: 560px) {
        .topbar {
            gap: 8px;
            padding: 0 10px;
        }

        .topbar .brand {
            gap: 8px;
        }

        .topbar .brand-text span {
            display: none;
        }

        .topbar .brand-text strong {
            max-width: 96px;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 13.5px;
        }

        .topbar .mark {
            width: 30px;
            height: 30px;
            font-size: 15px;
        }

        .topbar .who-text {
            display: none;
        }

        .topbar .btn > span.nowrap {
            display: none;
        }

        .topbar .btn {
            padding: 0 9px;
        }
    }
}

/* ---------------- 全屏详情面板 ---------------- */

.msheet {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform .22s cubic-bezier(.32, .72, 0, 1);
    will-change: transform;
}

.msheet.is-in {
    transform: translateX(0);
}

.msheet-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 52px;
    padding: 0 12px 0 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(16, 40, 70, .05);
}

.msheet-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 40px;
    padding: 0 10px 0 2px;
    border: 0;
    background: transparent;
    color: var(--brand-600);
    font-family: inherit;
    font-size: 14.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.msheet-back .icon {
    font-size: 19px;
}

.msheet-back:active {
    opacity: .65;
}

.msheet-title {
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msheet-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px 30px;
}

.mfields {
    padding: 2px 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.mfield {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.mfield:last-child {
    border-bottom: 0;
}

.mfield-k {
    flex: none;
    padding-top: 1px;
    font-size: 13px;
    color: var(--ink-3);
}

.mfield-v {
    flex: 1;
    min-width: 0;
    text-align: right;
    color: var(--ink);
    word-break: break-word;
}

.msheet-acts {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.msheet-acts > .row-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.msheet-acts .btn {
    flex: 1;
}

body.msheet-open {
    overflow: hidden;
}

/* ============================================================
   楼宇数据中枢：指标卡按数量定列，别让 auto-fill 铺得七零八落
   ============================================================ */
.stats-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 「使用情况」只有 3 张卡（已入住 / 未入住 / 入住率），让入住率横跨 2 格，
   正好补满 4 列不留空格；窄屏 2 列时它独占一行，进度条也更长（2026-10-29） */
.metric-group .stats-4 .stat.span2 {
    grid-column: span 2;
}

@media (min-width: 760px) {
    .stats-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* 卡片从 170px 拉到 240px+ 后，25px 的数字显得单薄，放大一档 */
    .stats-4 .stat .value {
        font-size: 28px;
    }
}

/* 指标分组：每组一个浅灰块，白卡浮在上面。
   房间数 / 床位数 / 人数是三套口径、单位不同，平铺在一排最容易看错（2026-10-29） */
.metrics {
    margin-bottom: 16px;
}

/* 底色取 --surface-4，比页面 bg 深一档；--surface-3 太接近页面底色，块会看不出来 */
.metric-group {
    background: var(--surface-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 14px 15px 15px;
    margin-bottom: 18px;
}

/* 卡片的边框和投影在灰块上必须收掉：不收敛的话就是「灰块里嵌一堆凸起白块」，显脏。
   边框转透明而不是删掉——删了会让 border-box 下的内容区变宽 2px，卡片内边距看着变 */
.metric-group .stat {
    border-color: transparent;
    box-shadow: var(--sh-flat);
}

.metric-group .stat:hover {
    box-shadow: var(--sh-1);
}

.metric-group:last-child {
    margin-bottom: 0;
}

.metric-group .stats {
    margin-bottom: 0;
}

.metric-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 11px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-2);
}

.metric-head .icon {
    color: var(--ink-3);
}

.metric-head em {
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    color: var(--ink-3);
}

/* 细线接到最右，把标题和卡片视觉上绑成一组。
   分组有底色后 --line 与块底色差太小几乎看不见，加深一档 */
.metric-head::after {
    content: "";
    flex: 1;
    height: 1px;
    margin-left: 6px;
    background: var(--line-strong);
}

/* 打印时去掉灰块，省墨，也避免底色把卡片边框吃掉 */
@media print {
    .metric-group {
        background: none;
        border: 0;
        padding: 0;
    }

    .metric-group .stat {
        border-color: var(--line);
        box-shadow: none;
    }
}

/* 供给侧事实（房间数、总床位、空床、毕业生）用浅灰，不跟任何语义色抢注意力 */
.stat.tint-mute::after {
    background: var(--line-strong);
    opacity: 1;
}

@media (max-width: 899px) {
    .metric-head em {
        display: none;
    }

    /* 手机上屏幕本来就窄，灰块四周再压一层边距会把卡片挤薄 */
    .metric-group {
        padding: 12px 11px 13px;
        border-radius: var(--r);
    }
}


/* 打印时只认原表格，卡片是屏幕上的东西 */
@media print {
    .mcards,
    .msheet {
        display: none !important;
    }

    .table-wrap.is-carded {
        display: block !important;
    }
}

/* ------------------------------------------------------------
   房间与床位 → 楼栋概览卡片
   每张卡说清一栋楼的家底：多少 6人间 / 4人间 / 其它 / 功能房
   ------------------------------------------------------------ */
.bld-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 14px;
}

.bld-card {
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 14px 16px 12px;
    box-shadow: var(--sh-1);
    transition: border-color .14s, box-shadow .14s, transform .14s;
}

.bld-card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--sh-2);
    transform: translateY(-1px);
}

.bld-card.active {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 2px var(--brand-100), var(--sh-2);
}

.bld-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.bld-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.bld-rooms {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
}

.bld-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--ink-3);
}

.bld-nums {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

/* 房型格数量按实际存在的房型动态变化（1~4 个），用 flex 均分，不留空档 */
.bld-nums > .bld-num {
    flex: 1 1 0;
    min-width: 0;
}

.bld-num {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px 2px 7px;
    text-align: center;
}

.bld-num b {
    display: block;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

.bld-num span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: var(--ink-3);
    white-space: nowrap;
}

.bld-num.n6 b {
    color: var(--brand-600);
}

.bld-num.n4 b {
    color: var(--ok);
}

.bld-num.nother b {
    color: var(--warn);
}

.bld-num.nfunc b {
    color: var(--purple);
}

/* 手机端：卡片变单列，房型格按实际数量自动换行 */
@media (max-width: 640px) {
    .bld-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   手机端适配 v2（≤899px）
   ------------------------------------------------------------
   目标：一屏看清楚、信息不丢、能点得到。
   原则：
     · 顶栏只留「菜单 · 品牌 · 通知 · 头像」，其余动作收进抽屉
     · 桌面专用动作（打印 / 导出 / 批量导入）在手机上直接不出现
     · 筛选区默认收起，只露一行，需要时再展开
     · 指标卡、卡片、间距整体收紧，同样高度多装一倍内容
     · 全部规则包在媒体查询里，宽屏逐像素不变
   ============================================================ */

/* ---------------- 宽屏：账号区与「仅手机」元素不出现 ---------------- */

.nav-campus,
.nav-op,
.nav-account-title,
.filter-toggle,
.only-phone {
    display: none;
}

@media (max-width: 899px) {

    /* 桌面专用：打印、导出、批量上传这类手机上做不了的事 */
    .only-desk {
        display: none !important;
    }

    .only-phone {
        display: block;
    }

    /* ---------------- 顶栏 ---------------- */

    .topbar {
        gap: 6px;
        padding: 0 10px 0 4px;
    }

    .topbar .menu-btn {
        width: 38px;
        height: 38px;
        flex: none;
    }

    .topbar .brand {
        flex: 1 1 auto;
        gap: 8px;
        min-width: 0;
    }

    .topbar .brand .mark {
        width: 30px;
        height: 30px;
        font-size: 15px;
        border-radius: 9px;
    }

    /* 副标题（学校名 · 校区）窄屏让位给标题，校区在抽屉里切 */
    .topbar .brand-text span {
        display: none;
    }

    /* 顶栏标题整句显示：旧规则在 560 断点写死了 96px，会把
       「智慧公寓管理系统」截成「智慧公寓管理…」 */
    .topbar .brand-text {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar .brand-text strong {
        max-width: none;
        font-size: 14px;
        letter-spacing: .2px;
    }

    /* 顶栏右侧只保留：通知 + 头像 */
    .topbar .spacer {
        flex: 0 0 0;
    }

    .topbar .bell {
        padding: 0 9px;
        flex: none;
    }

    .topbar .bell .nowrap {
        display: none;
    }

    /* 头像 = 打开抽屉（账号区在抽屉底部），做成可点的小圆 */
    .topbar .who {
        padding: 3px;
        background: transparent;
        border-color: transparent;
        cursor: pointer;
        flex: none;
    }

    .topbar .who .who-text {
        display: none;
    }

    .topbar .who .avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
        background: rgba(255, 255, 255, .2);
        border: 1px solid rgba(255, 255, 255, .28);
    }

    /* ---------------- 抽屉 ---------------- */

    .sidebar {
        width: min(84vw, 320px);
        padding: 6px 10px calc(26px + env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }

    .nav-account-title {
        display: block;
        padding: 14px 11px 6px;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 1px;
        color: var(--sb-ico);
    }

    .sidebar a {
        padding: 11px 11px;
        font-size: 14px;
    }

    .sidebar a .icon {
        font-size: 17px;
    }

    /* 账号区：抽屉最底部，不参与折叠 */

    .nav-campus {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 0 6px 6px;
    }

    .nav-campus a {
        flex: 1 1 0;
        justify-content: center;
        margin: 0;
        padding: 8px 6px;
        font-size: 13px;
        border: 1px solid var(--line);
        border-radius: 9px;
        background: var(--surface-2, #F5F8FC);
    }

    .nav-campus a.is-on {
        background: var(--brand-100);
        border-color: var(--brand-300);
        color: var(--brand-800);
        font-weight: 600;
    }

    .nav-op {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 11px;
        border: 0;
        border-radius: var(--r-sm);
        background: transparent;
        color: var(--ink-2);
        font-family: inherit;
        font-size: 14px;
        text-align: left;
        cursor: pointer;
    }

    .nav-op .icon {
        font-size: 17px;
        color: var(--ink-4);
    }

    .nav-op:active {
        background: var(--brand-50);
    }

    /* ---------------- 主区域 ---------------- */

    .main {
        padding: calc(var(--header-h) + 10px) 10px calc(118px + env(safe-area-inset-bottom));
    }

    .page-head {
        gap: 6px 8px;
        margin-bottom: 12px;
    }

    .page-head h1 {
        font-size: 17px;
        gap: 7px;
    }

    .page-head h1 .icon {
        font-size: 18px;
    }

    .page-head .sub {
        font-size: 11.5px;
        line-height: 1.4;
    }

    /* 页头按钮：尽量只留主操作，并允许换行不挤压标题 */
    .page-head .btn {
        padding: 0 12px;
        height: 34px;
        font-size: 13px;
        margin-left: auto;   /* 掉到第二行时靠右，不要顶在标题下面 */
    }

    .card {
        padding: 13px;
        border-radius: 13px;
        margin-bottom: 11px;
    }

    .card > h2 {
        font-size: 14px;
        gap: 7px;
        margin-bottom: 10px;
        flex-wrap: wrap;
    }

    /* 标题栏里的按钮（筛选 / 重置 / 批量操作）缩小一号，别把标题挤掉；
       flex:none 是让它们放不下时整颗换行，而不是被压成「重置筛…」 */
    .card > h2 .btn,
    .card > h2 .tag {
        flex: 0 0 auto;
    }

    .card > h2 .btn {
        height: 30px;
        padding: 0 9px;
        font-size: 12px;
        gap: 5px;
    }

    .card > h2 .btn .icon {
        font-size: 13px;
    }

    /* 卡片内的口径说明：字号降一档，不再抢主体内容 */
    .card > .hint,
    .card > p.hint {
        font-size: 12px;
        line-height: 1.65;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .card.flush > h2 {
        padding: 13px 13px 0;
        margin-bottom: 10px;
    }

    /* ---------------- 指标卡：两列紧凑 ---------------- */

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
        margin-bottom: 11px;
    }

    /* 只有 3 个指标时排三列，不浪费半行 */
    .stats.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .stats.cols-3 .stat {
        padding: 9px 9px 10px;
    }

    .stats.cols-3 .stat .label {
        font-size: 10.5px;
    }

    .stats.cols-3 .stat .value {
        font-size: 19px;
    }

    .stat {
        padding: 9px 11px 10px;
        border-radius: 12px;
        /* 手机上把「单位/说明」和数值放同一行，整卡从三行压到两行 */
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        column-gap: 6px;
    }

    .stat:hover {
        transform: none;
        box-shadow: var(--sh-1);
    }

    .stat .label {
        grid-column: 1 / -1;
        font-size: 11px;
        gap: 4px;
        margin-bottom: 2px;
        line-height: 1.3;
    }

    .stat .label .icon {
        font-size: 12px;
    }

    .stat .value {
        grid-column: 1;
        font-size: 21px;
        letter-spacing: -.3px;
    }

    .stat .value small {
        font-size: 11px;
    }

    .stat .foot {
        grid-column: 2;
        margin: 0;
        font-size: 10.5px;
        line-height: 1.3;
        text-align: right;
    }

    /* ---------------- 筛选区：默认收起 ---------------- */

    .filter-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 5px;
        height: 28px;
        padding: 0 10px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: var(--surface);
        color: var(--ink-2);
        font-family: inherit;
        font-size: 12px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .filter-toggle .icon {
        font-size: 13px;
        color: var(--brand-600);
        transition: transform .18s ease;
    }

    .filter-card.is-folded .filter-toggle .icon {
        transform: rotate(-90deg);
    }

    .filter-card.is-folded .filter-body {
        display: none;
    }

    /* 收起时的一行摘要：当前筛选条件一目了然 */
    .filter-summary {
        display: none;
        margin-top: 2px;
        margin-bottom: 9px;
        font-size: 12px;
        color: var(--ink-3);
        line-height: 1.5;
    }

    .filter-card.is-folded .filter-summary {
        display: block;
    }

    .filter-card.is-folded > h2 {
        margin-bottom: 8px;
    }

    /* 收起后的筛选卡更扁：标题一行 + 摘要一行就够 */
    .filter-card.is-folded {
        padding-bottom: 11px;
    }

    /* 地图图例里的操作说明：手机上直接点房间就行，这句话省掉 */
    .map-legend .faint {
        display: none;
    }

    /* 筛选控件本身在窄屏更好按 */
    .toolbar {
        gap: 8px;
    }

    .toolbar .field,
    .toolbar .field.wide,
    .toolbar .field.narrow {
        flex: 1 1 46%;
        min-width: 120px;
    }

    .toolbar .field.auto {
        flex: 1 1 auto;
    }

    .toolbar .btn {
        flex: 1 1 45%;
        height: 38px;
    }

    input,
    select,
    textarea {
        font-size: 15px;   /* <16px 时 iOS 会自动放大页面，这里顶到 15 已经不会再触发 */
    }

    /* ---------------- 表格卡片：允许两行副标题 ---------------- */

    .mcards {
        gap: 8px;
        padding: 10px 11px 12px;
    }

    .card.flush .mcards {
        padding-bottom: 12px;
    }

    .mcard {
        padding: 11px 12px;
        gap: 8px;
    }

    .mcard-title {
        font-size: 14.5px;
        gap: 6px;
    }

    .mcard-sub {
        margin-top: 3px;
        font-size: 12.5px;
        line-height: 1.45;
        white-space: normal;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* ---------------- 详情面板：字大一点，长值换行 ---------------- */

    .msheet-body {
        padding: 12px 12px calc(20px + env(safe-area-inset-bottom));
    }

    .mfield {
        gap: 10px;
        padding: 9px 0;
    }

    .mfield-k {
        font-size: 13px;
        flex: 0 0 84px;
    }

    .mfield-v {
        font-size: 14px;
        text-align: left;
        word-break: break-word;
    }

    /* ---------------- 提示条：贴底，不再压住页面标题 ---------------- */

    .toast-host {
        top: auto;
        bottom: calc(84px + env(safe-area-inset-bottom));
        left: 12px;
        right: 12px;
        max-width: none;
        align-items: stretch;
    }

    .toast {
        padding: 11px 14px;
        font-size: 13.5px;
        line-height: 1.45;
        border-radius: 12px;
        text-align: center;
    }

    /* ---------------- 小宇：缩小、贴角，不压正文 ---------------- */

    #xy {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .xy-ball {
        width: 48px;
        height: 48px;
    }

    .xy-ball img {
        width: 48px;
        height: 48px;
    }
}

/* 更窄的机器：顶栏再收一格 */
@media (max-width: 400px) {
    .topbar .brand-text strong {
        font-size: 13.5px;
    }

    .stat .value {
        font-size: 20px;
    }
}

/* 平板（561–899px）：指标卡能排 3–4 列，字号也跟着回一点 */
@media (min-width: 561px) and (max-width: 899px) {
    .stats {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    }

    .stats.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .stat {
        padding: 11px 13px 12px;
    }

    .stat .label {
        font-size: 12px;
    }

    .stat .value {
        font-size: 24px;
    }

    .mcard-sub {
        font-size: 13px;
    }
}
