/* 全局样式：语义色、首屏、登录页背景、顶栏、多页签、内容区、主题抽屉。

   我们自己的面板、顶栏、页签一律走下面的语义色变量，不再写死颜色：
   亮 / 暗两套只要改变量值即可，避免「背景变了文字没变」导致整片内容隐形。
   暗色由 ThemeService 切 antd 官方 dark.css，同时给 <body> 加 erp-dark 触发覆盖值。
   主色直接读 AntDesign 的变量，抽屉里改主色时自定义类跟着一起变。 */
:root {
    --erp-surface: #ffffff;                     /* 面板、卡片、顶栏底色 */
    --erp-surface-alt: #fafafa;                 /* 表头、行悬停等次级底色 */
    --erp-layout-bg: #f5f6fa;                   /* 内容区底色 */
    --erp-border: #f0f0f0;                      /* 分割线 */
    --erp-border-strong: #d9d9d9;               /* 输入控件描边 */
    --erp-divider: rgba(0, 0, 0, 0.06);         /* 下拉内部分隔线 */
    --erp-text: rgba(0, 0, 0, 0.85);            /* 主文本 */
    --erp-text-secondary: rgba(0, 0, 0, 0.65);  /* 次文本 */
    --erp-text-tertiary: rgba(0, 0, 0, 0.45);   /* 弱化文本 */
    --erp-hover-bg: rgba(0, 0, 0, 0.04);        /* 悬停底色 */
    --erp-hover-bg-soft: rgba(0, 0, 0, 0.02);   /* 更弱的悬停底色 */
    --erp-primary: var(--ant-primary-color, #1677ff);
    --erp-tab-active-bg: rgba(22, 119, 255, 0.06); /* 激活页签的浅色底 */
    --erp-primary-bg: rgba(22, 119, 255, 0.08); /* 主色极浅底 */
    --erp-radius: 6px;
}

body.erp-dark {
    --erp-surface: #1f1f1f;
    --erp-surface-alt: #262626;
    --erp-layout-bg: #141414;
    --erp-border: #303030;
    --erp-border-strong: #434343;
    --erp-divider: rgba(255, 255, 255, 0.12);
    --erp-text: rgba(255, 255, 255, 0.88);
    --erp-text-secondary: rgba(255, 255, 255, 0.65);
    --erp-text-tertiary: rgba(255, 255, 255, 0.55);
    --erp-hover-bg: rgba(255, 255, 255, 0.08);
    --erp-hover-bg-soft: rgba(255, 255, 255, 0.04);
    --erp-tab-active-bg: rgba(22, 119, 255, 0.18);
    --erp-primary-bg: rgba(22, 119, 255, 0.22);
}

/* antd 的 dark.css 没有把「禁用态文字」与「危险色」调亮：
   亮色下的禁用文字是 0.3 白、危险文字是深红 #a61d24，放到 #141414 / #1f1f1f 上几乎看不见，
   操作列的「修改 / 删除」会整片糊掉。这里在暗色下单独提亮。 */
body.erp-dark .ant-btn[disabled],
body.erp-dark .ant-btn[disabled] > span {
    color: rgba(255, 255, 255, 0.55);
}

body.erp-dark .ant-btn-dangerous:not([disabled]),
body.erp-dark .ant-btn-dangerous:not([disabled]) > span,
body.erp-dark .ant-typography-danger {
    color: #ff7875;
}

body.erp-dark .ant-btn-dangerous:not([disabled]):hover,
body.erp-dark .ant-btn-dangerous:not([disabled]):hover > span {
    color: #ffa39e;
}

/* 占位文字与面包屑分隔符用的是 0.3 / 0.45 白，深底上同样偏暗。 */
body.erp-dark .ant-select-selection-placeholder,
body.erp-dark .ant-input::placeholder,
body.erp-dark .ant-input-number-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

body.erp-dark .ant-breadcrumb-separator {
    color: rgba(255, 255, 255, 0.55);
}

/* Message / Notification 的底板是写死的白底黑字，暗色下会变成一块突兀的白条。 */
body.erp-dark .ant-message-notice-content,
body.erp-dark .ant-notification-notice {
    background: var(--erp-surface);
    color: var(--erp-text);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

html,
body,
#app {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---------- 关于「按屏宽自动适配」的做法 ----------
   早先试过给 html 加 zoom（0.8 / 0.85 / 0.9）把整站等比缩小，一屏能多显示
   几行，但代价是 1px 的表格边框被缩成 0.8px 亚像素 —— 浏览器只能画成半透明
   灰线，同一条线在有的行深、有的行浅，看起来「线条不自然、像断了」；
   antd 固定表头的表头 / 表体是两张表，列宽按像素测量后同步，分数缩放还会让
   两边越差越远，出现竖线错位、多出一个空格。
   所以现在不用整页缩放：窄屏通过 --erp-tbl-font / --erp-tbl-pad-y 压低表格
   字号与行高（app.js 的 syncTableStyle 按屏宽自动算），内容量接近缩放效果，
   但所有 1px 线仍然是整像素，清晰、均匀。 */

/* ---------- 首屏加载页 / 登录页：整屏磨砂背景（100% 视口铺满） ---------- */

/* 全屏底：作为模糊色斑与磨砂蒙版的定位容器。 */
.app-loading,
.login-page {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 启动加载页：底色「蓝（左上）→ 紫（右下）」。 */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #eef4ff 0%, #f7f8fc 48%, #f3f0ff 100%);
}

/* 登录页底色：与加载页互换，改为「紫（左上）→ 蓝（右下）」。 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f3f0ff 0%, #f8f7fd 48%, #eef4ff 100%);
}

/* 模糊色斑层：伪元素 + 多重径向渐变，绝对定位不参与弹性布局。
   径向渐变自带柔和边缘，无需再叠 filter: blur。 */
.app-loading::before,
.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* 加载页色斑：左上蓝、右下紫。rgba 收尾避免 Safari 把 transparent 插值成灰色。 */
.app-loading::before {
    background:
        radial-gradient(620px 620px at 6% 0%, rgba(91, 140, 255, 0.5), rgba(91, 140, 255, 0) 68%),
        radial-gradient(700px 700px at 98% 104%, rgba(169, 140, 255, 0.5), rgba(169, 140, 255, 0) 68%);
}

/* 登录页色斑：左上紫、右下蓝，与加载页互为镜像。 */
.login-page::before {
    background:
        radial-gradient(620px 620px at 6% 0%, rgba(169, 140, 255, 0.5), rgba(169, 140, 255, 0) 68%),
        radial-gradient(700px 700px at 98% 104%, rgba(91, 140, 255, 0.5), rgba(91, 140, 255, 0) 68%);
}

/* 底部现代磨砂蒙版：backdrop-filter 让下层色斑呈现毛玻璃质感。 */
.app-loading::after,
.login-page::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    height: 38%;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.42) 55%, rgba(255, 255, 255, 0.72) 100%);
    backdrop-filter: blur(40px) saturate(160%);
    -webkit-backdrop-filter: blur(40px) saturate(160%);
    /* 顶部渐隐遮罩：让模糊强度平滑过渡，避免出现生硬分界线。 */
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 100%);
}

