* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* 全局主题变量（默认：紫蓝清新风格） */
:root {
    /* 顶部栏渐变与阴影 */
    --app-header-gradient-from: #667eea;
    --app-header-gradient-to: #764ba2;
    --app-header-shadow: 0 2px 10px rgba(0,0,0,0.1);

    /* 顶部主按钮（APS / 订单管理等） */
    --app-primary-btn-bg: #22c55e;
    --app-primary-btn-bg-hover: #16a34a;
    --app-primary-btn-text: #ffffff;

    /* 顶部次级按钮（白字半透明），默认跟随紫蓝主题 */
    --app-header-secondary-btn-bg: rgba(255,255,255,0.18);
    --app-header-secondary-btn-bg-hover: rgba(255,255,255,0.30);
    --app-header-secondary-btn-border: rgba(15,23,42,0.10);
    --app-header-secondary-btn-text: #f9fafb;

    /* 通用次级按钮（白底灰边，用于表格/弹窗） */
    --app-secondary-btn-bg: #f3f4f6;
    --app-secondary-btn-bg-hover: #e5e7eb;
    --app-secondary-btn-border: #d1d5db;
    --app-secondary-btn-border-hover: #cbd5e1;
    --app-secondary-btn-text: #111827;

    /* 主题预览用的色块 */
    --theme-violet-from: #6366f1;
    --theme-violet-to: #8b5cf6;
    --theme-violet-accent: #22c55e;

    --theme-sky-from: #0ea5e9;
    --theme-sky-to: #22c55e;
    --theme-sky-accent: #0284c7;

    --theme-ink-from: #0f172a;
    --theme-ink-to: #1f2937;
    --theme-ink-accent: #38bdf8;
}

/* ===================== 入口页面（门户覆盖层） ===================== */
.portal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.portal-overlay.show {
    display: flex;
}

.portal-panel {
    width: min(820px, 100%);
    background: linear-gradient(135deg, #ffffff 0%, #f7f7ff 100%);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    padding: 18px 20px 16px;
    border: 1px solid rgba(102, 126, 234, 0.25);
}

.portal-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.portal-subtitle {
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 14px;
}

.portal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.portal-actions .btn {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
}

.portal-noshow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    user-select: none;
}

/* ===================== APS 模态框 ===================== */
.aps-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
}

.aps-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aps-control > span {
    font-size: 13px;
    color: #111827;
    white-space: nowrap;
}

.aps-control-inline {
    gap: 6px;
}

.aps-hint {
    flex: 1 1 360px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
}

.aps-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0 8px;
    flex-wrap: wrap;
}

.aps-tab {
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #374151;
}

.aps-tab.active {
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.10);
    color: #1f2a7a;
    font-weight: 600;
}

.aps-tab-panel {
    display: none;
}

.aps-tab-panel.show {
    display: block;
}

/* 表格紧凑布局参数（如需更紧凑，可在这里微调） */
:root {
    /* 提升阅读清晰度：字体略大，但保持相对紧凑的行间距 */
    --table-font-size: 12px;
    --table-header-padding-y: 4px;
    --table-header-padding-x: 8px;
    --table-cell-padding-y: 3px;
    --table-cell-padding-x: 6px;
    /* header 高度：padding 12px*2 + h1 约32px = 56px，供表头 sticky 定位使用 */
    --header-height: 56px;
}

/* 页面整体改为自适应铺满宽度 */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    /* 略微压缩上下 padding，把空间让给订单区 */
    padding: 12px 20px 12px 20px;
}

header {
    background: linear-gradient(135deg, var(--app-header-gradient-from) 0%, var(--app-header-gradient-to) 100%);
    color: white;
    /* 顶部整体更紧凑，减少垂直空间占用 */
    padding: 6px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--app-header-shadow);
    /* 顶部整体固定在页面最上方 */
    position: sticky;
    top: 0;
    z-index: 500;
    gap: 10px;
    min-width: 0; /* 允许flex子元素收缩 */
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
}

.btn {
    padding: 7px 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    font-weight: 500;
}

/* 顶部这一排主导航按钮：字号和高度略大一点，便于看清和点击 */
header .btn {
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 18px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-primary {
    background-color: var(--app-primary-btn-bg);
    color: var(--app-primary-btn-text);
    box-shadow: 0 0 0 1px rgba(15,23,42,0.10), 0 4px 10px rgba(0,0,0,0.18);
}

.btn-primary:hover {
    background-color: var(--app-primary-btn-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.26);
}

.btn-secondary {
    /* 默认用于白底页面/弹窗：增强对比度，避免“操作”列按钮看不清 */
    background-color: var(--app-secondary-btn-bg);
    color: var(--app-secondary-btn-text);
    border: 1px solid var(--app-secondary-btn-border);
}

.btn-secondary:hover {
    background-color: var(--app-secondary-btn-bg-hover);
    border-color: var(--app-secondary-btn-border-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* 顶部 Header 区域是深色背景：二级按钮保持“白字半透明”风格 */
header .btn-secondary {
    background-color: var(--app-header-secondary-btn-bg);
    color: var(--app-header-secondary-btn-text);
    border: 1px solid var(--app-header-secondary-btn-border);
    box-shadow: 0 0 0 1px rgba(15,23,42,0.18);
}

/* ========== 顶部：订单管理下拉菜单 ========== */
.header-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.header-dropdown .dropdown-caret {
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.9;
}

.header-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #ffffff;
    color: #111827;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 6px;
    z-index: 999;
}

.header-dropdown-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #111827;
    transition: background-color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.header-dropdown-item:hover {
    background: #f3f4f6;
}

.header-dropdown-item:active {
    transform: translateY(1px);
}

header .btn-secondary:hover {
    background-color: var(--app-header-secondary-btn-bg-hover);
    transform: translateY(-0.5px);
    box-shadow: 0 4px 10px rgba(15,23,42,0.35);
}

/* 顶部：系统设置 + 用户头像区域 */
.header-settings-wrapper {
    margin-left: 8px;
}

.header-user-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.header-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.75);
    box-shadow: 0 0 0 1px rgba(148,163,184,0.45);
    background: radial-gradient(circle at 30% 20%, #fef3c7, #f97316);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-user-name {
    max-width: 120px;
    font-size: 12px;
    color: #f9fafb;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.header-dropdown-item-danger {
    color: #b91c1c;
}

.header-dropdown-item-danger:hover {
    background: #fee2e2;
}

/* 顶部主题风格管理弹窗 */
.theme-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.theme-option:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 14px rgba(148,163,184,0.35);
    transform: translateY(-1px);
}

.theme-option.active {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79,70,229,0.8), 0 8px 18px rgba(79,70,229,0.35);
}

.theme-preview {
    width: 88px;
    height: 32px;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08);
}

