/* ERP 风格布局样式（浅色主题） */

:root {
    --erp-primary: #003399;
    --erp-primary-dark: #002a7d;
    --erp-sidebar-width: 100px;
    --erp-topbar-height: 56px;
    --erp-bg: #f5f6f8;
    --erp-border: #e6e8eb;
    --erp-text: #1f2937;
    --erp-sidebar-bg: #0063b3;
}

body {
    background-color: var(--erp-bg);
    color: var(--erp-text);
    font-size: 0.925rem;
}

/* 左侧边栏 */
.erp-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--erp-sidebar-width);
    background: var(--erp-sidebar-bg);
    border-right: 1px solid var(--erp-sidebar-bg);
    /* 二级导航需向侧边栏右侧展开，因此不能裁剪溢出内容 */
    overflow: visible;
    z-index: 1030;
}

.erp-brand {
    height: var(--erp-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

.erp-brand a {
    color: inherit;
    text-decoration: none;
}

/* 导航项：单行文字，高亮铺满侧边栏宽度 */
.erp-sidebar .nav-link {
    display: block;
    color: #fff;
    /* 左侧留白在 0.3rem 基础上再加 10px，文字与侧边栏左边缘拉开距离 */
    padding: 0.45rem 0.3rem 0.45rem calc(0.3rem + 10px);
    margin: 0.25rem 0;
    border-radius: 0;
    font-size: 0.8rem;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

.erp-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* 高亮：深蓝背景 + 白色文字 */
.erp-sidebar .nav-link.active {
    background: var(--erp-primary);
    color: #fff;
}

/* 二级导航：向侧边栏右侧展开的悬浮面板 */
.erp-sidebar .nav-item {
    position: relative;
}

.erp-caret {
    display: inline-block;
    margin-left: 0.15rem;
    font-size: 0.6rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.erp-nav-toggle[aria-expanded="true"] .erp-caret {
    transform: rotate(90deg);
}

.erp-subnav-panel {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 9rem;
    background: var(--erp-sidebar-bg);
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1040;
}

.erp-subnav {
    margin: 0.25rem 0;
}

.erp-subnav .nav-link {
    display: block;
    margin: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    text-align: left;
    white-space: nowrap;
    color: #fff;
}

.erp-subnav .nav-link.active {
    background: var(--erp-primary);
    color: #fff;
    font-weight: 600;
}

/* 顶部栏 */
.erp-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--erp-sidebar-width);
    height: var(--erp-topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
    z-index: 1020;
}

/* 顶部栏面包屑 */
.erp-topbar .breadcrumb {
    --bs-breadcrumb-divider: "›";
    --bs-breadcrumb-item-padding-x: 0.45rem;
    flex-wrap: nowrap;
    min-width: 0;
    margin-bottom: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow: hidden;
}

.erp-topbar .breadcrumb-item {
    white-space: nowrap;
}

.erp-topbar .breadcrumb-item a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease;
}

.erp-topbar .breadcrumb-item a:hover {
    color: var(--erp-primary);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.erp-topbar .breadcrumb-item + .breadcrumb-item::before {
    color: #b6bec9;
}

.erp-topbar .breadcrumb-item.active {
    color: var(--erp-text);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--erp-primary);
    color: #fff;
    font-size: 0.75rem;
}

/* 内容区 */
.erp-main {
    margin-left: var(--erp-sidebar-width);
    padding: calc(var(--erp-topbar-height) + 1.25rem) 1.25rem 1.5rem;
}

.erp-main .card {
    border-color: var(--erp-border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* 页面标题区：白底卡片 */
.page-header {
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4,
.page-header h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--erp-text);
}

.page-header h1 i,
.page-header h2 i,
.page-header h3 i,
.page-header h4 i,
.page-header h5 i {
    color: var(--erp-primary);
}

/* 内容卡片：统一的白色面板 */
.erp-card {
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.erp-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-card .card-title i {
    color: var(--erp-primary);
}

/* 卡片内表格：浅色表头、细分隔线、悬停高亮 */
.erp-card .table {
    --bs-table-border-color: #eef0f3;
    margin-bottom: 0;
}

.erp-card .table > thead th {
    background: #f7f9fc;
    color: #4b5563;
    font-weight: 600;
    border-bottom: 1px solid var(--erp-border);
    white-space: nowrap;
}

.erp-card .table-hover > tbody > tr:hover > * {
    background-color: #f6f9ff;
}

.erp-card .table td .form-control,
.erp-card .table td .form-select {
    font-size: 0.85rem;
}

/* 分页主色统一为中建蓝 */
.erp-card .pagination {
    --bs-pagination-color: var(--erp-primary);
    --bs-pagination-hover-color: var(--erp-primary-dark);
    --bs-pagination-active-bg: var(--erp-primary);
    --bs-pagination-active-border-color: var(--erp-primary);
    --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(0, 51, 153, 0.12);
    font-size: 0.82rem;
}

/* 卡片头部：标题与操作按钮之间的分隔线 */
.erp-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.65rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--erp-primary);
}

/* 主色覆盖为中建蓝 */
.btn-primary {
    --bs-btn-bg: var(--erp-primary);
    --bs-btn-border-color: var(--erp-primary);
    --bs-btn-hover-bg: var(--erp-primary-dark);
    --bs-btn-hover-border-color: var(--erp-primary-dark);
    --bs-btn-active-bg: var(--erp-primary-dark);
    --bs-btn-active-border-color: var(--erp-primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--erp-primary);
    --bs-btn-border-color: var(--erp-primary);
    --bs-btn-hover-bg: var(--erp-primary);
    --bs-btn-hover-border-color: var(--erp-primary);
    --bs-btn-active-bg: var(--erp-primary);
    --bs-btn-active-border-color: var(--erp-primary);
}

.text-primary {
    color: var(--erp-primary) !important;
}

a {
    color: var(--erp-primary);
}

/* 登录页：固定、半透明的背景图（浅色蒙层淡化底图，保证表单可读） */
.erp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eef2f9;
    background-image: linear-gradient(rgba(238, 242, 249, 0.62), rgba(247, 248, 250, 0.72)), url("../img/mainbg.webp");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

.erp-login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.erp-login-card {
    border: 1px solid var(--erp-border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
}

/* 登录页标题：中建蓝加粗 + 字距，下方短装饰线；副标题为浅灰小字 */
.erp-login-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--erp-primary);
}

.erp-login-title::after {
    content: "";
    display: block;
    width: 2.25rem;
    height: 3px;
    margin: 0.7rem auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--erp-primary), #5b9bd5);
}

.erp-login-subtitle {
    margin: 0.7rem 0 0;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #8a94a6;
}

/* 响应式：小屏侧边栏收起 */
@media (max-width: 991.98px) {
    .erp-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .erp-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }

    .erp-topbar {
        left: 0;
    }

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