.app-loading-body,
.app-loading-footer {
    position: relative;
    z-index: 2;
}

.app-loading-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-loading-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 16px;
}

/* Spin 提示文字与指示器之间的留白（index.html 静态骨架与 <Spin Tip> 共用）。 */
.app-loading-body .ant-spin-text {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
}

/* 全局加载遮罩：AntDesign <Spin> + 自建全屏覆盖层（1.6.2 的 Spin 没有 FullScreen 参数）。 */
.erp-global-mask {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
}

body.erp-dark .erp-global-mask {
    background: rgba(0, 0, 0, 0.55);
}

.erp-global-mask .ant-spin-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--erp-text-secondary);
}

.app-loading-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    color: rgba(0, 0, 0, 0.45);
}

.app-loading-footer img {
    width: 24px;
    height: 24px;
}

/* 登录表单容器：置于色斑与磨砂蒙版之上，宽度自适应视口。 */
.login-box {
    position: relative;
    z-index: 2;
    width: min(400px, 100%);
}

/* ---------- 顶栏：左侧操作区 + 面包屑 ---------- */

.erp-header-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
    min-width: 0;
    height: 100%;
}

/* 左侧操作区：固定宽度（不收缩），面包屑变长也不会挤动按钮。 */
.erp-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 16px;
}

.erp-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 16px;
    color: var(--erp-text);
    cursor: pointer;
    transition: color 0.2s;
}

.erp-header-action:hover {
    color: var(--ant-primary-color);
}

/* 面包屑：紧跟左侧操作区，超长时内部省略而不是换行。 */
.erp-breadcrumb {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
}

.erp-breadcrumb > ol {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
}