.theme-preview-strip {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.theme-preview-buttons {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
}

.theme-preview-btn {
    width: 14px;
    height: 18px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(15,23,42,0.18);
}

.theme-preview-violet .theme-preview-strip {
    background: linear-gradient(120deg, var(--theme-violet-from), var(--theme-violet-to));
}

.theme-preview-violet .theme-preview-btn:nth-child(1) {
    background: #22c55e;
}

.theme-preview-violet .theme-preview-btn:nth-child(2) {
    background: rgba(255,255,255,0.12);
}

.theme-preview-violet .theme-preview-btn:nth-child(3) {
    background: rgba(255,255,255,0.32);
}

.theme-preview-sky .theme-preview-strip {
    background: linear-gradient(120deg, var(--theme-sky-from), var(--theme-sky-to));
}

.theme-preview-sky .theme-preview-btn:nth-child(1) {
    background: #0284c7;
}

.theme-preview-sky .theme-preview-btn:nth-child(2) {
    background: rgba(248,250,252,0.9);
}

.theme-preview-sky .theme-preview-btn:nth-child(3) {
    background: rgba(248,250,252,0.6);
}

.theme-preview-ink .theme-preview-strip {
    background: linear-gradient(120deg, var(--theme-ink-from), var(--theme-ink-to));
}

.theme-preview-ink .theme-preview-btn:nth-child(1) {
    background: #22c55e;
}

.theme-preview-ink .theme-preview-btn:nth-child(2) {
    background: rgba(148,163,184,0.4);
}

.theme-preview-ink .theme-preview-btn:nth-child(3) {
    background: rgba(30,64,175,0.85);
}

.theme-option-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-option-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.theme-option-desc {
    font-size: 12px;
    color: #6b7280;
}

.theme-option-badge {
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
}

.theme-option-check {
    margin-left: auto;
    font-size: 16px;
    color: #22c55e;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.theme-option.active .theme-option-check {
    opacity: 1;
    transform: scale(1.05);
}

.theme-modal-hint {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

/* 主题类：通过给 body 添加 class 实现整套色系切换 */
body.theme-violet {
    --app-header-gradient-from: #667eea;
    --app-header-gradient-to: #764ba2;
    --app-primary-btn-bg: #22c55e;
    --app-primary-btn-bg-hover: #16a34a;
    --app-header-secondary-btn-bg: rgba(15,23,42,0.08);
    --app-header-secondary-btn-bg-hover: rgba(15,23,42,0.18);
    --app-header-secondary-btn-border: rgba(15,23,42,0.32);
    --app-header-secondary-btn-text: #e5e7eb;
}

body.theme-sky {
    --app-header-gradient-from: #0ea5e9;
    --app-header-gradient-to: #22c55e;
    --app-primary-btn-bg: #0284c7;
    --app-primary-btn-bg-hover: #0369a1;
    --app-header-secondary-btn-bg: rgba(248,250,252,0.22);
    --app-header-secondary-btn-bg-hover: rgba(248,250,252,0.36);
    --app-header-secondary-btn-border: rgba(15,23,42,0.20);
    --app-header-secondary-btn-text: #0b1120;
}

body.theme-ink {
    --app-header-gradient-from: #0f172a;
    --app-header-gradient-to: #1f2937;
    --app-primary-btn-bg: #22c55e;
    --app-primary-btn-bg-hover: #16a34a;
    --app-header-secondary-btn-bg: rgba(15,23,42,0.50);
    --app-header-secondary-btn-bg-hover: rgba(15,23,42,0.65);
    --app-header-secondary-btn-border: rgba(148,163,184,0.55);
    --app-header-secondary-btn-text: #e5e7eb;
}

.btn-secondary:disabled,
.btn-secondary[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-danger {
    background-color: #e53935;
    color: #fff;
}

.btn-danger:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.filter-section {
    background: white;
    /* 筛选区整体再压缩一点高度 */
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
    /* 固定在紫色 header 正下方，随页面滚动时始终可见 */
    position: sticky;
    top: 56px;
    z-index: 450;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.order-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.order-filter-row {
    width: 100%;
    align-items: center;
}

.order-filter-row-top {
    display: grid;
    grid-template-columns:
        minmax(260px, 1.6fr)
        minmax(200px, 1fr)
        minmax(200px, 1fr)
        auto;
    column-gap: 10px;
    row-gap: 6px;
}

.order-filter-row-bottom {
    display: grid;
    grid-template-columns:
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(130px, 1fr)
        minmax(130px, 1fr)
        minmax(110px, 1fr);
    column-gap: 10px;
    row-gap: 6px;
}

.order-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.order-filter-item label {
    white-space: nowrap;
    color: #111827;
    font-size: 13px;
}

.order-date-range {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.order-date-range .filter-select {
    padding: 6px 10px;
}

.order-due-within {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.order-due-within .filter-select {
    padding: 6px 10px;
}

.order-due-unit {
    white-space: nowrap;
    color: #374151;
    font-size: 13px;
}

.order-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.order-priority-sort-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #111827;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: #f3f4f6;
}

.order-priority-sort-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

.order-priority-sort-toggle span {
    white-space: nowrap;
}

/* 顶部筛选：更紧凑的输入框高度 */
.order-filters .search-input,
.order-filters .filter-select {
    padding: 6px 10px;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .order-filter-row-top {
        grid-template-columns: 1fr 1fr;
    }
    .order-filter-row-top .order-filter-item-date {
        grid-column: 1 / -1;
    }
    .order-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
    .order-filter-row-bottom {
        grid-template-columns: 1fr 1fr;
    }
    .order-filter-row-bottom .order-filter-item-due {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .order-filter-row-top,
    .order-filter-row-bottom {
        grid-template-columns: 1fr;
    }
}

.search-input, .filter-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    flex: 1;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 表格容器支持横向滚动，避免列太多被压缩 */
.table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    /* 默认允许垂直滚动，供弹窗等场景复用 */
    overflow-y: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 0;
    /* 是否限高改由更具体的选择器控制，这里不做统一限制 */
}

/* 主内容区域使用 flex 布局，让表格容器自动填充剩余空间 */
.main-content {
    display: flex;
    flex-direction: column;
    /* 尽量让订单区贴近屏幕底部：仅扣掉 header 高度和少量容器内边距 */
    height: calc(100vh - var(--header-height) - 24px);
    min-height: 0; /* 允许 flex 子元素收缩 */
}

/* 首页主订单表：在容器内部滚动，表头固定 */
.main-content > .table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0; /* 允许 flex 子元素收缩 */
}

/* 页面底部留白减少，让订单区更贴近屏幕底边 */
body {
    padding-bottom: 6px;
}

/* 固定在页面底部的横向滚动条（与订单表同步） */
#orderTableScrollbar {
    /* 2026-03：页面已在表格容器内自带横向滚动，这个底部同步滚动条先整体隐藏 */
    display: none;
}

#orderTableScrollbarInner {
    height: 1px;               /* 足够小，只为撑开宽度 */
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: var(--table-font-size);
    border: 1px solid #e5e7eb;
}

.data-table thead {
    background: #f3f4f6;
    color: #111827;
    position: sticky;
    top: 0;
    z-index: 300;
}

.data-table th {
    padding: var(--table-header-padding-y) var(--table-header-padding-x);
    text-align: center; /* 表头居中 */
    font-weight: 600;
    position: relative;
    /* 允许选择复制表头文本 */
    user-select: text;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    line-height: 1.2;
    vertical-align: middle; /* 表头垂直居中 */
}

.table-container thead th {
    /* 订单数据区内部滚动时，表头固定在表格容器顶部，与下面数据区形成两个功能区 */
    position: sticky;
    top: 0;
    z-index: 301;
    background-color: #f3f4f6;
    /* 确保背景色不透明，避免滚动时内容透过 */
    background-clip: padding-box;
}

/* 订单表：把“工作号”等表头行与下面工单数据明显分割开 */
#orderTable.data-table thead th {
    border-bottom: none; /* 取消默认 1px 底边，避免看起来太淡或出现双线 */
    box-shadow: inset 0 -2px 0 #cbd5e1; /* 加粗分割线 */
}

.data-table td {
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    vertical-align: middle;
}

/* 订单优先级下拉 */
.priority-select {
    width: 100%;
    padding: 2px 4px;
    font-size: 11px;
}

/* 优先级颜色：select 本身文字/背景 */
.priority-select.priority-teji {
    background-color: #b91c1c;
    color: #fff;
}

.priority-select.priority-jinji {
    background-color: #f97316;
    color: #fff;
}

.priority-select.priority-jiaji {
    background-color: #facc15;
    color: #111827;
}

.priority-select.priority-zanting {
    background-color: #9ca3af;
    color: #111827;
}

.priority-select.priority-wu {
    background-color: #e5e7eb;
    color: #111827;
}

/* 优先级颜色：整行底色（淡一点，避免刺眼） */
tr.priority-row-teji {
    background-color: #fee2e2;
}

tr.priority-row-jinji {
    background-color: #ffedd5;
}

tr.priority-row-jiaji {
    background-color: #fef9c3;
}

tr.priority-row-zanting {
    background-color: #e5e7eb;
}

tr.priority-row-wu {
    /* 默认行色不变，可轻微加一点点底色 */
    background-color: #ffffff;
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 订单表列很多，给它一个更大的最小宽度，方便横向滚动 */
#orderTable.data-table {
    /* 略微减小整体最小宽度，让更多列在可视区域内显示 */
    min-width: 1700px;
}

/* 物料号数据表：整体撑满弹窗，“工艺路线”列优先吃掉剩余宽度 */
#materialTable.data-table {
    table-layout: auto;   /* 让列宽依据内容自动分配 */
    width: 100%;          /* 撑满模态框可用宽度 */
}

