/* ========================================================================
 * 后台管理框架样式 - 绿黑色主题
 * 主色：#009688（青绿），深色：#1a3a32 / #0f2823
 * ======================================================================== */

:root {
    /* 品牌色 - 绿黑色系 */
    --color-primary: #009688;
    --color-primary-hover: #00ad9c;
    --color-primary-active: #007d72;
    --color-primary-light: #e0f5f2;
    --color-primary-lighter: #f0faf8;

    /* 深绿黑层次（侧边栏 / Logo） */
    --color-dark-1: #1a3a32;
    --color-dark-2: #142e28;
    --color-dark-3: #0f2823;
    --color-dark-4: #0a1d19;

    /* 中性色 */
    --color-text: #1f2329;
    --color-text-secondary: #4e5969;
    --color-text-tertiary: #86909c;
    --color-text-disabled: #c9cdd4;

    --color-border: #e5e6eb;
    --color-border-light: #f2f3f5;
    --color-bg: #ffffff;
    --color-bg-page: #f4f7f6;

    /* 状态色 */
    --color-danger: #e54d42;
    --color-danger-hover: #f5655a;
    --color-warning: #ff9500;
    --color-info: #8e8e93;

    /* 尺寸 */
    --header-height: 60px;
    --side-width: 230px;
    --side-collapsed-width: 64px;
    --footer-height: 48px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px 0 rgba(26, 58, 50, 0.08);
    --shadow-lg: 0 6px 16px -8px rgba(26, 58, 50, 0.18), 0 9px 28px 0 rgba(26, 58, 50, 0.08);

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
}

/* ============================ 基础重置 ============================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg-page);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-hover);
}

/* ============================ 框架整体 ============================ */
.layui-layout-admin {
    position: relative;
    min-height: 100%;
    background: var(--color-bg-page);
}

/* ============================ 头部 ============================ */
.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: 0 1px 4px rgba(26, 58, 50, 0.06);
    z-index: 1000;
}

.admin-header-inner {
    display: flex;
    align-items: stretch;
    height: var(--header-height);
}

/* Logo 区 - 绿黑色块 */
.admin-header-logo {
    display: flex;
    align-items: center;
    min-width: var(--side-width);
    height: var(--header-height);
    padding: 0 20px;
    background: linear-gradient(135deg, var(--color-dark-1) 0%, var(--color-dark-3) 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    border-right: 1px solid rgba(0, 150, 136, 0.15);
}

.admin-header-logo:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--color-dark-2) 0%, var(--color-dark-4) 100%);
}

.admin-header-logo .logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    background: var(--color-primary);
    border-radius: 6px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 150, 136, 0.4);
}

.layui-layout-admin.admin-side-collapsed .admin-header-logo {
    min-width: var(--side-collapsed-width);
    padding: 0;
    justify-content: center;
}

.layui-layout-admin.admin-side-collapsed .admin-header-logo .logo-text-block {
    display: none;
}

.layui-layout-admin.admin-side-collapsed .admin-header-logo .logo-mark {
    margin-right: 0;
}

/* ============================ 折叠切换按钮（全新名称 fold-trigger） ============================ */
/* 完全自包含样式，独立命名避免与历史 .admin-side-toggle 规则冲突 */

.fold-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    outline: none;
    user-select: none;
    box-shadow: none;
    transition: background-color 0.22s ease, color 0.22s ease;
    vertical-align: middle;
}

.fold-trigger:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.fold-trigger:active {
    background-color: rgba(255, 255, 255, 0.28);
}

/* 箭头图标容器 */
.fold-trigger .fold-arrow {
    position: relative;
    display: block;
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 默认（菜单展开）：箭头 ◀ 朝左 — 提示"点击收起" */
.fold-trigger .fold-arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-top: 2.4px solid currentColor;
    border-right: 2.4px solid currentColor;
    transform: translate(-30%, -50%) rotate(225deg);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.22s ease;
}

/* 折叠态（侧栏已收起）：箭头旋转 180°，▶ 朝右 — 提示"点击展开" */
.layui-layout-admin.admin-side-collapsed .fold-trigger .fold-arrow::before {
    transform: translate(-70%, -50%) rotate(45deg);
}