.erp-breadcrumb > ol > li {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.erp-breadcrumb .ant-breadcrumb-link,
.erp-breadcrumb .ant-breadcrumb-separator {
    white-space: nowrap;
}

/* 链路文字统一次要色（antd 链接默认主色，这里要「面包屑」观感）。 */
.erp-breadcrumb .ant-breadcrumb-link {
    color: var(--erp-text-secondary);
}

.erp-breadcrumb .ant-breadcrumb-link > a {
    color: inherit;
    transition: color 0.2s;
}

.erp-breadcrumb .ant-breadcrumb-link > a:hover {
    color: var(--ant-primary-color);
}

/* 当前页（末级）：加重并与可跳转层级区分；过长省略而不是换行。 */
.erp-breadcrumb > ol > li:last-child {
    min-width: 0;
    overflow: hidden;
}

.erp-breadcrumb > ol > li:last-child .ant-breadcrumb-link {
    overflow: hidden;
    color: var(--erp-text);
    font-weight: 500;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .erp-header-bar {
        gap: 8px;
    }

    .erp-header-actions {
        gap: 12px;
    }

    /* 窄屏隐藏首页面包屑，保留信息量更大的当前链路 */
    .erp-breadcrumb > ol > li:first-child {
        display: none;
    }
}

/* ---------- 顶栏：图标按钮与用户区 ---------- */

.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    font-size: 16px;
    color: var(--erp-text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.action:hover {
    background: var(--erp-hover-bg);
    color: var(--erp-primary);
}

/* 侧栏底部的折叠按钮：折叠入口已放在顶栏，隐藏避免重复。 */
.ant-pro-sider-collapsed-button {
    display: none;
}

.header-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--erp-text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.header-action:hover {
    background: var(--erp-hover-bg);
    color: var(--erp-primary);
}

.header-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header-user:hover {
    background: var(--erp-hover-bg);
}

.header-user-avatar {
    flex: none;
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 13px;
}

.header-user-name {
    max-width: 140px;
    overflow: hidden;
    font-size: 14px;
    color: var(--erp-text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 用户下拉头部的资料卡与分隔线。 */
.user-card {
    padding: 2px 0;
}

.user-card-name {
    font-weight: 600;
    color: var(--erp-text);
}

.user-card-desc {
    font-size: 12px;
    color: var(--erp-text-tertiary);
}

.menu-divider {
    height: 1px;
    margin: 2px 0;
    background: var(--erp-divider);
}

/* 固定下拉宽度：保证整行用户名完整展示。 */
.erp-user-dropdown .ant-dropdown-menu {
    min-width: 240px;
}

.erp-user-dropdown .ant-dropdown-menu-item {
    padding: 6px 12px;
}

.erp-user-dropdown .user-card-name {
    max-width: none;
    white-space: nowrap;
}

/* ---------- 代理访问横幅 ---------- */

/* 超管「进入公司」后的置顶警示条：暖橙底色，与普通会话在视觉上一眼区分。
   flex:none 的按钮不被拉伸；剩余时间弱化显示。 */
.erp-impersonation-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: -24px -24px 24px;
    background: #fdf0e6;
    border-bottom: 1px solid #f5c9a4;
    color: #ad4e00;
    font-size: 13px;
}

.erp-impersonation-banner .anticon {
    font-size: 15px;
    flex: none;
}

.erp-impersonation-remaining {
    color: #b06a2c;
    font-size: 12px;
    margin-left: auto;
    white-space: nowrap;
}

.erp-impersonation-banner .ant-btn {
    flex: none;
}

/* ---------- 顶部固定多页签 ---------- */

/* 页签 + 内容区整体容器：负外边距抵消 ProLayout 内容区默认的 24px 外边距，使页签栏贴顶满宽。 */
.erp-page-wrap {
    margin: -24px;
}

/* 页签栏：白底 + 底部 1px 分隔线，扁平无阴影。
   用 stretch 让页签撑满栏高，使激活指示条能贴在栏底分隔线上。 */
.erp-tabs-bar {
    display: flex;
    align-items: stretch;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: var(--erp-surface);
    border-bottom: 1px solid var(--erp-border);
}

/* 页签列表：超出宽度时横向滚动，不换行。 */
.erp-tabs-list {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.erp-tabs-list::-webkit-scrollbar {
    height: 0;
}

/* 单个页签：扁平化——无边框、无圆角、无实心填充，状态只靠文字色与底部指示条表达。 */
.erp-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 100%;
    padding: 0 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 13px;
    color: var(--erp-text-secondary);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, background-color 0.2s;
}

.erp-tab:hover {
    color: var(--erp-primary);
    background: var(--erp-hover-bg-soft);
}

/* 底部指示条：默认透明，激活时显示。 */
.erp-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--erp-primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.erp-tab-active {
    color: var(--erp-primary);
    background: var(--erp-tab-active-bg);
}

.erp-tab-active::after {
    opacity: 1;
}

.erp-tab-title {
    max-width: 160px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 页签关闭图标：默认弱化，悬停页签时提亮。 */
.erp-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: 10px;
    color: var(--erp-text-tertiary);
    opacity: 0.45;
    transition: opacity 0.2s, color 0.2s;
}

.erp-tab:hover .erp-tab-close {
    opacity: 1;
}

.erp-tab-close:hover {
    color: #ff4d4f;
}

/* 用户手工固定的页签：标题前的小图钉，顺带解释它为什么没有关闭按钮。 */
.erp-tab-pin {
    flex: none;
    font-size: 11px;
    color: var(--erp-text-tertiary);
}

.erp-tab-active .erp-tab-pin {
    color: var(--erp-primary);
}

/* 「更多」入口：扁平方形，悬停浅灰底。 */
.erp-tabs-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    align-self: center;
    width: 28px;
    height: 28px;
    margin: 2px 0;
    font-size: 14px;
    line-height: 1;
    color: var(--erp-text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.erp-tabs-more > .anticon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-tabs-more:hover {
    background: var(--erp-hover-bg);
    color: var(--erp-primary);
}

/* 每个页签外面套了一层 antd 的右键触发器 div（.ant-dropdown-trigger）：
   让包装层也撑满栏高且不参与收缩，否则页签一多会被压扁而不是横向滚动。 */
.erp-tabs-bar .ant-dropdown-trigger {
    display: flex;
    align-items: center;
    flex: none;
}

/* 页签右键菜单与「更多」菜单：antd 下拉菜单项默认不是 flex，图标会紧贴文字。 */
.erp-tab-menu .ant-dropdown-menu-item,
.erp-tabs-more-menu .ant-dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-tabs-more-menu {
    min-width: 180px;
    max-height: 360px;
    overflow-y: auto;
}

.erp-tabs-more-title {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 240px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ---------- 内容区 ---------- */

/* 高度由 JS 在首次渲染时计算一次并写死；四周统一 5px 内边距。 */
.erp-page-body {
    padding: 5px;
    overflow: auto;
    background: var(--erp-layout-bg);
}

/* 清零 ProLayout 自带的页容器外边距（含 -24px 负外边距）与内容子容器的 24px 外边距，
   保证页面内容距窗口边缘就是 .erp-page-body 的 5px。
   必须用后代选择器：children-content 并不是 page-container 的直接子级。 */
#erp-page-body .ant-pro-page-container,
#erp-page-body .ant-pro-page-container-children-content {
    margin: 0;
}

/* 页面标题已由顶部多页签统一展示，隐藏 PageContainer 自带页头，避免与页签标题重复。 */
.erp-page-body .ant-pro-page-container-warp {
    display: none;
}

/* 页脚整体移除：同时屏蔽 ProLayout 未传 FooterRender 时回退的默认页脚。 */
.ant-pro-global-footer {
    display: none;
}

/* ProLayout 顶栏底色写死白色：整站暗色时官方 dark.css 会把文字转成浅色，
   白底 + 浅色文字 = 顶栏按钮与用户名全部隐形，这里改成跟随语义色反转。 */
.ant-pro-global-header {
    background: var(--erp-surface);
}

/* 混合布局的顶栏本身是深色，文字与图标必须反白。 */
.ant-pro-global-header-layout-mix {
    background-color: #001529;
}

.ant-pro-global-header-layout-mix .action,
.ant-pro-global-header-layout-mix .header-action,
.ant-pro-global-header-layout-mix .header-user-name {
    color: rgba(255, 255, 255, 0.85);
}

.ant-pro-global-header-layout-mix .action:hover,
.ant-pro-global-header-layout-mix .header-action:hover,
.ant-pro-global-header-layout-mix .header-user:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ---------- 登录页 ---------- */

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-brand-logo {
    width: 48px;
    height: 48px;
}

.login-brand-title {
    font-size: 22px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
}

.login-brand-desc {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
}

/* 图形验证码：与输入框同高、可点击刷新 */
.login-captcha {
    height: 40px;
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius);
    cursor: pointer;
    flex-shrink: 0;
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.login-remember {
    display: inline-flex;
    align-items: center;
}

.login-remember-text {
    margin-left: 8px;
    color: var(--erp-text-secondary);
}

.login-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    /* 给固定在视口底部的页脚留出空间，避免两者在矮屏上叠在一起 */
    margin-bottom: 64px;
    color: rgba(0, 0, 0, 0.45);
}

.login-more span {
    cursor: pointer;
}

/* ---------- 主题设置抽屉 ---------- */

.erp-setting {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.erp-setting-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--erp-text-secondary);
    font-size: 12px;
    background: var(--erp-layout-bg);
    border-radius: 6px;
}

.erp-setting-title {
    margin-bottom: 10px;
    color: var(--erp-text);
    font-size: 14px;
}

.erp-thumb-list {
    display: flex;
    gap: 12px;
}

.erp-thumb {
    cursor: pointer;
}

/* 缩略图画布：用渐变画出「侧栏 / 顶栏」的位置，一眼看出布局差异。 */
.erp-thumb-preview {
    position: relative;
    width: 64px;
    height: 46px;
    overflow: hidden;
    background-color: var(--erp-surface);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    --erp-sider: #d9d9d9;
    --erp-top: #d9d9d9;
}

.erp-thumb-side {
    background-image: linear-gradient(to right, var(--erp-sider) 0 16px, var(--erp-surface) 16px);
}

.erp-thumb-mix {
    background-image:
        linear-gradient(to bottom, var(--erp-top) 0 14px, transparent 14px),
        linear-gradient(to right, var(--erp-sider) 0 16px, var(--erp-surface) 16px);
}

.erp-thumb-dark {
    --erp-sider: #001529;
    --erp-top: #001529;
}

.erp-thumb-active .erp-thumb-preview {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 2px var(--erp-primary);
}

.erp-thumb-check {
    position: absolute;
    top: 3px;
    right: 4px;
    color: var(--erp-primary);
    font-size: 13px;
}

.erp-thumb-label {
    margin-top: 6px;
    color: var(--erp-text-secondary);
    font-size: 12px;
    text-align: center;
}

.erp-color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.erp-color {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 22px;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.erp-color-active {
    box-shadow: 0 0 0 2px var(--erp-surface), 0 0 0 3px var(--erp-primary);
}

.erp-setting-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.erp-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--erp-text);
}

/* ---------- 菜单搜索 ---------- */

.erp-menu-search {
    cursor: pointer;
}

.erp-menu-search-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- 工具栏 ---------- */

.erp-page-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--erp-surface);
    padding-bottom: 8px;
}