/* 第 8 列是“工艺路线”，设置成主要宽度列 */
#materialTable.data-table th:nth-child(8),
#materialTable.data-table td:nth-child(8) {
    width: 100%;
}

/* 物料号弹窗中的表格容器与订单列表保持一致风格 */
.material-table-container {
    margin-top: 10px;
}

/* 物料号数据表分页条 */
.material-pagination {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #4b5563;
}

.material-pagination-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* 物料号分页按钮：白底深色文字，避免在灰/白底上看不见 */
.material-pagination-controls .btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.material-pagination-controls .btn-secondary:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* 中间页码数字区 */
.material-page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 4px;
}

.material-page-number {
    min-width: 26px;
    text-align: center;
}

/* 当前页高亮 */
.material-page-number.active {
    background-color: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

/* ========= 首页订单表分页条（底部） ========= */
.table-pagination {
    margin-top: 6px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #4b5563;
    background-color: #ffffff;
    border-radius: 0 0 8px 8px;
    border: 1px solid #e5e7eb;
    border-top: none; /* 与上方表格视觉连在一起 */
}

.pagination-info {
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.order-page-number {
    min-width: 26px;
    text-align: center;
}

.order-page-number.active {
    background-color: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

/* 订单分页按钮在白底上用深色文字，避免不清晰 */
#orderTablePagination .btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

#orderTablePagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
}

/* ========= APS 每日排产计划：筛选区 & 分页 ========= */
.aps-daily-toolbar {
    padding: 10px 12px 4px;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 40%, #f3f4f6 100%);
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
    margin-top: 8px;
}

.aps-daily-toolbar-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.aps-daily-filters {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.aps-daily-filter-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
}

.aps-daily-filter-group-single-row {
    width: 100%;
}

.aps-daily-filter {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}

.aps-daily-filter span {
    font-size: 11px;
    color: #6b7280;
}

.aps-daily-filter input {
    height: 26px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 12px;
    color: #111827;
    background-color: #ffffff;
}

.aps-daily-filter input::placeholder {
    color: #9ca3af;
}

.aps-daily-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 180px;
}

.aps-daily-actions-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.aps-daily-actions .btn {
    min-width: 86px;
}

.aps-daily-pagination {
    border-radius: 0 0 8px 8px;
    border-top: none;
}

#apsDailyPagination .btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

#apsDailyPagination .btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* 物料号表中操作按钮：用深色描边的小按钮，避免在白底表格里看不见 */
.material-basic-edit-btn,
.material-route-btn {
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.material-basic-edit-btn:hover,
.material-route-btn:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* “工艺路线”按钮稍微带点绿色底色，方便区分 */
.material-route-btn {
    background-color: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.material-route-btn:hover {
    background-color: #dcfce7;
}

/* ========= 工序产能表紧凑布局 ========= */

/* 工序产能弹窗整体：减小内边距，更侧重表格区域 */
#processCapacityModal .modal-body {
    padding: 16px 20px;
}

/* 说明文字与表格之间的空隙缩小 */
#processCapacityModal .modal-body > p {
    margin-bottom: 6px;
    font-size: 12px;
}

/* 工序产能表使用更紧凑的字号与间距 */
#processCapacityTable.data-table {
    font-size: 11px;
    table-layout: fixed;
    width: 100%;
    min-width: 1100px;
}

#processCapacityTable.data-table thead th,
#processCapacityTable.data-table tbody td {
    padding: 2px 4px;
    white-space: nowrap;
}

/* 列宽大致参考 Excel：工序大类略宽，其余压缩。
   这里将左侧“工序设备数 / 单台日产能 / 总日产能”这一列收窄到更贴近文字宽度，避免遮挡右侧工序列。 */
#processCapacityTable th:nth-child(1),
#processCapacityTable td:nth-child(1) {
    min-width: 70px;
}

#processCapacityTable th:nth-child(2),
#processCapacityTable td:nth-child(2) {
    min-width: 120px;
}

#processCapacityTable th:nth-child(3),
#processCapacityTable td:nth-child(3),
#processCapacityTable th:nth-child(4),
#processCapacityTable td:nth-child(4),
#processCapacityTable th:nth-child(5),
#processCapacityTable td:nth-child(5),
#processCapacityTable th:nth-child(6),
#processCapacityTable td:nth-child(6),
/* “操作”列收窄一点，只放一个按钮 */
#processCapacityTable th:nth-child(7),
#processCapacityTable td:nth-child(7) {
    min-width: 70px;
    text-align: center;
}

/* 工序产能表中“工序名称 + 单位 + 按钮”这一列整体居中 */
.capacity-process-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.capacity-process-unit {
    margin: 0 2px;
}

/* 输入框紧凑，对齐方式与 Excel 一致（数字右对齐）、宽度固定 */
.capacity-input {
    width: 70px;
    padding: 1px 3px;
    font-size: 11px;
    text-align: center;
    box-sizing: border-box;
}

.capacity-total {
    font-weight: 600;
}

/* 工序产能表内按钮采用更小的尺寸，减少占位 */
#processCapacityTable .capacity-edit-btn {
    padding: 3px 8px;
    font-size: 11px;
}

/* 弹窗中的表格区域高度限制，内部滚动，避免占满整屏 */
#processCapacityModal .table-container {
    max-height: 70vh;
}

/* 工序产能矩阵：大类标题、左侧指标列配色，模拟 Excel 模板 */
.capacity-category-row .capacity-category-cell {
    background-color: #ffe699;
    font-weight: 700;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

.capacity-process-header-row .capacity-process-cell {
    background-color: #ffffcc;
    text-align: center;
    vertical-align: bottom;
}

/* 工序名称 + 单位 + 编辑按钮在同一行，节省纵向空间 */
.capacity-process-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.capacity-process-name {
    font-weight: 600;
}

.capacity-process-unit {
    font-size: 11px;
    color: #666;
}

/* 工序产能表“编辑”按钮：高对比度小胶囊样式，容易识别 */
.capacity-process-header .capacity-edit-btn {
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.2;
    margin-left: 4px;
    border-radius: 999px;
    border: 1px solid #f97316;
    background-color: #ffedd5;
    color: #c2410c;
    font-weight: 600;
}

.capacity-process-header .capacity-edit-btn:hover {
    background-color: #fed7aa;
    border-color: #ea580c;
    color: #9a3412;
}

.capacity-label-cell {
    background-color: #fff2cc;
    font-weight: 600;
    text-align: center;
    /* 与第 1 列宽度保持一致，尽量只占据文字需要的宽度 */
    min-width: 70px;
    border-right: 1px solid #e5e7eb;
}

.capacity-label-metric {
    color: #333;
}

.capacity-row.capacity-total-row .capacity-total {
    font-weight: 700;
    color: #c00000;
}

.capacity-spacer-row td {
    height: 4px;
    border: none;
}

/* 每个大类块之间增加浅灰色分隔线，增强层次感 */
.capacity-category-row:first-of-type .capacity-category-cell {
    border-top-width: 0;
}

.capacity-row td,
.capacity-process-header-row td {
    border-bottom: 1px solid #f0f0f0;
}

/* 允许某些单元格换行（如备注） */
.data-table td.cell-wrap {
    white-space: normal;
}

/* 订单表列设置弹窗 */
.column-config-list {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 4px 0;
    background-color: #ffffff;
}

.column-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    cursor: default;
}

