/*!
 * NXFRP 清爽蓝主题 · 设计系统 v2
 * 参考 idc.0qpz.com 的现代设计语言：浅色 / 8px 小圆角 / 1px 细线框 / 弥散光晕 / Inter / Lucide
 * 结构：1 令牌  2 字体  3 基础  4 弥散光  5 外壳布局  6 侧栏菜单  7 图标层  8 旧模板兼容层  9 工具类
 */

/* ============ 1. 设计令牌（浅色模式铁律） ============ */
:root {
    /* 主色：Indigo-600（仅用于按钮/链接/选中态，不做大面积填充） */
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-active: #3730a3;
    --brand-rgb: 79, 70, 229;
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;

    /* 背景层级：页面 Slate-50 / 卡片纯白 / 嵌套 Slate-50 半透明 */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: rgba(248, 250, 252, .5);
    --bg-hover: #f1f5f9;
    /* 边框：容器用 Slate-200/60，输入与次级按钮用 Slate-300，卡内分割用 Slate-100 */
    --border: rgba(226, 232, 240, .6);
    --border-strong: #cbd5e1;
    --border-soft: #f1f5f9;
    /* 文字三级：Slate-900 / Slate-600 / Slate-400 */
    --text-strong: #0f172a;
    --text-body: #475569;
    --text-muted: #94a3b8;
    --text-faint: #cbd5e1;

    /* 状态色（浅底 + 深字，禁止纯色填充） */
    --success: #059669;
    --success-rgb: 5, 150, 105;
    --success-50: #ecfdf5;
    --success-700: #047857;
    --warning: #d97706;
    --warning-rgb: 217, 119, 6;
    --warning-50: #fffbeb;
    --warning-700: #b45309;
    --danger: #e11d48;
    --danger-rgb: 225, 29, 72;
    --danger-50: #fff1f2;
    --danger-700: #be123c;
    --info: #0284c7;
    --info-rgb: 2, 132, 199;
    --info-50: #f0f9ff;
    --info-700: #0369a1;

    /* 形状：小圆角 8px */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --radius-lg: 12px;
    --radius-pill: 999px;

    /* 阴影：卡片级只用 1px 极浅影，浮层用弥散影（拒绝重投影） */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, .04);
    --shadow-btn: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow-btn-hover: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .08);
    --shadow-1: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .03);
    --shadow-2: 0 2px 6px rgba(16, 24, 40, .05), 0 10px 24px rgba(16, 24, 40, .05);
    --shadow-pop: 0 4px 12px rgba(16, 24, 40, .08), 0 16px 32px rgba(16, 24, 40, .07);
    --ring: 0 0 0 3px rgba(var(--brand-rgb), .18);

    /* 排版 */
    --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --lh: 1.625;

    /* 8pt 网格 */
    --sp-1: 8px;
    --sp-2: 16px;
    --sp-3: 24px;
    --sp-4: 32px;
    --sp-5: 48px;
    --sp-6: 64px;
    --sp-7: 80px;

    /* 布局尺寸 */
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 64px;
    --header-h: 64px;
    --content-max: 1360px;

    /* 旧模板变量兼容（插件视图引用） */
    --pe-primary: var(--brand);
    --pe-primary-rgb: var(--brand-rgb);
    --pe-bg-color: var(--bg-page);
    --pe-body-color: var(--text-body);
    --pe-white: #ffffff;
    --pe-app-sidebar-menu-item-color: #64748b;
    --pe-app-sidebar-menu-item-color-hover: var(--brand);
}

/* ============ 2. 字体 ============ */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter-latin-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter-latin-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter-latin-600.woff2') format('woff2');
}

/* ============ 3. 基础 ============ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: var(--lh);
    color: var(--text-body);
    background-color: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: var(--brand-hover);
}

small {
    font-size: 12px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-soft);
    opacity: 1;
    margin: var(--sp-3) 0;
}

code, pre {
    font-family: var(--font-mono);
    font-size: .9em;
}

::selection {
    background: rgba(var(--brand-rgb), .16);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #d3dbe6 transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-thumb {
    background: #d3dbe6;
    border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-thumb:hover {
    background: #bcc7d6;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--radius-sm);
}

/* ============ 4. 弥散光（参考站的柔光语言） ============ */
.nx-glow {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.nx-glow::before {
    content: '';
    position: absolute;
    inset: -80px;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 36% 42% at 16% 26%, rgba(var(--brand-rgb), .16), transparent 70%),
        radial-gradient(ellipse 28% 46% at 80% 64%, rgba(8, 145, 178, .13), transparent 72%),
        radial-gradient(ellipse 46% 38% at 52% 88%, rgba(var(--brand-rgb), .10), transparent 75%);
    filter: blur(30px);
}

.nx-glow > * {
    position: relative;
    z-index: 1;
}