/* hover 时箭头变纯白 */
.fold-trigger:hover .fold-arrow::before {
    border-color: #fff;
}


/* ============================ 头部右侧 — 三段式布局（完全重写） ============================ */
/*
   布局结构：
   ┌─admin-header-right─────────────────────────────────────┐
   │ ┌─hr-zone-left─┐         ┌─hr-zone-right─────────────┐ │
   │ │ [◀ 折叠按钮]  │         │ [🔄🗑⛶🔔] | [👤 用户]    │ │
   │ └──────────────┘         └───────────────────────────┘ │
   └────────────────────────────────────────────────────────┘
   第一部分：折叠按钮，靠最左
   第二部分：刷新/缓存/全屏/消息，靠右（最右分区内左侧）
   第三部分：用户菜单，最右
*/

.admin-header-right {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

/* ================== 第一区：折叠按钮（靠最左） ================== */
.hr-zone-left {
    display: flex;
    align-items: center;
    padding: 0 6px 0 14px;
    flex: 0 0 auto;
}

/* Tab 操作组容器（与折叠按钮之间一道细分隔线，视觉分组） */
.hr-tabs-ops {
    display: flex;
    align-items: center;
    padding-left: 6px;
    margin-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
}

/* Tab 操作按钮（复用 .hr-tools-item 风格，绿底白色） */
.hr-tabs-ops .tab-op {
    /* 与普通工具按钮一致，不需额外样式 */
}

/* ================== 第二、三区的容器（靠最右） ================== */
.hr-zone-right {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    justify-content: flex-end;
}

/* ================== 第二区：工具栏组（4个图标） ================== */
.hr-tools {
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex: 0 0 auto;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.hr-tools-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 2px;
    border: none;
    border-radius: 10px;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    outline: none;
    position: relative;
    transition: background-color 0.22s ease, color 0.22s ease;
}

.hr-tools-item:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hr-tools-item:active {
    background-color: rgba(255, 255, 255, 0.28);
}

.hr-tools-item .layui-icon {
    font-size: 17px;
}

.hr-tools-item .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    line-height: 16px;
    font-size: 11px;
    background: #ff5252;
    color: #fff;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* ================== 第三区：用户菜单（最右） ================== */
.hr-user {
    position: relative;            /* 关键：作为下拉菜单的定位锚点 */
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    align-self: center;
    height: 44px;
    padding: 0 14px 0 6px;
    margin: auto 0;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.22s ease;
}

.hr-user:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

/* 全屏切换按钮 — 用纯 CSS 绘制的"四角括号"图标（不依赖 layui 字体，避免显示异常） */
#btnFullscreen .layui-icon {
    /* 隐藏字体图标，统一用 CSS 自绘图标 */
    display: none;
}

#btnFullscreen .fullscreen-icon {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    color: currentColor;
    transition: transform 0.25s ease;
}