.erp-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.erp-toolbar-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.erp-toolbar-keyword {
    width: 260px;
}

.erp-toolbar-select {
    width: 170px;
}

/* ---------- 单据列表过滤区 ---------- */
/* 旧的 .erp-filter 网格已废弃：所有列表页统一用 PageToolbar（erp-page-toolbar 段），
   关键字常驻、次要条件折进「更多搜索」，手机端由 mobile.css 堆叠。 */

/* ---------- 报表合计卡 ---------- */
/* auto-fit + minmax：宽屏四张并排，窄屏自动折成两张 / 一张，不用写断点 */
.erp-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.erp-stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
}

.erp-stat-label {
    font-size: 12px;
    color: var(--erp-text-tertiary);
}

/* 等宽数字：多张卡并排时小数点能对齐，扫一眼就能比大小 */
.erp-stat-value {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--erp-text);
    font-variant-numeric: tabular-nums;
}

/* 窄卡片与窄表单：宽度交给样式表而不是 inline style，手机上才能被统一放开（见 mobile.css） */
.erp-narrow-card {
    max-width: 520px;
}

.erp-narrow-form {
    max-width: 360px;
}

.erp-toolbar-fields {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
}

.erp-toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--erp-text-secondary);
}

.erp-toolbar-field-actions {
    display: flex;
    gap: 8px;
}