/* ============ 5. 外壳布局 ============ */
.nx-app {
    min-height: 100vh;
}

.nx-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    /* 导航面用纯白卡片底，内容区用冷灰白 —— 全浅色一体化，同时保留清晰的层次 */
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .2s ease, transform .22s ease;
}

.nx-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
    overflow: hidden;
}

.nx-sidebar__logo img.nx-logo {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.nx-sidebar__logo .nx-brand-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text-strong);
    letter-spacing: -.01em;
    white-space: nowrap;
}

.nx-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 12px;
}

.nx-sidebar__foot {
    flex-shrink: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
}

/* 主区域 */
.nx-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .2s ease;
}

/* 顶栏：只保留品牌级操作（页面标题在内容区头部，避免重复） */
.nx-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    /* 毛玻璃是浅色模式的灵魂 */
    background: rgba(255, 255, 255, .8);
    backdrop-filter: saturate(1.8) blur(24px);
    border-bottom: 1px solid var(--border);
}

.nx-header__spacer {
    flex: 1;
}

.nx-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.nx-icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-strong);
}

.nx-icon-btn .nx-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid var(--bg-card);
}

/* 用户区 */
.nx-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 6px 4px 4px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.nx-user-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.nx-user-btn img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.nx-user-btn__meta {
    display: none;
    text-align: left;
    line-height: 1.25;
    min-width: 0;
}

.nx-user-btn__meta b {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-strong);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nx-user-btn__meta span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

@media (min-width: 1200px) {
    .nx-user-btn__meta {
        display: block;
    }
}

/* 内容区 */
/* 主内容区：常规屏幕铺满可用宽度（不产生大片空白），仅在超宽屏做上限约束并居中 */
.nx-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--sp-3);
}

.nx-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-faint);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: center;
}

/* 移动端抽屉 + 遮罩 */
.nx-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1035;
}

body.nx-sidebar-open .nx-backdrop {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1199.98px) {
    .nx-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    body.nx-sidebar-open .nx-sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-pop);
    }

    .nx-main {
        margin-left: 0;
    }

    .nx-content {
        padding: var(--sp-2);
    }
}

/* 大屏折叠 */
@media (min-width: 1200px) {
    body.nx-sidebar-collapsed .nx-sidebar {
        width: var(--sidebar-w-collapsed);
    }

    body.nx-sidebar-collapsed .nx-sidebar__logo .nx-brand-name,
    body.nx-sidebar-collapsed .nx-sidebar__foot,
    body.nx-sidebar-collapsed .pe-menu-title,
    body.nx-sidebar-collapsed .pe-nav-content,
    body.nx-sidebar-collapsed .pe-nav-sub-content,
    body.nx-sidebar-collapsed .pe-nav-arrow,
    body.nx-sidebar-collapsed .pe-nav-arrow-link {
        display: none;
    }

    body.nx-sidebar-collapsed .nx-main {
        margin-left: var(--sidebar-w-collapsed);
    }

    body.nx-sidebar-collapsed .nx-sidebar__logo {
        justify-content: center;
        padding: 0;
    }

    body.nx-sidebar-collapsed a.pe-nav-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.nx-sidebar-collapsed .pe-slide-menu {
        display: none !important;
    }
}

/* ============ 6. 侧栏菜单（兼容 SidebarMenuHelper 输出） ============ */
.pe-main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pe-menu-title {
    padding: 10px 10px 8px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.pe-slide,
.pe-slide-item {
    list-style: none;
    margin: 0 0 2px;
    padding: 0;
}

/* 菜单项：白底侧栏上用「浅灰悬停 + 品牌浅底选中」，1px 透明边框防跳动 */
a.pe-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: #64748b;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

a.pe-nav-link:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-strong);
}

a.pe-nav-link:hover .pe-nav-icon {
    color: var(--text-strong);
}

/* 当前页（全侧栏唯一）：Indigo-50 底 + Indigo-700 字 + 细边框 + 左侧指示条 */
a.pe-nav-link.is-active {
    background: var(--brand-50);
    border-color: var(--brand-100);
    color: var(--brand-hover);
    font-weight: 500;
}

a.pe-nav-link.is-active .pe-nav-icon {
    color: var(--brand);
}

a.pe-nav-link.is-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--brand);
}

/* 当前页的父级分组：只做弱提示，不与子项争抢高亮 */
a.pe-nav-link.is-section {
    color: var(--brand-hover);
}

a.pe-nav-link.is-section .pe-nav-icon {
    color: var(--brand-hover);
}

.pe-nav-icon {
    flex-shrink: 0;
    font-size: 16px;
    color: var(--text-muted);
    transition: color .15s ease;
}

.pe-nav-content,
.pe-nav-sub-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pe-nav-arrow {
    flex-shrink: 0;
    font-size: 15px;
    color: var(--text-faint);
    transition: transform .2s ease, color .15s ease;
}