/* 四角括号：四个伪元素分别画四个角的直角 */
.fullscreen-icon::before,
.fullscreen-icon::after,
.fullscreen-icon > i,
.fullscreen-icon > span {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border: 1.8px solid currentColor;
    box-sizing: border-box;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 默认（未全屏）：四角的直角在容器最外侧，提示"点击放大" */
.fullscreen-icon::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.fullscreen-icon::after {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.fullscreen-icon > i {
    bottom: 0;
    left: 0;
    border-top: none;
    border-right: none;
    font-style: normal;
}

.fullscreen-icon > span {
    bottom: 0;
    right: 0;
    border-top: none;
    border-left: none;
}

/* 已全屏（is-restore）：四角的直角向中心收缩 3px，提示"点击缩小" */
.fullscreen-icon.fs-state-restore::before {
    top: 3px;
    left: 3px;
    border: 1.8px solid currentColor;
    border-right: none;
    border-bottom: none;
}

.fullscreen-icon.fs-state-restore::after {
    top: 3px;
    right: 3px;
    border: 1.8px solid currentColor;
    border-left: none;
    border-bottom: none;
}

.fullscreen-icon.fs-state-restore > i {
    bottom: 3px;
    left: 3px;
    border: 1.8px solid currentColor;
    border-top: none;
    border-right: none;
}

.fullscreen-icon.fs-state-restore > span {
    bottom: 3px;
    right: 3px;
    border: 1.8px solid currentColor;
    border-top: none;
    border-left: none;
}

/* 用户菜单（第三区：最右） */
.hr-user {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 14px 0 6px;
    border-radius: 22px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hr-user:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hr-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.hr-user:hover img {
    border-color: #fff;
    transform: scale(1.05);
}

.hr-user .user-name {
    font-style: normal;
    font-size: 14px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    letter-spacing: 0.2px;
}

.hr-user .user-arrow {
    margin-left: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    transition: transform 0.2s ease, color 0.2s ease;
}

.hr-user.active .user-arrow {
    transform: rotate(180deg);
}

/* 用户下拉菜单 */
/* ============================ 用户下拉菜单 ============================ */
/*
   关键：下拉菜单作为 .admin-header 的直接子节点（避免被 admin-header-right 的 overflow:hidden 裁剪）。
   - position: fixed：脱离所有父容器 overflow 的限制
   - 位置与宽度由 JS 在展开时根据 .hr-user 的 getBoundingClientRect 动态设置（top/left/width）
   - z-index 高于 header (1000)，确保在所有内容之上
*/
.admin-header-user-menu {
    position: fixed;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    display: none;
    overflow: hidden;
}

.admin-header-user-menu.show {
    display: block;
    animation: dropIn 0.18s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-header-user-menu .menu-header {
    padding: 16px 18px;           /* 与 .hr-user padding 协调 */
    background: linear-gradient(135deg, var(--color-dark-1) 0%, var(--color-dark-3) 100%);
    color: #fff;
    text-align: left;
}

.admin-header-user-menu .menu-header .mh-name {
    font-size: 14px;
    font-weight: 500;
}

.admin-header-user-menu .menu-header .mh-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.admin-header-user-menu dd {
    list-style: none;
    line-height: 40px;
    margin: 0;
    padding: 0;
}

.admin-header-user-menu dd a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--color-text);
    font-size: 14px;
    transition: all 0.2s ease;
}

.admin-header-user-menu dd a:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.admin-header-user-menu dd a .layui-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 18px;
    text-align: center;
    color: var(--color-text-tertiary);
    transition: color 0.2s ease;
}

.admin-header-user-menu dd a:hover .layui-icon {
    color: var(--color-primary);
}

.admin-header-user-menu dd.divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 6px 0;
    line-height: 0;
    padding: 0;
}

.admin-header-user-menu dd.danger a {
    color: var(--color-danger);
}

.admin-header-user-menu dd.danger a .layui-icon {
    color: var(--color-danger);
}

.admin-header-user-menu dd.danger a:hover {
    background: #fff1f0;
    color: var(--color-danger-hover);
}

.admin-header-user-menu dd.danger a:hover .layui-icon {
    color: var(--color-danger-hover);
}

/* ============================ 左侧菜单 ============================ */
.admin-side {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--side-width);
    background: linear-gradient(180deg, var(--color-dark-1) 0%, var(--color-dark-3) 100%);
    transition: width 0.3s ease;
    z-index: 999;
    overflow: hidden;
    border-right: 1px solid rgba(0, 150, 136, 0.1);
}

.admin-side::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(0, 150, 136, 0.25), transparent);
    pointer-events: none;
}

.admin-side-scroll {
    width: var(--side-width);
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
}

/* 滚动条美化 */
.admin-side-scroll::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.admin-side-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 150, 136, 0.18);
    border-radius: 3px;
}

.admin-side-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 150, 136, 0.35);
}

.admin-side-scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* 导航树 */
.admin-nav-tree {
    width: 100%;
    background: transparent;
    padding: 10px 0;
}

/* ============================ 一级菜单（完全重写）======================== */
.admin-nav-tree {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    background: transparent;
}

/* li 行 */
.admin-nav-tree > li {
    position: relative;
    margin: 2px 12px;
}