.erp-toolbar-selected {
    color: var(--erp-text-tertiary);
    font-size: 13px;
}

/* ---------- 表单与表格 ---------- */

.erp-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.erp-form-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.erp-form-item > label {
    font-size: 13px;
    color: var(--erp-text-secondary);
}

/* 同一行并排多个表单项。主要用途：让 <Switch> 不独占一行——开关必须与相邻控件（如「价格」）并列 */
.erp-form-row {
    display: flex;
    gap: 16px;
}

.erp-form-row > .erp-form-item {
    flex: 1 1 0;
    min-width: 0;
}

/* 开关不独占一行：.erp-form-item 是纵向 flex（默认 align-items: stretch），
   Switch 会被拉成整行通栏（实测 310px 的蓝色长条）。开关不是输入框，按内容宽度靠左即可。
   与 mobile.css 的 .m-body 规则同一用意，PC 端这里全局兜底。 */
.erp-form-item > .ant-switch {
    align-self: flex-start;
    flex: none;
}

.erp-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.erp-pager {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

.erp-antd-table .ant-table-thead > tr > th {
    background: var(--erp-surface-alt);
}

/* 单元格内容一律裁切：日期、单号这类定长文本一旦溢出就会压到相邻列上，
   视觉上就是「表格列错位」，用户会以为表格坏了。Ellipsis 交给 antd，
   这里只兜住那些内容被 Template 包了一层、ellipsis 管不到的格子。 */
.erp-antd-table .ant-table-tbody > tr > td {
    overflow: hidden;
}

/* ---------- 全局表格外观（系统设置页可调）----------
   body 标记类（边框模式）+ CSS 变量（字号 / 行内边距）驱动。
   只动字号、padding、边框，绝不碰列宽：列宽由 table-layout:fixed 的 col 决定，
   表头表体两张表拿同一套样式，因此不会出现列错位。
   ⚠️ 一律排除 .ant-table-measure-row：antd 靠这行隐藏单元格量列宽，
      它的 padding / 字号一旦被改，量出的宽度就变了，表头表体立刻错开。

   边框有两条规矩，直接决定「线条自不自然」：
   ① 竖线必须与横线同色同宽（antd 横线用的是 --erp-border）——
      早先用更深的 --erp-border-strong，竖线比横线重，整张表看着像花格布；
   ② 末列不补右线、首列补左线 —— 否则右边线会和固定列阴影、容器边叠成双线发黑，
      左边却没线，四周轻重不一。 */
:root {
    --erp-tbl-font: 13px;
    --erp-tbl-pad-y: 8px;
}

.erp-antd-table .ant-table-thead > tr > th,
.erp-antd-table .ant-table-tbody > tr:not(.ant-table-measure-row) > td {
    font-size: var(--erp-tbl-font);
    padding-top: var(--erp-tbl-pad-y);
    padding-bottom: var(--erp-tbl-pad-y);
}

/* 全边框：竖线与横线同色，补左侧外框，末列不画右线 */
body.erp-tbl-bordered .erp-antd-table .ant-table-thead > tr > th,
body.erp-tbl-bordered .erp-antd-table .ant-table-tbody > tr:not(.ant-table-measure-row) > td {
    border-right: 1px solid var(--erp-border);
}

body.erp-tbl-bordered .erp-antd-table .ant-table-thead > tr > th:last-child,
body.erp-tbl-bordered .erp-antd-table .ant-table-tbody > tr:not(.ant-table-measure-row) > td:last-child {
    border-right: none;
}

body.erp-tbl-bordered .erp-antd-table .ant-table-thead > tr > th:first-child,
body.erp-tbl-bordered .erp-antd-table .ant-table-tbody > tr:not(.ant-table-measure-row) > td:first-child {
    border-left: 1px solid var(--erp-border);
}

/* 无边框：去掉行线，只留表头底边当分隔 */
body.erp-tbl-borderless .erp-antd-table .ant-table-tbody > tr:not(.ant-table-measure-row) > td {
    border-bottom: none;
}

/* 固定列（操作列钉右）是浮在滚动内容上的一层，默认阴影在浅色表头上几乎看不见，
   于是被盖住的列看起来就像「内容超出格子」。把分界线画明显，让人知道那列是悬浮的。 */
.erp-antd-table .ant-table-cell-fix-right {
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.14);
}