.pe-nav-arrow-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    transition: background .15s ease, color .15s ease;
}

.pe-nav-arrow-link:hover {
    background: var(--bg-hover);
    color: var(--text-body);
    border-color: transparent;
}

.pe-slide.pe-has-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.pe-slide.pe-has-sub > .pe-nav-link {
    flex: 1;
    min-width: 0;
}

.pe-slide.pe-has-sub > .pe-nav-arrow-link {
    margin-right: 0;
    order: 2;
}

.pe-slide.pe-has-sub > .pe-nav-link[aria-expanded="true"] + .pe-nav-arrow-link .pe-nav-arrow,
.pe-slide.pe-has-sub > .pe-nav-arrow-link[aria-expanded="true"] .pe-nav-arrow {
    transform: rotate(180deg);
}

.pe-slide.pe-has-sub .pe-slide-menu {
    flex-basis: 100%;
}

/* 子菜单：缩进排列，无竖线（同底色上更干净） */
.pe-slide-menu {
    list-style: none;
    margin: 3px 0 6px;
    padding: 0 0 0 12px;
    position: relative;
}

.pe-slide-menu .pe-slide-item > a.pe-nav-link {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.pe-slide-menu .pe-slide-item > a.pe-nav-link:hover {
    color: var(--text-strong);
    background: var(--bg-hover);
}

.pe-slide-menu .pe-slide-item > a.pe-nav-link.is-active {
    font-weight: 500;
    background: var(--brand-50);
    border-color: var(--brand-100);
    color: var(--brand);
}

/* ============ 7. 图标层（Lucide 内联 SVG） ============ */
.nx-icon {
    display: inline-block;
    width: 1.125em;
    height: 1.125em;
    vertical-align: -.15em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nx-icon--filled {
    fill: currentColor;
    stroke: none;
}

.ri-spin {
    animation: nx-spin 1s linear infinite;
}

@keyframes nx-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 骨架屏 */
.nx-skeleton {
    position: relative;
    overflow: hidden;
    background: #eef2f7;
    border-radius: var(--radius-sm);
    color: transparent !important;
    user-select: none;
}

.nx-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
    animation: nx-shimmer 1.4s infinite;
}

@keyframes nx-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nx-skeleton::after,
    .ri-spin,
    .nx-glow::before {
        animation: none;
    }
}

/* ============ 8. 旧模板 helper 兼容层（插件视图依赖） ============ */
.bg-soft-primary {
    background-color: var(--brand-50) !important;
    color: var(--brand-hover) !important;
}

.bg-soft-info {
    background-color: var(--info-50) !important;
    color: var(--info-700) !important;
}

.bg-soft-success {
    background-color: var(--success-50) !important;
    color: var(--success-700) !important;
}

.bg-soft-warning {
    background-color: var(--warning-50) !important;
    color: var(--warning-700) !important;
}

.bg-soft-danger {
    background-color: var(--danger-50) !important;
    color: var(--danger-700) !important;
}

.bg-soft-secondary {
    background-color: #f2f4f7 !important;
    color: var(--text-muted) !important;
}

.bg-soft-dark {
    background-color: #f2f4f7 !important;
    color: var(--text-strong) !important;
}

.avatar-title {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-xs {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.avatar-md {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
}

.fs-10 { font-size: 10px !important; }
.fs-11 { font-size: 11px !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }
.fs-14 { font-size: 14px !important; }
.fs-15 { font-size: 15px !important; }
.fs-16 { font-size: 16px !important; }
.fs-18 { font-size: 18px !important; }
.fs-20 { font-size: 20px !important; }
.fs-22 { font-size: 22px !important; }
.fs-24 { font-size: 24px !important; }

.card-h-100 {
    height: 100%;
}

.main-breadcrumb {
    min-height: 32px;
    margin-bottom: var(--sp-3);
}

.breadcrumb-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
}

.rounded-2 { border-radius: var(--radius-sm) !important; }
.rounded-3 { border-radius: var(--radius) !important; }
.rounded-4 { border-radius: var(--radius-lg) !important; }

.shadow-sm {
    box-shadow: var(--shadow-1) !important;
}

.text-body-emphasis {
    color: var(--text-strong) !important;
}

/* ============ 9. 工具类 ============ */
/* 数字排版：等宽衬线数（tabular-nums）+ 等宽字体，浅色模式下数据不显乱 */
.nx-num {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.nx-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nx-text-strong { color: var(--text-strong) !important; }
.nx-text-muted { color: var(--text-muted) !important; }
.nx-mono { font-family: var(--font-mono); }

.nx-divider {
    height: 1px;
    background: var(--border-soft);
    border: 0;
    margin: var(--sp-2) 0;
}

.nx-hover-lift {
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.nx-hover-lift:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}