/* ============================================================
   智慧公寓管理系统 · 北京财贸职业学院
   设计系统 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;
    --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-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;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 6px 18px rgba(12, 58, 102, .18);
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    min-width: 0;
}

.topbar .brand:hover {
    color: #fff;
}

.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;
    font-size: 17px;
    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;
}

.topbar .spacer {
    flex: 1;
    min-width: 0;
}

.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: 10px 10px 40px;
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.4, 0, .2, 1);
    z-index: 25;
}

.sidebar.open {
    transform: translateX(0);
    box-shadow: var(--sh-3);
}

.sidebar .group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ink-4);
    padding: 16px 11px 7px;
    letter-spacing: 1.1px;
}

.sidebar .group::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.sidebar a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 13.5px;
    margin-bottom: 1px;
    transition: background .14s, color .14s;
}

.sidebar a .icon {
    font-size: 16px;
    color: var(--ink-4);
    transition: color .14s;
}

.sidebar a:hover {
    background: var(--brand-50);
    color: var(--brand-700);
}

.sidebar a:hover .icon {
    color: var(--brand-500);
}

.sidebar a.is-active {
    background: var(--brand-100);
    color: var(--brand-800);
    font-weight: 600;
}

.sidebar a.is-active .icon {
    color: var(--brand-600);
}

.sidebar a.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--brand-600);
}

.sidebar a.danger {
    color: var(--danger);
}

.sidebar a.danger .icon {
    color: var(--danger);
}

.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;
}

.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;
}

.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);
}

/* ============================================================
   表单
   ============================================================ */

.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;
}

/* 「窄屏已折叠」提示：默认不显示 */
.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);
}

@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-rate {
    font-size: 12px;
    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 .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;
}

.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-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;
}

/* ============================================================
   楼宇数据中枢：8 张指标卡固定 4 列 2 行（2026-10-19）
   auto-fill 在 1440 宽会铺成 6 列，8 张卡排成 6+2，
   第二行只剩两张、右侧一大片空白，所以这里按数量定列
   ============================================================ */
.stats-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 760px) {
    .stats-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* 卡片从 170px 拉到 240px+ 后，25px 的数字显得单薄，放大一档 */
    .stats-4 .stat .value {
        font-size: 28px;
    }
}

/* 打印时只认原表格，卡片是屏幕上的东西 */
@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;
    }
}