.erp-antd-table .ant-table-cell-fix-left {
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.14);
}

/* 表格容器：撑满页面容器，滚动条留在表格体内，表头固定。
   关键点：从 .ant-table-wrapper 到 .ant-table-body 每一层都要 flex + min-height:0，
   缺任何一层，flex 子项都会按内容高度撑开，表格就会溢出到页面容器外面。 */
.erp-table-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 240px;
}

/* 表格外还套了 spin 加载层（.ant-table-spin-wrapper → 匿名 div → .ant-spin-container），
   这几层默认不是 flex，高度链会断在「内容高度」上，必须逐层补齐才能把剩余高度传给表格体。 */
.erp-table-wrap > .ant-table-wrapper,
.erp-table-wrap .ant-table-spin-wrapper,
.erp-table-wrap .ant-table-spin-wrapper > div,
.erp-table-wrap .ant-spin-container {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.erp-table-wrap .ant-table {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.erp-table-wrap .ant-table-container {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.erp-table-wrap .ant-table-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.erp-table-wrap .erp-pager {
    flex: none;
}

.erp-content-card {
    background: var(--erp-surface);
    border-radius: var(--erp-radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 100%;
}

/* 卡片内除表格外的部分（搜索工具栏等）按内容高度，剩下的全给表格，
   表格才能在卡片内滚动而不是把卡片撑高溢出页面容器。 */
.erp-content-card > *:not(.erp-table-wrap) {
    flex: none;
}

.erp-content-card > .erp-table-wrap {
    flex: 1;
    min-height: 0;
}

/* ---------- 工作台快捷入口（九宫格）----------
   与菜单同一套 antd 图标名；图标 26px（侧栏菜单是 14~16px，这里刻意放大当视觉锚点）。
   列数不写死：repeat(auto-fill, minmax(104px, 1fr)) 让格子随内容区宽度自适应排布，
   窄屏自然收到两列，无需媒体查询。 */
.erp-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 12px;
}

.erp-quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 8px 14px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    background: var(--erp-surface);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.erp-quick-item:hover {
    border-color: var(--erp-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.erp-quick-icon {
    font-size: 26px;
    line-height: 1;
    color: var(--erp-primary);
}

.erp-quick-name {
    font-size: 13px;
    color: var(--erp-text);
    text-align: center;
}

/* 表格头部条：左侧 HeaderStart（如类别路径面包屑）+ 右上角「列设置」齿轮，同一行两端对齐 */
.erp-table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 2px 0 6px;
}

/* 双击排序：可排序列表头 */
.erp-th-sortable {
    cursor: pointer;
    user-select: none;
}

.erp-th-title {
    white-space: nowrap;
}

.erp-th-sorter {
    display: inline-flex;
    flex-direction: column;
    margin-left: 3px;
    vertical-align: middle;
    line-height: 1;
}

/* 未激活三角弱化成浅灰，当前方向的那支高亮主色（caret 图标本身即 anticon，字号控大小） */
.erp-sort-arrow {
    font-size: 11px;
    line-height: 0.85;
    color: var(--erp-text-tertiary, #bfbfbf);
    transition: color 0.15s;
}

.erp-sort-active {
    color: var(--erp-primary, #1677ff);
}

.erp-table-head-start {
    flex: 1;
    min-width: 0;
}

/* 列设置浮层：显示 / 列名 / 宽度(px) / 对齐 的可编辑表格。
   注意：antd 的 .ant-dropdown 容器只有定位，背景/内边距/圆角只在 .ant-dropdown-menu 上，
   我们塞的是自定义 div，必须自己补面板底色，否则浮层透明、表格内容会从下面透出来。 */
.erp-col-settings {
    padding: 2px 0;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
}

body.erp-dark .erp-col-settings {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.erp-col-settings-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 560px;
}

.erp-col-settings-table th,
.erp-col-settings-table td {
    padding: 5px 10px;
    font-size: 13px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--erp-border);
}

.erp-col-settings-table thead th {
    color: var(--erp-text-secondary);
    font-weight: 500;
    background: var(--erp-surface-alt);
    white-space: nowrap;
}

.erp-col-settings-table tbody tr:last-child td {
    border-bottom: none;
}

.erp-col-settings-table tbody tr.erp-col-dragging {
    opacity: 0.45;
}

/* 拖拽手柄：6 点阵列（纯 CSS 绘制，不依赖图标资源） */
.erp-col-settings-table .erp-col-drag-cell {
    width: 28px;
    text-align: center;
}

.erp-col-drag {
    display: inline-block;
    width: 12px;
    height: 16px;
    cursor: move;
    background-image: radial-gradient(var(--erp-text-tertiary) 1.4px, transparent 1.5px);
    background-size: 6px 6px;
    background-repeat: repeat;
}

.erp-col-settings-table .erp-col-visible {
    width: 56px;
    text-align: center;
}

.erp-col-settings-table .erp-col-title {
    min-width: 120px;
    color: var(--erp-text);
}

.erp-col-settings-table .erp-col-width {
    width: 96px;
}

.erp-col-settings-table .erp-col-align {
    width: 104px;
}

/* antd 默认 .ant-checkbox-wrapper{align-items:baseline} 且 .ant-checkbox{top:0.2em}，
   勾选框与文字会错位，这里改成垂直居中并清零偏移。 */
.erp-col-settings .ant-checkbox-wrapper {
    align-items: center;
}

.erp-col-settings .ant-checkbox {
    top: 0;
}

/* 行内操作：默认隐藏，悬停行时淡入（对齐标准设计的内联图标操作） */
.erp-row-actions {
    display: inline-flex;
    gap: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.erp-antd-table tbody tr:hover .erp-row-actions {
    opacity: 1;
}

/* 列表里的单号链接：点一下进详情（原来只有操作列图标能进，用户习惯是点单号，
   所以给个明确的点击态，别让人靠猜） */
.erp-link {
    color: var(--erp-primary);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.erp-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* 详情抽屉里的只读值：与 .erp-form-item 的 label 对齐，不做成输入框 */
.erp-detail-value {
    padding: 5px 0;
    font-size: 13px;
}

/* 商品列表的价格列：有数据可点击（主色 + 下划线悬停），未维护灰字，无权限纯文本 */
.erp-price-link {
    color: var(--ant-primary-color, #1890ff);
    cursor: pointer;
}

.erp-price-link:hover {
    text-decoration: underline;
}

.erp-price-empty {
    color: var(--erp-text-tertiary);
}

/* 未维护的价格格：灰字但明确可点（hover 变主色），点进去在抽屉里添加第一条价格 */
.erp-price-empty.erp-price-clickable {
    cursor: pointer;
}

.erp-price-empty.erp-price-clickable:hover {
    color: var(--ant-primary-color, #1890ff);
    text-decoration: underline;
}

.erp-price-plain {
    color: inherit;
}

/* 可折叠左栏（ErpCollapsiblePane）：桌面收成 44px 窄条，展开恢复原宽。
   内容常驻 DOM（只切显示），保证 Tree 展开状态、滚动位置不因折叠而丢。 */
.erp-pane-rail {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    cursor: pointer;
    color: var(--erp-text-secondary);
    font-size: 13px;
}

.erp-pane-rail:hover {
    color: var(--ant-primary-color, #1890ff);
}

/* 窄条上的标题竖排，模拟侧边标签 */
.erp-pane-rail-text {
    writing-mode: vertical-rl;
    letter-spacing: 3px;
}

.erp-pane-collapsed .erp-pane-rail {
    display: flex;
}

.erp-pane-collapsed .erp-pane-body {
    display: none;
}

/* 折叠窄条的 hover 悬浮面板：鼠标划入弹出完整类别面板，移开即隐藏。
   用绝对定位浮层而不是原地展开——原地展开会挤压右侧表格造成布局跳动。 */
.erp-pane-flyout {
    position: absolute;
    left: 44px;
    top: 0;
    bottom: 0;
    width: 300px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--erp-surface, #fff);
    border: 1px solid var(--ant-border-color, #f0f0f0);
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.12);
    padding: 8px 12px 12px;
    animation: erp-flyout-in 0.12s ease-out;
}

@keyframes erp-flyout-in {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: none; }
}

.erp-pane-flyout .erp-pane-flyout-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* 折叠窄条 hover 悬浮面板的定位基准。写在类上而不是内联，
   因为 mobile.css 要把浮起的左栏覆盖成 position:fixed（内联会赢）。 */
.erp-master-pane {
    position: relative;
}

/* 展开态内容占满面板高度（搜索框 + 树的 flex 布局从原 erp-master-pane 挪进来） */
.erp-pane-expanded .erp-pane-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* 左侧类别面板头部：标题 + 搜索/新增图标按钮 */
/* 类别树面板：标题独占一行（下方分割线）+ 搜索框/放大镜/新增 挤在一行（标准设计） */
.erp-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--erp-border);
}

.erp-cat-title {
    font-size: 15px;
    font-weight: 600;
}

.erp-cat-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.erp-cat-search-box {
    flex: 1;
    min-width: 0;
}

.erp-cat-search-box .ant-input-affix-wrapper,
.erp-cat-search-box .ant-input {
    width: 100%;
}

/* 表格头部左侧（ErpTable HeaderStart）显示「全部 / 一级 / 二级」类别路径，无底色、与右上角列设置齿轮同一行。
   上半部分是可点击的上级（回退筛选），末级是当前节点（不可点）。 */
.erp-cat-path {
    display: flex;
    align-items: center;
    min-width: 0;
    font-size: 13px;
}

.erp-cat-path .ant-breadcrumb {
    font-size: 13px;
}

.erp-cat-path .ant-breadcrumb-link {
    color: var(--erp-primary);
    cursor: pointer;
}

.erp-cat-path .ant-breadcrumb-link:hover {
    opacity: 0.8;
}

.erp-cat-path .erp-cat-path-current .ant-breadcrumb-link {
    color: var(--erp-text);
    cursor: default;
}

.erp-cat-path .erp-cat-path-current .ant-breadcrumb-link:hover {
    opacity: 1;
}

/* 类别树（antd Tree）：整行可选中 + 悬停显示行内操作 */
.erp-cat-tree.ant-tree,
.erp-cat-tree .ant-tree-list,
.erp-cat-tree .ant-tree-node-content-wrapper {
    width: 100%;
}

.erp-cat-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.erp-cat-tree .erp-cat-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 类别编号：资料编码的前缀，灰底小字跟在名称右边，不占名称的显示空间 */
.erp-cat-tree .erp-cat-code {
    flex: none;
    padding: 0 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, .04);
    font-size: 12px;
    color: var(--erp-text-tertiary);
    white-space: nowrap;
}

.erp-cat-tree .ant-tree-treenode:hover .erp-row-actions,
.erp-cat-tree .ant-tree-treenode-selected .erp-row-actions {
    opacity: 1;
}

/* 左侧「客户 / 供应商」列表（价格维护页）：可点击选中行 */
.erp-party-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: var(--erp-radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.erp-party-item:hover {
    background: var(--erp-surface-alt);
}

.erp-party-item-active,
.erp-party-item-active:hover {
    background: var(--erp-primary-weak, #e6f4ff);
}

.erp-party-item-name {
    font-size: 14px;
    color: var(--erp-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-party-item-code {
    font-size: 12px;
    color: var(--erp-text-tertiary);
}

/* 客户侧的料号 / 规格：接单以客户报的为准，排在自有档案（灰色那排）之上，字色要实一点 */
.erp-party-item-cust {
    font-size: 13px;
    color: var(--erp-text-secondary);
}

/* 表格单元格里的次要行（我方料号 / 我方规格）：只作对照，弱化不抢视线 */
.erp-cell-sub {
    font-size: 12px;
    color: var(--erp-text-tertiary);
}

/* 商品抽屉内的「客户价格 / 供应商价格」标签面板 */
.erp-price-pane {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 230px);
    min-height: 320px;
}

.erp-price-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* 表单项内的辅助说明文字（如「默认供应商」开关旁的解释） */
.erp-form-hint {
    margin-left: 8px;
    font-size: 12px;
    line-height: 22px;
    color: var(--erp-text-tertiary);
}

/* ---------- 滚动条 ---------- */

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

::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.18);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

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

/* ---------- 未处理异常提示条 ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: #ffe58f;
    z-index: 1000;
}