.column-config-item:nth-child(odd) {
    background-color: #fafafa;
}

.column-config-item.dragging {
    opacity: 0.6;
}

.column-config-item.selected {
    background-color: #eef2ff !important;
    outline: 2px solid rgba(102, 126, 234, 0.45);
    outline-offset: -2px;
}

/* 工序产能表：显示顺序调整弹窗列表 */
.capacity-order-list {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px 8px;
    background-color: #ffffff;
}

/* ========= 计划数量规则表 ========= */
#planQtyRuleTable .rule-hint {
    color: #555;
    font-size: 12px;
    line-height: 1.35;
}

#planQtyRuleTable .rule-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

#planQtyRuleTable .rule-input {
    width: 100%;
    box-sizing: border-box;
}

#planQtyRuleTable .rule-category-row td {
    background-color: #eef2ff;
    font-weight: 700;
    color: #1e3a8a;
}

.capacity-order-category {
    margin-bottom: 8px;
}

.capacity-order-category-title {
    font-weight: 600;
    font-size: 13px;
    padding: 4px 6px;
    background-color: #fff7cc;
    border-radius: 3px;
    margin-bottom: 4px;
}

.capacity-order-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.capacity-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}

.capacity-order-item:last-child {
    border-bottom: none;
}

.capacity-order-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.capacity-order-item-name {
    font-weight: 600;
}

.capacity-order-item-unit {
    font-size: 11px;
    color: #666;
}

.capacity-order-item-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    min-width: 32px;
    transition: all 0.2s ease;
}

.capacity-order-item-actions .btn:hover:not(:disabled) {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.capacity-order-item-actions .btn:active:not(:disabled) {
    background-color: #e5e7eb;
    transform: translateY(0);
}

.capacity-order-item-actions .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f9fafb;
    color: #9ca3af;
}

.column-config-item-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.column-config-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.column-config-item label {
    cursor: pointer;
}

.column-config-drag-handle {
    cursor: move;
    color: #999;
    font-size: 14px;
    padding-left: 8px;
}

.column-config-delete-btn {
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.column-config-delete-btn:hover {
    color: #b91c1c;
    text-decoration: underline;
}

/* 订单列表默认紧凑：备注不换行，用省略号；全文用 title 提示 */
#orderTable .remark-cell {
    white-space: nowrap;
}

/* 派工列：选择“是”时单元格背景为绿色，文字为白色 */
#orderTable td.dispatch-yes {
    background-color: #22c55e;
    color: #111827;
    font-weight: 600;
}

/* 工序进度列：默认横排，不换行；内容多则在单元格内横向滚动 */
#orderTable td.progress-cell {
    overflow: visible; /* 允许内部滚动条/浮层显示 */
}

/* 表头排序：默认隐藏箭头；点击表头激活后显示；仅点击箭头才排序 */
.data-table th.sortable {
    cursor: default; /* 头部点击只负责激活显示箭头，不直接排序 */
    /* 允许选择复制排序列表头 */
    user-select: text;
}

.data-table th.sortable.sort-active {
    cursor: pointer; /* 提示可点击激活 */
}

.data-table th .sort-arrow {
    display: none; /* 默认隐藏，不占位 */
    border: none;
    background: transparent;
    padding: 0;
    margin-left: 2px; /* 紧挨文字 */
    font-size: 10px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer; /* 只有箭头按钮触发排序 */
    vertical-align: middle; /* 箭头与文字垂直居中 */
}

.data-table th.sort-active .sort-arrow {
    display: inline-block;
}

.data-table th.sorted-asc .sort-arrow,
.data-table th.sorted-desc .sort-arrow {
    color: #111827;
}

/* 列宽拖拽手柄（表头右侧分隔线） */
.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

.col-resizer::before {
    content: "";
    position: absolute;
    right: 3px;
    top: 18%;
    width: 1px;
    height: 64%;
    background: rgba(17, 24, 39, 0.22);
}

.data-table th:hover .col-resizer::before {
    background: rgba(17, 24, 39, 0.38);
}

/* 工序进度（默认横排紧凑） */
.process-progress {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding-bottom: 0; /* 滚动条变细后不需要额外留白 */
    scrollbar-width: thin; /* Firefox：细滚动条 */
    scrollbar-color: rgba(17, 24, 39, 0.35) transparent;
}

/* 工序进度列：用于展示“下一道应进行的工序名称” */
.process-progress .process-current-step {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1;
    color: #111827;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 8px;
}

/* 自定义列“进度/当前工序/下一工序”文本样式：标红显示 */
td.custom-progress-text {
    color: #dc2626;
    font-weight: 500;
}

/* Chrome/Edge：细滚动条（主要影响工序进度这一列） */
.process-progress::-webkit-scrollbar {
    height: 6px;
}
.process-progress::-webkit-scrollbar-track {
    background: transparent;
}
.process-progress::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.28);
    border-radius: 999px;
}
.process-progress::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 24, 39, 0.40);
}

.process-progress .route-arrow {
    font-size: 12px;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.status-badge.pending {
    background-color: #e0e0e0;
    color: #666;
}

.status-badge.in-progress {
    background-color: #2196F3;
    color: white;
}

.status-badge.completed {
    background-color: #4CAF50;
    color: white;
}

.status-badge.ended {
    background-color: #374151;
    color: #fff;
}

/* 工序进度 - 圆形百分比 + 气泡详情 */
.process-circle-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    min-width: 44px; /* 给下方文字留一点空间 */
}