/* 一级菜单的 a 行 */
.admin-nav-tree > li > a.nav-link {
    display: flex;                       /* flex 让 [icon] [cite] [arrow] 横向排列 */
    align-items: center;                 /* 关键：所有子元素在同一基线垂直居中 */
    justify-content: flex-start;
    height: 46px;
    padding: 0 16px !important;
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 14px;
    line-height: 46px;                   /* 文字行高=容器高度，文字天然垂直居中 */
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* hover */
.admin-nav-tree > li > a.nav-link:hover {
    background: rgba(0, 150, 136, 0.18) !important;
    color: #fff !important;
}

/* 图标 */
.admin-nav-tree > li > a.nav-link > .iconfont {
    flex-shrink: 0;                      /* 不被压缩 */
    width: 18px;                          /* 固定宽度，让 cite 起点一致 */
    height: 46px;                         /* 与 a 行同高，flex align-items:center 完美居中 */
    line-height: 46px;                    /* 行高=容器高，iconfont 文字图标天然垂直居中 */
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.25s ease;
    align-self: center;                   /* 双保险：flex 自身也居中 */
    vertical-align: middle;              /* 对内联基线也对齐 */
}

.admin-nav-tree > li > a.nav-link:hover > .iconfont {
    color: var(--color-primary-hover);
}

/* 标题文字 cite */
.admin-nav-tree > li > a.nav-link > cite {
    flex: 1;                              /* 撑开剩余空间 */
    font-style: normal;
    font-size: 14px;
    line-height: 46px;                    /* 关键：行高与 a 容器一致，文字天然垂直居中 */
    height: 46px;                         /* 显式高度 + flex center 双重保险 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;                       /* block 元素高度生效 */
    align-self: center;
}

/* 折叠箭头（用 layui-icon 字体图标，几何完全可控） */
.admin-nav-tree > li > a.nav-link > .nav-arrow {
    flex-shrink: 0;                       /* 不被压缩 */
    width: 16px;
    height: 46px;                         /* 与 a 行同高，flex center 居中 */
    line-height: 46px;                    /* 行高=高度 → 文字图标完美居中 */
    margin-left: 12px;
    font-size: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.25s ease, color 0.25s ease;
    align-self: center;
}

/* hover 时箭头变白 */
.admin-nav-tree > li > a.nav-link:hover > .nav-arrow {
    color: #fff;
}

/* 展开状态：箭头旋转 180° */
.admin-nav-tree > li.is-spread > a.nav-link > .nav-arrow {
    transform: rotate(180deg);
    color: #fff;
}

/* 当前激活 / 展开 */
.admin-nav-tree > li.is-active > a.nav-link,
.admin-nav-tree > li.is-spread > a.nav-link {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 150, 136, 0.3);
    border-color: rgba(255, 255, 255, 0.08);
}

/* 激活 / 展开态：图标和文字颜色变白（保持居中对齐）*/
.admin-nav-tree > li.is-active > a.nav-link > .iconfont,
.admin-nav-tree > li.is-spread > a.nav-link > .iconfont {
    color: #fff;
}

/* ============================ 子菜单（重写联动：CSS Grid 0fr→1fr 完美动画）========================
   设计原则：
     1. 彻底脱离 .layui-nav-child 类名，避免与 layui 框架全局规则冲突
     2. 使用外层 .admin-submenu-wrap（grid 容器）+ 内层 .admin-submenu
     3. grid-template-rows: 0fr → 1fr 配合 overflow:hidden，完美支持高度动画
     4. 内层必须 min-height: 0 才能真正坍缩高度
*/
.admin-nav-tree .admin-submenu-wrap {
    display: grid;                         /* grid 容器 */
    grid-template-rows: 0fr;               /* 默认 0 行高 → 子项高度坍缩 */
    margin: 0 12px 0 24px;
    border-left: 1px dashed rgba(0, 150, 136, 0.25);
    overflow: hidden;
    transition: grid-template-rows 0.32s ease,
                margin-top 0.32s ease,
                margin-bottom 0.32s ease,
                border-color 0.25s ease,
                opacity 0.25s ease;
    opacity: 0;
}

.admin-nav-tree li.is-spread > .admin-submenu-wrap {
    grid-template-rows: 1fr;               /* 展开：1fr 占满 */
    margin-top: 4px;
    margin-bottom: 4px;
    border-left-color: rgba(0, 150, 136, 0.5);
    opacity: 1;
}