.process-circle {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    /* 使用 CSS 变量控制进度，绘制绿色圆环 */
    --p: 0; /* 进度百分比 0~100，由 JS 设置 */
    background:
        radial-gradient(farthest-side, #ffffff 79%, transparent 80% 100%),
        conic-gradient(#4caf50 calc(var(--p) * 1%), #e0e0e0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.10);
}

.process-circle.pending {
    /* 底色保持灰色圆环，由背景控制，无需额外边框 */
}

.process-circle.in-progress {
    /* 如需区分状态，可在这里叠加小图标或阴影，目前不改变圆环颜色 */
}

.process-circle.completed {
    /* 100% 时圆环自然闭合为整圈绿色 */
}

.process-circle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.process-circle .percent-text {
    font-size: 11px;
    font-weight: 600;
    color: #999;
}

/* 圆圈下方显示工序名（紧凑布局） */
.process-circle-wrapper .process-name {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.1;
    color: #666;
    text-align: center;
    max-width: 56px;
    white-space: normal;
    word-break: break-all;
}

/* 超过 100% 的进度，圆环和百分比文字高亮为红色 */
.process-circle.over-limit {
    background:
        radial-gradient(farthest-side, #ffffff 79%, transparent 80% 100%),
        conic-gradient(#f44336 calc(var(--p) * 1%), #e0e0e0 0);
}

.process-circle.over-limit .percent-text {
    color: #f44336 !important;
}

/* 旧的“绝对定位到圆圈下方”的样式不再需要（工序名已移到 wrapper 下方） */

.process-popover {
    position: absolute;
    z-index: 1200;
    min-width: 260px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    padding: 14px 16px 10px;
    font-size: 13px;
    color: #333;
    display: none;
}

.process-popover.show {
    display: block;
}

.process-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.process-popover-title {
    font-weight: 600;
}

.process-popover-status {
    font-size: 12px;
    color: #999;
}

.process-popover-row {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
}

.process-popover-label {
    color: #888;
}

.process-popover-value {
    font-weight: 500;
}

.process-popover-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 工序气泡里的“报工记录”按钮在白底上需要更明显一些 */
.process-popover-footer .btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

/* 顶部筛选里的“清空”按钮需要在白色背景上更醒目 */
#orderFilterClearBtn.btn-secondary {
    background-color: #ffffff;
    color: #b91c1c;
    border-color: #fecaca;
}

#orderFilterClearBtn.btn-secondary:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    white-space: nowrap;
}

/* 表单提示 */
.form-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.user-avatar-hint {
    margin: 8px 0 4px;
    font-size: 11px;
    color: #9ca3af;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 用户管理（精简表格 + 弹窗） */
.user-mgmt-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.user-mgmt-search {
    flex: 1;
    max-width: 360px;
}
.user-mgmt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}
.user-table thead th {
    text-align: left;
    font-size: 12px;
    letter-spacing: .02em;
    color: #6b7280;
    background: linear-gradient(180deg, #fbfbfd, #f8fafc);
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.user-table tbody td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.user-table tbody tr:hover td {
    background: #fbfdff;
}
.user-cell-title {
    font-weight: 700;
    color: #111827;
}
.user-cell-sub {
    margin-top: 2px;
    font-size: 12px;
    color: #6b7280;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    border: 1px solid transparent;
}
.badge.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.badge.muted {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #4b5563;
}
.badge.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.btn-group {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.btn.btn-ghost {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #111827;
}
.btn.btn-ghost:hover {
    background: #f9fafb;
}
.user-perm-summary {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tag {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.tag.gray {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #e5e7eb;
}
.modal-content.small { max-width: 460px; }
.modal-content.medium { max-width: 720px; }
.user-modal-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
}
.confirm-message {
    color: #111827;
    line-height: 1.6;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 12px;
    border-radius: 12px;
}
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

/* 当物料号数据表最大化时，模态框容器不再居中 */
#materialMasterModal.fullscreen-mode {
    align-items: stretch;
    justify-content: stretch;
}

/* 工艺路线配置弹窗始终盖在其他弹窗之上（例如物料号数据表） */
#routeConfigModal {
    z-index: 1100;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 0;
    border-radius: 8px;
    width: 92%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

.modal-content.large {
    width: 96%;
    max-width: 1400px;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    gap: 16px;
    min-width: 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
}

.route-order-brief {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 10px 14px;
    margin-bottom: 18px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
}

.route-order-brief-item {
    display: flex;
    align-items: center;
    min-width: 180px;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-order-brief-item.full {
    flex: 1 1 100%;
    max-width: 100%;
}

.route-order-brief-item .label {
    color: #6b7280;
    font-weight: 600;
    margin-right: 4px;
}

.route-order-brief-item .value {
    color: #111827;
}

.route-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.config-section h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 16px;
}

.process-list {
    min-height: 220px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    padding: 12px;
    background-color: #fafafa;
}

.process-item {
    background: white;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 5px;
    cursor: move;
    border: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.process-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.process-item.dragging {
    opacity: 0.5;
}

.process-item .remove-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.process-item .remove-btn:hover {
    background: #d32f2f;
}

.sortable .process-item {
    cursor: move;
}

/* ========= 工艺路线配置弹窗专用优化 ========= */

/* 弹窗整体高度限制在视口内，内部滚动，避免整页滚动 */
#routeConfigModal .modal-content {
    max-width: 1100px;
    max-height: 90vh;
}

#routeConfigModal .modal-body {
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* 左右工序列表内部滚动，便于在不滚动页面的情况下录入 */
#routeConfigModal .process-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* 工艺路线右侧显示自动序号（拖拽/新增时自动更新） */
#routeProcesses {
    counter-reset: routeIndex;
}

#routeProcesses .process-item {
    font-size: 13px;
}

#routeProcesses .process-item::before {
    counter-increment: routeIndex;
    content: counter(routeIndex) "、";
    margin-right: 6px;
    color: #999;
}

/* 左侧可用工序列表也显示序号，便于对照 */
#availableProcesses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* 参考工序产能表的大类分组样式，对可用工序做分组展示（只显示工序名称） */
#availableProcesses .available-process-category {
    margin-bottom: 0;
    padding: 8px;
    border: 1px dashed #e5e7eb;
    border-radius: 5px;
    background-color: white;
}

#availableProcesses .available-process-category-header {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 6px;
    margin-bottom: 4px;
    border-radius: 3px;
    background-color: #fff7cc; /* 与工序产能表大类颜色呼应 */
    color: #7c2d12;
}

#availableProcesses .available-process-items {
    display: flex;
    flex-direction: column;
}

#availableProcesses .process-item {
    font-size: 13px;
}

#availableProcesses .process-item::before {
    content: "S" attr(data-process-index) "、";
    margin-right: 6px;
    color: #999;
}

.report-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.report-info p {
    margin-bottom: 10px;
}

.report-info p:last-child {
    margin-bottom: 0;
}

.process-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.process-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

.process-checkbox-item:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.process-checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.process-checkbox-item.completed {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.report-details {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.report-details label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.report-details label span {
    font-weight: 500;
    color: #666;
}

.input-number, .input-datetime, .input-textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

.input-textarea {
    resize: vertical;
}

.history-filters {
    background-color: #e0f7f4;
    padding: 14px 14px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-filter-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 0;
}

.history-filter-row {
    align-items: flex-end;
    width: 100%;
}

.history-filter-row-top {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) minmax(90px, 0.7fr) minmax(150px, 1fr) minmax(180px, 1.2fr);
    gap: 10px;
}

.history-filter-row-bottom {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
}

.history-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.history-filter-group label {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.history-filter-group .search-input,
.history-filter-group .filter-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}

.history-filter-group .filter-select {
    background-color: white;
    cursor: pointer;
}

.history-filter-group-date {
    min-width: 0;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-range-inputs .filter-select {
    flex: 1;
}

.filter-separator {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
}

.history-filter-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    margin-top: 0;
}

.history-filter-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    background-color: transparent;
    color: #0066cc;
    text-decoration: none;
}

.history-filter-actions .btn:hover {
    background-color: rgba(0, 102, 204, 0.1);
}

.history-filter-actions .btn-icon {
    font-size: 16px;
    line-height: 1;
}

.history-filter-actions .btn-text {
    text-decoration: underline;
    color: #0066cc;
}

.history-export-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.history-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #d7e6e3;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 6px;
    min-width: 140px;
    z-index: 10;
}

/* 生产记录表样式：复用报工记录区域风格 */
.daily-production-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 8px 0 12px;
}
.daily-production-section {
    margin-top: 16px;
}

.daily-production-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.daily-production-section-title {
    font-size: 15px;
    font-weight: bold;
}

/* 生产记录表：顶部说明文字 */
.daily-production-subtitle {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}

/* 生产记录表：筛选区域横向紧凑布局 */
.daily-production-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 10px 12px;
    margin: 12px 0 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    align-items: end;
}

.daily-production-filters .daily-filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.daily-production-filters .daily-filter-field label {
    font-size: 12px;
    color: #444;
    margin-bottom: 2px;
}

.daily-production-filters .daily-filter-field .search-input {
    height: 30px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 10px;
}

/* 生产记录表：自适应列数 */
@media (max-width: 1280px) {
    .daily-production-filters { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}
@media (max-width: 900px) {
    .daily-production-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 560px) {
    .daily-production-filters { grid-template-columns: 1fr; }
}

/* 生产记录表：区块卡片化，让内容更聚焦 */
#dailyProductionModal .modal-body {
    padding: 18px 20px 22px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
}

.daily-production-section {
    margin-top: 14px;
    padding: 12px 12px 10px;
    border-radius: 14px;
    border: 1px solid #eef2ff;
    background: #fff;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.06);
}

.daily-production-section-head {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.daily-production-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

/* 顶部右侧控件做“玻璃感”容器，和渐变标题更协调 */
#dailyProductionModal .modal-header-right .history-filter-group-date {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    padding: 6px 10px;
}
#dailyProductionModal .modal-header-right .history-filter-group-date label {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
}
#dailyProductionModal .modal-header-right input[type="date"].filter-select {
    height: 30px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.9);
}

/* 汇总/明细切换做成 pill 组合 */
#dailyProductionModal .daily-production-toggle {
    display: inline-flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
}
#dailyProductionModal .daily-production-toggle .btn {
    border-radius: 0 !important;
    border: none !important;
    height: 30px;
    padding: 0 12px;
}

.history-export-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.history-export-item:hover {
    background: #f2fbf9;
}

@media (max-width: 900px) {
    .history-filter-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .history-filter-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .history-filter-row-top {
        grid-template-columns: 1fr 1fr;
    }
    .history-filter-group-date {
        grid-column: 1 / -1;
    }
    .history-filter-row-bottom {
        grid-template-columns: 1fr;
    }
}

/* 模态框标题右侧的一组操作按钮（批量删除 / 最大化 / 关闭） */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.modal-icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 6px;
    color: #666;
}

.modal-icon-btn:hover {
    background-color: rgba(0,0,0,0.04);
    border-radius: 4px;
}

/* 物料号数据表放大按钮优化 */
.maximize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 18px;
    color: #666;
    transition: all 0.2s ease;
}

.maximize-btn:hover {
    background-color: rgba(0,0,0,0.08);
    color: #333;
}

.maximize-btn .maximize-icon,
.maximize-btn .restore-icon {
    display: inline-block;
    line-height: 1;
}

/* 物料号数据表筛选区域 */
.material-filter-container {
    margin-bottom: 10px;
    padding: 8px 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.material-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.material-filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.material-filter-item label {
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
    font-weight: 500;
}

.material-filter-input {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    min-width: 140px;
    height: 28px;
    transition: border-color 0.2s ease;
}

.material-filter-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 物料号数据表模态框支持拖拽调整大小，并在窗口化时内部可滚动 */
#materialMasterModal .modal-content {
    /* 默认根据内容宽度自适应，整体相对紧凑 */
    width: max-content;
    max-width: 95vw;
    max-height: 90vh;      /* 限制在视口内，高度超过时内部滚动 */
    min-width: 600px;
    min-height: 320px;
    resize: both;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;      /* 垂直滚动交给 body 区域处理 */
}

/* 物料号弹窗内容区：在可用高度内上下滚动 */
#materialMasterModal .modal-body {
    flex: 1 1 auto;
    padding: 16px 24px;
    overflow-y: auto;
}

/* 物料号数据表模态框最大化铺满屏幕 */
#materialMasterModal .modal-content.fullscreen {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    border-radius: 0;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    resize: none;
}

/* 最大化时，模态框容器也需要调整 */
#materialMasterModal.show .modal-content.fullscreen {
    align-self: stretch;
    justify-self: stretch;
}

/* 新版报工表单布局 */
.report-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-row {
    display: flex;
    gap: 16px;
}

.report-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.report-label span {
    color: #666;
    font-weight: 500;
}

/* 只针对报工人员和报工数这一行的对齐优化 */
.report-row-two-fields .report-label span {
    min-width: 80px;
    display: inline-block;
}

.report-label.full {
    flex: 1 1 100%;
}

.report-label-with-action {
    position: relative;
}

.report-label-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.report-label-header .btn-edit {
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    background-color: #667eea;
    color: white;
    border: 1px solid #667eea;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    height: auto;
}