.admin-nav-tree .admin-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;                         /* grid 子项坍缩必要条件 */
    overflow: hidden;
}

/* 子菜单 li */
.admin-nav-tree .admin-submenu > li {
    position: relative;
    margin: 0;
    list-style: none;
}

/* 子菜单 a 行 */
.admin-nav-tree .admin-submenu > li > a.nav-link {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 16px 0 22px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 13px;
    line-height: 40px;                    /* 行高=容器高，文字天然居中 */
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* 子菜单装饰小圆点 */
.admin-nav-tree .admin-submenu > li > a.nav-link::before {
    content: "";
    flex-shrink: 0;
    width: 4px;
    height: 4px;
    margin-right: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    transition: all 0.25s ease;
    align-self: center;                   /* 圆点垂直居中 */
}

.admin-nav-tree .admin-submenu > li > a.nav-link:hover {
    color: #fff !important;
    background: rgba(0, 150, 136, 0.15) !important;
}

.admin-nav-tree .admin-submenu > li > a.nav-link:hover::before {
    background: var(--color-primary-hover);
    transform: scale(1.6);
    box-shadow: 0 0 6px var(--color-primary-hover);
}

/* 子菜单 icon */
.admin-nav-tree .admin-submenu > li > a.nav-link > .iconfont {
    flex-shrink: 0;
    width: 14px;
    height: 40px;                         /* 与 a 行同高，flex center 居中 */
    line-height: 40px;                    /* 行高=高度 */
    margin-right: 8px;
    font-size: 13px;
    text-align: center;
    color: inherit;
    align-self: center;
    vertical-align: middle;
}

/* 子菜单 cite */
.admin-nav-tree .admin-submenu > li > a.nav-link > cite {
    flex: 1;
    font-style: normal;
    line-height: 40px;                    /* 与 a 行同高，文字天然居中 */
    height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    align-self: center;
}

/* 子菜单箭头 */
.admin-nav-tree .admin-submenu > li > a.nav-link > .nav-arrow {
    flex-shrink: 0;
    width: 12px;
    height: 40px;                         /* 与 a 行同高 */
    line-height: 40px;
    margin-left: 8px;
    font-size: 12px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.25s ease;
    align-self: center;
}

.admin-nav-tree .admin-submenu > li.is-spread > a.nav-link > .nav-arrow {
    transform: rotate(180deg);
    color: #fff;
}

/* 子菜单激活 */
.admin-nav-tree .admin-submenu > li.is-active > a.nav-link {
    color: #fff !important;
    background: rgba(0, 150, 136, 0.28) !important;
}

.admin-nav-tree .admin-submenu > li.is-active > a.nav-link::before {
    background: var(--color-primary);
    width: 14px;
    border-radius: 2px;
    box-shadow: 0 0 6px var(--color-primary);
}

/* ============================ 三级菜单 ============================ */
.admin-nav-tree .admin-submenu .admin-submenu-wrap {
    margin-left: 12px;
}

.admin-nav-tree .admin-submenu .admin-submenu > li > a.nav-link {
    padding-left: 22px !important;
    font-size: 12.5px;
}

/* ============================ 折叠状态（侧栏收起时）======================== */
.layui-layout-admin.admin-side-collapsed .admin-side {
    width: var(--side-collapsed-width);
}

.layui-layout-admin.admin-side-collapsed .admin-side-scroll {
    width: var(--side-collapsed-width);
}

.layui-layout-admin.admin-side-collapsed .admin-nav-tree > li {
    margin: 2px 6px;
}

.layui-layout-admin.admin-side-collapsed .admin-nav-tree > li > a.nav-link > cite,
.layui-layout-admin.admin-side-collapsed .admin-nav-tree > li > a.nav-link > .nav-arrow {
    display: none;
}

.layui-layout-admin.admin-side-collapsed .admin-nav-tree > li > a.nav-link {
    padding: 0 !important;
    justify-content: center;
}

.layui-layout-admin.admin-side-collapsed .admin-nav-tree > li > a.nav-link > .iconfont {
    margin-right: 0;
    font-size: 18px;
    width: 20px;
    height: 20px;
    line-height: 20px;
}

.layui-layout-admin.admin-side-collapsed .admin-nav-tree .admin-submenu-wrap {
    /* 折叠态强制隐藏——grid 0fr + opacity 0 */
    grid-template-rows: 0fr !important;
    opacity: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-left-color: transparent !important;
}

/* ============================ 主体内容 ============================ */
.admin-body {
    position: fixed;
    top: var(--header-height);
    left: var(--side-width);
    right: 0;
    bottom: var(--footer-height);
    background: #f0f2f5;
    overflow: hidden;
    transition: left 0.3s ease;
}

.layui-layout-admin.admin-side-collapsed .admin-body {
    left: var(--side-collapsed-width);
}

/* Tab 区域 */
.admin-tabs {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Tab 标题栏 */
.admin-tabs-header {
    position: relative;
    height: 42px;
    background: #fff;
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: 0 1px 2px rgba(26, 58, 50, 0.04);
    display: flex;
    align-items: stretch;
}

.admin-tabs-title {
    flex: 1;
    height: 42px;
    overflow: hidden;
    position: relative;
}

.admin-tabs-title-inner {
    position: relative;
    height: 42px;
    padding-right: 120px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.admin-tabs-title-inner::-webkit-scrollbar {
    display: none;
}

.admin-tab-item {
    position: relative;
    display: inline-flex;
    align-items: center;                 /* flex 主轴垂直居中（外层兜底）*/
    height: 42px;
    padding: 0 36px 0 16px;              /* 右侧给 close 留空间 */
    margin-right: 1px;
    background: transparent;
    border-right: 1px solid var(--color-border-light);
    font-size: 13px;
    line-height: 42px;                   /* 文字天然垂直居中 */
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    max-width: 200px;
    overflow: hidden;
    vertical-align: middle;
}

.admin-tab-item .tab-icon {
    flex-shrink: 0;
    width: 16px;                         /* 固定宽度让 text 起点稳定 */
    height: 42px;                        /* 与容器同高，flex center 完美居中 */
    line-height: 42px;                   /* 行高=高度 → 字体图标天然居中 */
    margin-right: 6px;
    font-size: 13px;
    text-align: center;
    align-self: center;                 /* 双保险：自身也居中 */
    vertical-align: middle;
}

.admin-tab-item .tab-text {
    flex: 1;
    min-width: 0;                        /* flex 子项省略号生效 */
    height: 42px;                        /* 与容器同高 */
    line-height: 42px;                   /* 行高=高度 → 文字天然居中 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;                      /* block 元素高度生效 */
    align-self: center;
}

/* 关闭图标：从绝对定位改为 flex 子项（彻底解决"看上去没居中"）*/
.admin-tab-item .tab-close {
    position: absolute;                  /* 保留绝对定位避免影响 text 宽度 */
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    line-height: 18px;                   /* 行高=高度 → 关闭图标天然居中 */
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    color: var(--color-text-tertiary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;                       /* 兜底：flex 居中 */
    align-items: center;
    justify-content: center;
}

.admin-tab-item .tab-close:hover {
    color: #fff;
    background: var(--color-danger);
}

.admin-tab-item:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.admin-tab-item.active {
    background: #fff;
    color: var(--color-primary);
    font-weight: 500;
}

.admin-tab-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}

.admin-tab-item.active .tab-close {
    color: var(--color-text-tertiary);
}

.admin-tab-item.home .tab-close {
    display: none;
}

/* Tab 操作按钮 */
.admin-tabs-control {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--color-border-light);
    background: #fff;
    flex-shrink: 0;
}

.admin-tabs-control-item {
    width: 38px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-right: 1px solid var(--color-border-light);
}

.admin-tabs-control-item:last-child {
    border-right: 0;
}

.admin-tabs-control-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.admin-tabs-control-item .layui-icon {
    font-size: 15px;
}

/* Tab 内容区 */
.admin-tabs-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f0f2f5;
    padding: 12px;
}

.admin-tabs-content iframe {
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    display: none;
}

.admin-tabs-content iframe.active {
    display: block;
}

/* 右键菜单 */
.admin-tab-contextmenu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px 0;
    min-width: 150px;
    z-index: 9999;
    display: none;
    overflow: hidden;
}