.report-label-header .btn-edit:hover {
    background-color: #5568d3;
    border-color: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.report-label-header .btn-edit:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

/* 保存状态样式 */
.report-label-header .btn-edit.btn-save {
    background-color: #10b981;
    border-color: #10b981;
}

.report-label-header .btn-edit.btn-save:hover {
    background-color: #059669;
    border-color: #059669;
}

/* 报工表单 - 时间与备注可折叠区域 */
.report-advanced-wrapper {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
}

.report-advanced-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.report-advanced-title {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.report-advanced-toggle {
    padding: 4px 12px;
    font-size: 12px;
    background-color: #667eea !important;
    color: #ffffff !important;
    border: 1px solid #5568d3 !important;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
}

.report-advanced-toggle:hover {
    background-color: #5568d3 !important;
    border-color: #4c5bc8 !important;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.report-advanced-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.3);
}

.report-advanced-body.collapsed {
    display: none;
}

.report-input {
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #fff;
}

.report-input:disabled {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

.report-input:not(:disabled):focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
    background-color: #fff;
}

.report-label-with-action .report-input:not(:disabled) {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.report-label-with-action .report-input:not(:disabled):focus {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16,185,129,0.15);
    background-color: #fff;
}

.report-input.small {
    width: 260px;
}


.report-textarea {
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.report-radio-group {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fafafa;
}

.report-radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.report-duration {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* 可用工序管理 */
.process-manage-header {
    display: none; /* 旧的输入行已取消，不再展示 */
}

.process-manage-list {
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fafafa;
    max-height: 360px;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: minmax(80px, auto);
    gap: 12px;
}

.process-manage-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 12px 8px;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.process-manage-item:last-child {
    border-bottom: 1px solid #eee;
}

.process-manage-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.process-manage-actions .btn-secondary {
    /* 在白底列表中使用深色描边的小按钮，避免看不见 */
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
    padding: 4px 10px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.process-manage-actions .btn-secondary:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* 工序新增/编辑 & 删除确认弹窗 */
.modal-content.small {
    width: 360px;
    max-width: 90vw;
}

.process-edit-form {
    margin-bottom: 12px;
}

.process-edit-form .edit-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.process-edit-form .edit-input {
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 13px;
}

.process-edit-form .edit-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.18);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.confirm-message {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
}

.process-manage-tip {
    margin-top: 12px;
    font-size: 12px;
    color: #888;
}

.route-display {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.route-arrow {
    color: #999;
    font-size: 14px;
}

.action-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    margin-right: 10px;
    font-weight: 500;
}

.action-link:hover {
    text-decoration: underline;
}

.action-link.danger {
    color: #f44336;
}

/* 订单行"操作"按钮 */
.actions-cell {
    text-align: center;
    overflow: visible !important; /* 允许下拉菜单显示，不被裁剪 */
    position: relative; /* 为下拉菜单提供定位上下文 */
}

/* 订单操作按钮包装器 */
.order-action-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 订单操作按钮（与报工记录样式一致） */
.order-action-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #667eea;
    border-radius: 4px;
    background: #667eea;
    color: #ffffff;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
    min-width: 70px;
}

/* 行拖拽排序手柄：显示在操作按钮右侧，仅通过该手柄拖动行 */
.row-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 24px;
    margin-left: 2px;
    padding: 0 2px;
    border-radius: 4px;
    cursor: grab;
    color: #9ca3af;
    font-size: 14px;
    user-select: none;
}

.row-drag-handle:hover {
    background-color: #e5e7eb;
    color: #4b5563;
}

.row-drag-handle:active {
    cursor: grabbing;
    background-color: #d1d5db;
}

.order-action-toggle:hover {
    background: #5568d3;
    border-color: #4c5bc8;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.order-action-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.3);
}

/* 兼容旧的 row-action-btn 类 */
.row-action-btn {
    min-width: 70px;
    padding: 4px 10px;
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.row-action-btn:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.row-action-btn.active {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37,99,235,0.45);
}

/* 订单操作按钮下拉菜单（与报工记录样式一致） */
.order-action-buttons {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #ffffff;
    border: 2px solid #667eea;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25), 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10000; /* 提高z-index，确保在拖拽排序时也不被遮挡 */
    min-width: 90px;
}

.order-action-buttons .btn {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    text-align: left;
    width: 100%;
    border: none;
    background: #ffffff;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.order-action-buttons .btn:hover {
    background: #f0f4ff;
    color: #667eea;
}

.order-action-buttons .btn:active {
    background: #e0e8ff;
    transform: scale(0.98);
}

/* 行操作弹窗：沿用 process-popover 外观，仅适当收窄宽度，按钮内容居中（保留兼容性） */
.action-popover {
    min-width: auto;
    padding: 8px 10px;
    text-align: center;
    display: inline-block;
}

.action-popover-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0;
    align-items: center;
}

.action-popover-actions .btn {
    width: auto;
    padding: 4px 12px;
    font-size: 12px;
}

/* 行操作弹窗里的次要按钮在白底上需要更明显一些 */
.action-popover-actions .btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* 行操作弹窗中，被点选的操作按钮高亮为蓝色 */
.action-popover-actions .btn-active {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* 订单编辑表单样式（复用报工表单的视觉风格） */
.edit-order-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-order-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.edit-label {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 180px;
    font-size: 13px;
}

.edit-label span {
    margin-bottom: 4px;
    color: #4b5563;
}

.edit-input,
.edit-textarea {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.edit-textarea {
    resize: vertical;
}

.edit-label.full {
    flex: 1 1 100%;
}

.edit-order-footer-row {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .route-config {
        grid-template-columns: 1fr;
    }

    .route-order-brief-item {
        max-width: 100%;
    }
    
    .filter-section {
        flex-direction: column;
    }
    
    .process-checkboxes {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
    }

    .report-row {
        flex-direction: column;
    }
}

/* ========= Toast 通知样式 ========= */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px 32px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastFadeIn 0.3s ease-out;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.5;
}

@keyframes toastFadeIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

.toast.hiding {
    animation: toastFadeOut 0.3s ease-in forwards;
}

/* 报工记录表格中作废记录显示为红色字体 */
.history-row-canceled {
    color: #f44336 !important;
}

.history-row-canceled td {
    color: #f44336 !important;
}

/* 报工记录表格容器 - 可调整大小 */
.resizable-table-container {
    position: relative;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 400px;
    min-height: 200px;
    max-width: 100%;
    max-height: 80vh;
}

.resizable-table-container .data-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

/* 默认列样式：完整显示内容，不截断 */
.resizable-table-container .data-table th,
.resizable-table-container .data-table td {
    white-space: nowrap;
    overflow: visible;
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    text-overflow: clip;
}

/* 不良品项列允许换行显示并居中对齐 */
.resizable-table-container .data-table .bad-item-cell,
.data-table .bad-item-cell,
#historyTableBody .bad-item-cell {
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-all;
    max-width: 200px;
    min-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center !important;
    vertical-align: middle !important;
    padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
    line-height: 1.5em;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: linear-gradient(-45deg, transparent 30%, #999 30%, #999 35%, transparent 35%, transparent 65%, #999 65%, #999 70%, transparent 70%);
    cursor: nwse-resize;
    z-index: 10;
}

.resize-handle:hover {
    background: linear-gradient(-45deg, transparent 30%, #666 30%, #666 35%, transparent 35%, transparent 65%, #666 65%, #666 70%, transparent 70%);
}

/* 报工记录操作列样式 */
.history-action-wrapper {
    position: relative;
    display: inline-block;
}

.history-action-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #667eea;
    border-radius: 4px;
    background: #667eea;
    color: #ffffff;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
}

.history-action-toggle:hover {
    background: #5568d3;
    border-color: #4c5bc8;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.history-action-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.3);
}

.action-toggle-text {
    margin-right: 2px;
}

.action-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
    line-height: 1;
}

.history-action-buttons {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #ffffff;
    border: 2px solid #667eea;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25), 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 90px;
}

.history-action-buttons .btn {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    text-align: left;
    width: 100%;
    border: none;
    background: #ffffff;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.history-action-buttons .btn:hover {
    background: #667eea;
    color: #ffffff;
    transform: translateX(2px);
}

/* ===================== KPI总览区域 ===================== */
.kpi-overview {
    background: white;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.kpi-value.kpi-value-success {
    color: #10b981;
}

.kpi-value.kpi-value-warning {
    color: #f59e0b;
}

.kpi-value.kpi-value-danger {
    color: #ef4444;
}

.kpi-desc {
    font-size: 12px;
    color: #9ca3af;
}

.kpi-expanded-views {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    margin-top: 16px;
}

.kpi-view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.kpi-view-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.kpi-view-tab:hover {
    color: #111827;
}

.kpi-view-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.kpi-view-panel {
    display: none;
    min-height: 180px;
}

.kpi-view-panel.active {
    display: block;
}

/* 日历热力图 */
.kpi-calendar-heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 压缩标题区域高度，为日历网格腾出更多垂直空间 */
    margin-bottom: 6px;
    font-size: 13px;
    color: #374151;
}

.kpi-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    /* 星期标题行更紧凑 */
    margin-bottom: 4px;
}

.kpi-calendar-weekdays > div {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.kpi-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* 缩小单元格之间的间距 */
    /* 占满右侧可用高度，行高按可用空间等比分配，确保 4～6 行都被“塞”进容器 */
    flex: 1;
    align-content: stretch;
    grid-auto-rows: 1fr; /* 每一行高度一致，自动瓜分容器高度 */
}

/* KPI 日历视图整体布局：左侧工序列表 + 右侧日历热力图 */
#kpiCalendarHeatmap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 24px;
    border-radius: 14px;
    background: radial-gradient(circle at top left, #eef2ff 0, #f9fafb 50%, #ffffff 100%);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    box-sizing: border-box;
}

.kpi-calendar-layout {
    display: flex;
    align-items: stretch;
    gap: 18px;
}

.kpi-calendar-sidebar {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kpi-calendar-main {
    flex: 1;
    min-width: 0;
    /* 让右侧日历区域内部可以用 flex 填满高度，从而刚好一屏显示一个整月 */
    display: flex;
    flex-direction: column;
    /* 适当减小整体高度，让每一行格子稍微矮一点 */
    height: calc(100vh - 300px);
    min-height: 0;
}

.kpi-calendar-summary-card {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.65);
    padding: 12px 14px;
    background: linear-gradient(135deg, #f9fafb, #eef2ff);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, transform 0.15s;
}

.kpi-calendar-summary-card:hover {
    border-color: #4f46e5;
    box-shadow: 0 10px 22px rgba(129, 140, 248, 0.45);
    transform: translateY(-2px);
}

.kpi-calendar-summary-card.active {
    border-color: #4338ca;
    background: linear-gradient(135deg, #e0e7ff, #eef2ff);
}

.kpi-calendar-summary-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.kpi-calendar-summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #4b5563;
    margin-top: 2px;
}

.kpi-calendar-summary-value {
    font-weight: 600;
    color: #111827;
}

.kpi-calendar-process-list {
    max-height: none;
    /* 与右侧日历主区域保持同样高度，保证上下对齐 */
    height: calc(100vh - 300px);
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(209, 213, 219, 0.9);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}

.kpi-calendar-process-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 10px;
    font-size: 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.kpi-calendar-process-row:last-child {
    border-bottom: none;
}

.kpi-calendar-process-row:hover {
    background-color: #f3f4ff;
    transform: translateY(-1px);
}

.kpi-calendar-process-row.active {
    background-color: #e0e7ff;
    box-shadow: inset 3px 0 0 #4f46e5;
}

.kpi-calendar-process-row-main {
    flex: 1;
    min-width: 0;
}

.kpi-calendar-process-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.kpi-calendar-process-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #4b5563;
}

.kpi-calendar-process-cap {
    text-align: right;
    min-width: 130px;
    color: #4b5563;
}

.kpi-calendar-process-cap > div {
    white-space: nowrap;
}

.kpi-calendar-empty-tip {
    padding: 10px;
    font-size: 12px;
    color: #6b7280;
}

.kpi-calendar-cell {
    /* 不再用固定宽高比，让单元格跟随 grid 行高自适应收缩，保证 31 天全部挤进红框区域 */
    min-height: 0;
    /* 缩小内部留白，让格子视觉高度更矮一点 */
    padding: 1px 0;
    border: 1px solid rgba(209, 213, 219, 0.9);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.kpi-calendar-cell:hover {
    border-color: #4f46e5;
    transform: translateY(-1px) scale(1.02);
}

.kpi-calendar-cell.level-0 {
    background: #f3f4f6;
}

.kpi-calendar-cell.level-1 {
    background: #dbeafe;
}

.kpi-calendar-cell.level-2 {
    background: #93c5fd;
}

.kpi-calendar-cell.level-3 {
    background: #60a5fa;
}

.kpi-calendar-cell.level-4 {
    background: radial-gradient(circle at 20% 0, #bfdbfe, #2563eb);
}

.kpi-calendar-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.kpi-calendar-day {
    font-size: 12px;
    color: #111827; /* 提高文字对比度 */
    font-weight: 600;
}

.kpi-calendar-value {
    font-size: 11px;
    color: #111827; /* 数值文字也用高对比度颜色 */
}

/* 订单达成看板 */
.kpi-order-board-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.kpi-order-board-stat {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
}

.kpi-order-board-stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.kpi-order-board-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.kpi-order-board-progress {
    margin-bottom: 16px;
}

.kpi-order-board-progress-bar {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.kpi-order-board-progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    transition: width 0.3s ease;
}

.kpi-order-board-progress-text {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

.kpi-order-board-risk-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.kpi-order-board-risk-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-order-risk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
}

.kpi-order-risk-main {
    flex: 1;
}

.kpi-order-risk-main > div:first-child {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.kpi-order-risk-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kpi-tag {
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 4px;
    font-size: 11px;
    color: #374151;
}

.kpi-tag-warning {
    background: #fef3c7;
    color: #92400e;
}

.kpi-order-risk-qty {
    font-size: 14px;
    font-weight: 600;
    color: #ef4444;
}

/* 工序负荷看板 */
.kpi-process-load-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.kpi-process-load-seg {
    display: inline-flex;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    background: #ffffff;
}

.kpi-process-load-mode-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kpi-process-load-mode-btn:hover {
    color: #111827;
    background: #f8fafc;
}

.kpi-process-load-mode-btn.active {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.kpi-process-load-range {
    font-size: 12px;
    color: #6b7280;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-process-load-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 8px;
}

.kpi-process-load-name {
    min-width: 120px;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
}

.kpi-process-load-bar {
    flex: 1;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.kpi-process-load-bar-inner {
    height: 100%;
    transition: width 0.3s ease;
}

.kpi-process-load-bar-inner.safe {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.kpi-process-load-bar-inner.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.kpi-process-load-bar-inner.danger {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

.kpi-process-load-bar-inner.none {
    background: #cbd5e1;
}

.kpi-process-load-value {
    min-width: 60px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

/* ===================== 登录与权限管理（新增） ===================== */
.header-divider{
    width: 1px;
    height: 22px;
    background: rgba(0,0,0,0.12);
    display: inline-block;
    margin: 0 6px;
    align-self: center;
}


.login-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 16px;
}
.login-overlay.show{ display:flex; }
.login-panel{
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.25);
    padding: 18px 18px 16px;
    border: 1px solid rgba(102,126,234,0.18);
}
.login-title{
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}
.login-subtitle{
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 12px;
    line-height: 1.6;
}
.login-form{ display:flex; flex-direction:column; gap:10px; }
.login-label{ display:flex; flex-direction:column; gap:6px; font-size:12px; color:#374151; }
.login-input{
    height: 38px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    background: #fff;
}
.login-input:focus{
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.login-actions{ margin-top: 6px; display:flex; justify-content:flex-end; }
.login-hint{ min-height: 18px; font-size: 12px; color: #b91c1c; }

.user-mgmt-list{ display:flex; flex-direction:column; gap:10px; }
.user-card{
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
}
.user-card-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.user-card-title{ font-weight:700; color:#111827; }
.user-card-meta{ font-size:12px; color:#6b7280; }
.user-card-actions{ display:flex; gap:6px; flex-wrap:wrap; }
.perm-grid{
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 12px;
}
.perm-item{ display:flex; align-items:center; gap:6px; font-size:12px; color:#374151; }
.perm-item input{ transform: translateY(0.5px); }

/* ===================== 悬浮筛选窗 ===================== */
.floating-filter-window {
    position: fixed;
    top: 120px;
    right: 20px;
    width: 320px;
    min-width: 280px;
    max-width: 600px;
    min-height: 200px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    user-select: none;
}

.floating-filter-window.minimized {
    height: auto !important;
}

.floating-filter-window.minimized .floating-filter-body {
    display: block !important;
    padding: 10px 14px;
}

.floating-filter-window.minimized .floating-filter-row {
    display: none;
}

.floating-filter-window.minimized .floating-filter-row:first-child,
.floating-filter-window.minimized .floating-filter-row:nth-child(2) {
    display: flex;
}

.floating-filter-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    flex-shrink: 0;
}

.floating-filter-title {
    font-size: 14px;
    font-weight: 600;
}

.floating-filter-actions {
    display: flex;
    gap: 6px;
}

.floating-filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
}

.floating-filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.floating-filter-clear-btn {
    font-size: 12px !important;
    padding: 0 10px !important;
    width: auto !important;
    min-width: 50px;
}

.floating-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    min-height: 150px;
}

.floating-filter-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.floating-filter-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.floating-filter-row label {
    font-size: 12px;
    color: #374151;
    font-weight: 500;
}

.floating-filter-input,
.floating-filter-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    background: #ffffff;
    transition: border-color 0.2s;
}

.floating-filter-input:focus,
.floating-filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.floating-filter-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.floating-filter-actions-row .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

.floating-filter-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 0%, transparent 40%, #d1d5db 40%, #d1d5db 50%, transparent 50%, transparent 60%, #d1d5db 60%, #d1d5db 100%);
    background-size: 8px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.floating-filter-resize-handle:hover {
    opacity: 1;
}

.floating-filter-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 998;
    transition: transform 0.2s, box-shadow 0.2s;
}

.floating-filter-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.floating-filter-toggle-btn:active {
    transform: scale(0.95);
}

/* 任务单派发样式 */
.task-dispatch-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.task-dispatch-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9fafb;
    border-radius: 6px;
}

.task-dispatch-filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.task-dispatch-filter-label span {
    white-space: nowrap;
    color: #374151;
    font-weight: 500;
}

.task-dispatch-filter-label .filter-select,
.task-dispatch-filter-label .edit-input {
    min-width: 150px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.task-dispatch-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.task-dispatch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background-color: white;
}

.task-dispatch-table thead {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 10;
}

.task-dispatch-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    white-space: nowrap;
}

.task-dispatch-table .color-subheader th {
    background-color: #e8e8e8;
    font-size: 12px;
    padding: 6px 8px;
    font-weight: 500;
}

.task-dispatch-table td {
    padding: 8px;
    border: 1px solid #e5e7eb;
    text-align: left;
    color: #111827;
}

.task-dispatch-table tbody tr:hover {
    background-color: #f9fafb;
}

.task-dispatch-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.task-dispatch-table tbody tr:nth-child(even):hover {
    background-color: #f3f4f6;
}

.task-dispatch-edit-input {
    width: 100%;
    border: 1px solid #3b82f6 !important;
    border-radius: 3px;
    padding: 4px 6px !important;
    font-size: 13px;
    background-color: #eff6ff;
    transition: all 0.2s;
}

.task-dispatch-edit-input:focus {
    outline: none;
    border-color: #2563eb !important;
    background-color: #dbeafe;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.task-dispatch-table td:has(.task-dispatch-edit-input) {
    padding: 2px !important;
}