.admin-tab-contextmenu.show {
    display: block;
    animation: dropIn 0.16s ease;
}

.admin-tab-contextmenu dd {
    list-style: none;
    margin: 0;
    padding: 0 16px;
    line-height: 34px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
}

.admin-tab-contextmenu dd .layui-icon {
    margin-right: 8px;
    font-size: 14px;
    color: var(--color-text-tertiary);
}

.admin-tab-contextmenu dd:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.admin-tab-contextmenu dd:hover .layui-icon {
    color: var(--color-primary);
}

.admin-tab-contextmenu dd.danger {
    color: var(--color-danger);
}

.admin-tab-contextmenu dd.danger .layui-icon {
    color: var(--color-danger);
}

.admin-tab-contextmenu dd.danger:hover {
    background: #fff1f0;
    color: var(--color-danger-hover);
}

.admin-tab-contextmenu dd.danger:hover .layui-icon {
    color: var(--color-danger-hover);
}

/* ============================ 底部 ============================ */
.admin-footer {
    position: fixed;
    bottom: 0;
    left: var(--side-width);
    right: 0;
    height: var(--footer-height);
    line-height: var(--footer-height);
    background: #fff;
    border-top: 1px solid var(--color-border-light);
    color: var(--color-text-tertiary);
    font-size: 13px;
    text-align: center;
    transition: left 0.3s ease;
}

.layui-layout-admin.admin-side-collapsed .admin-footer {
    left: var(--side-collapsed-width);
}

.admin-footer .footer-divider {
    margin: 0 8px;
    color: var(--color-border);
}

.admin-footer a {
    color: var(--color-primary);
    margin: 0 4px;
}

.admin-footer a:hover {
    color: var(--color-primary-hover);
}

/* ============================ 按钮覆盖 ============================ */
.layui-btn,
.layui-btn-primary {
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 13px;
    height: 34px;
    line-height: 34px;
    padding: 0 18px;
}

.layui-btn.layui-btn-sm {
    height: 28px;
    line-height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

.layui-btn.layui-btn-lg {
    height: 40px;
    line-height: 40px;
    padding: 0 22px;
    font-size: 14px;
}

.layui-btn.layui-btn-normal,
.layui-btn-primary.layui-btn-normal {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.layui-btn.layui-btn-normal:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.layui-btn-success {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.layui-btn-success:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.layui-btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.layui-btn-danger:hover {
    background: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
}

.layui-btn-warm {
    background: var(--color-warning);
    border-color: var(--color-warning);
}

.layui-btn-primary {
    color: var(--color-text-secondary);
    border-color: var(--color-border);
    background: #fff;
}

.layui-btn-primary:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-lighter);
}

/* ============================ 表单元素覆盖 ============================ */
.layui-input,
.layui-textarea,
.layui-select {
    border-radius: var(--radius-md);
    border-color: var(--color-border);
    transition: all 0.2s ease;
}

.layui-input:focus,
.layui-textarea:focus,
.layui-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 150, 136, 0.12);
}

/* ============================ 卡片 ============================ */
.layui-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.layui-card:hover {
    box-shadow: var(--shadow-md);
}

.layui-card-header {
    border-bottom: 1px solid var(--color-border-light);
    padding: 14px 20px;
    font-weight: 500;
}

.layui-card-body {
    padding: 20px;
}

/* ============================ 响应式 ============================ */
@media screen and (max-width: 992px) {
    .admin-side {
        transform: translateX(-100%);
        width: var(--side-width);
    }

    .admin-side-scroll {
        width: var(--side-width);
    }

    .admin-body,
    .admin-footer {
        left: 0;
    }

    .layui-layout-admin.admin-side-open .admin-side {
        transform: translateX(0);
    }

    .layui-layout-admin.admin-side-open .admin-mask {
        display: block;
    }
}

@media screen and (max-width: 768px) {
    .admin-header-logo .logo-text-block {
        display: none;
    }

    .hr-tools {
        display: none;
    }

    .hr-user .user-name {
        display: none;
    }
}

/* 移动端遮罩 */
.admin-mask {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 40, 35, 0.5);
    z-index: 998;
    display: none;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
