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

body {
    font-family: -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    color: #2c3e50;
    background: #f4f6f9;
    font-size: 14px;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    transition: opacity .15s, background .15s;
}
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:not(:disabled):hover { background: #2f6fd6; }
.btn-success { background: #22a06b; color: #fff; }
.btn-success:not(:disabled):hover { background: #1c8459; }
.btn-default { background: #fff; border-color: #cbd5e1; color: #334155; }
.btn-default:not(:disabled):hover { background: #f1f5f9; }
.btn-text { background: transparent; color: #fff; padding: 6px 10px; }
.btn-text:hover { text-decoration: underline; }
.btn-block { width: 100%; margin-top: 8px; }

.em { color: #e11d48; font-weight: 700; }

/* ============ 登录页 ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 380px;
    background: #fff;
    border-radius: 10px;
    padding: 32px 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}
.login-title { text-align: center; margin-bottom: 22px; font-weight: 600; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; color: #475569; }
.form-row input[type="text"],
.form-row input[type="password"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
}
.captcha-line { display: flex; gap: 10px; align-items: stretch; }
.captcha-line input { flex: 1; }
.captcha-img {
    width: 120px;
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
}
.login-error { color: #e11d48; margin: 4px 0 8px; min-height: 18px; }

/* ============ 处理页 ============ */
.topbar {
    height: 52px;
    background: #1e293b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.brand { font-weight: 600; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.op-name { color: #cbd5e1; }

.work-body {
    display: flex;
    gap: 16px;
    padding: 16px;
    align-items: flex-start;
}
.left-pane { flex: 1 1 0; min-width: 0; }
.right-pane {
    width: 340px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    position: sticky;
    top: 16px;
}

.block {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.block-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef2f7;
}
.field { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label { width: 64px; color: #475569; flex-shrink: 0; }
.field-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}
select.field-input { cursor: pointer; }

.doc-name { margin-top: 10px; color: #0f766e; }
.hint { margin-left: 12px; color: #64748b; }
.empty-tip { color: #94a3b8; padding: 8px 0; }
.hidden-file { display: none; }

/* tooltip */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap .tip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    z-index: 20;
    pointer-events: none;
}
.tooltip-wrap .tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}
.tooltip-wrap:hover .tip { display: block; }
.tooltip-wrap .tip .em { color: #fb7185; font-weight: 700; }

/* ============ 图片展示区 ============ */
.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.image-cell {
    position: relative;
    border: 1px solid #eef2f7;
    border-radius: 6px;
    padding: 8px;
    background: #fafbfc;
}
.img-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(225, 29, 72, .9);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    z-index: 2;
}
.img-del:hover {
    background: #e11d48;
}
.thumb {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 4px;
    cursor: zoom-in;
}
.cat-checks {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    max-height: 110px;
    overflow-y: auto;
}
/* 一键批量操作栏 */
.batch-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.batch-label { font-weight: 600; color: #334155; }
.batch-actions {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-text-dark { background: transparent; color: #64748b; }
.btn-text-dark:hover { color: #334155; text-decoration: underline; }
.cat-check {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    font-size: 12px;
}
.cat-check span.checked { color: #22a06b; font-weight: 600; }
.cat-check span.checked::before { content: '\2714 '; }

/* ============ 右侧分组 ============ */
.cat-group { margin-bottom: 16px; }
.cat-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.cat-group-name { font-weight: 600; }
.cat-group-count {
    background: #3b82f6;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
}
.cat-group-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: zoom-in;
}

/* ============ 已删除图片区 ============ */
.deleted-area {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}
.deleted-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.deleted-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.deleted-cell .mini-thumb { opacity: .6; }
.btn-restore {
    border: none;
    border-radius: 3px;
    background: #22a06b;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
}
.btn-restore:hover { background: #1c8459; }

/* ============ 弹窗 ============ */
.modal-mask, .preview-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-box {
    width: 360px;
    background: #fff;
    border-radius: 8px;
    padding: 22px 22px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
.modal-content { font-size: 15px; line-height: 1.6; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.preview-mask { cursor: zoom-out; }
.preview-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}

@media (max-width: 1100px) {
    .image-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .work-body { flex-direction: column; }
    .right-pane { width: 100%; position: static; }
    .image-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 顶部导航 tab ============ */
.topbar-nav { display: flex; gap: 4px; margin-left: 28px; flex: 1; }
.nav-tab {
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.nav-tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-tab.active { color: #fff; background: #3b82f6; }

/* ============ 产品列表 ============ */
.products-body { padding: 16px 20px; }
.products-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.products-search { display: flex; align-items: center; }
.products-search input {
    width: 240px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}
.search-btn {
    padding: 8px 14px;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 15px;
}
.search-btn:hover { background: #2563eb; }

.product-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.product-table th, .product-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    font-size: 14px;
}
.product-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}
.product-table tbody tr:hover { background: #f9fafb; }
.table-empty { text-align: center; color: #94a3b8; padding: 30px 0; }
.cell-empty { color: #cbd5e1; }
.cell-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: zoom-in;
    background: #fff;
}
.album-thumbs { display: flex; flex-wrap: wrap; gap: 6px; max-width: 220px; }

/* 关联品类单元格 + 彩色圆角按钮 */
.cat-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    cursor: pointer;
    min-width: 120px;
    min-height: 24px;
    align-items: center;
}
.cat-cell:hover { outline: 1px dashed #cbd5e1; outline-offset: 2px; border-radius: 4px; }
.cat-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
}
.cat-empty { color: #94a3b8; font-size: 13px; }

/* 分页 */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px 0;
}
.pager-info { color: #475569; font-size: 14px; }

/* 品类编辑弹窗 */
.cat-modal-box {
    width: 420px;
    max-width: 92vw;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
.cat-modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.cat-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 16px;
}
.cat-modal-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cat-modal-name { font-size: 14px; }

/* ============ 产品管理页面 ============ */
.pm-container {
    display: flex;
    height: calc(100vh - 60px);
    background: #f4f6f9;
}

/* 左侧工厂列表 */
.pm-left-pane {
    width: 20%;
    min-width: 250px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.pm-left-header {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.pm-left-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #1e293b;
}

.pm-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.pm-search-box {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
}

.pm-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.pm-filters {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.pm-filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.pm-filter-item input[type="checkbox"] {
    cursor: pointer;
}

.pm-factory-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.pm-factory-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.pm-factory-item:hover {
    background: #f1f5f9;
}

.pm-factory-item.active {
    background: #eff6ff;
}

.pm-factory-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e293b;
}

.pm-factory-item.active .pm-factory-name {
    color: #3b82f6;
}

.pm-factory-stats {
    font-size: 11px;
    color: #64748b;
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.pm-stat-item {
    display: flex;
    align-items: center;
}

.pm-stat-total {
    color: #22c55e;
}

.pm-stat-nocategory {
    color: #ef4444;
}

.pm-stat-nomodel {
    color: #64748b;
}

/* 右侧主区域 */
.pm-right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 查询区 */
.pm-query-section {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.pm-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

.pm-query-container {
    display: flex;
    gap: 20px;
}

.pm-query-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pm-query-row {
    display: grid;
    /* minmax(0, 1fr) 而非 1fr: 1fr 等价 minmax(auto, 1fr), 列的最小宽度由内容决定,
       内容宽的列会更宽 —— 上下两行的列就对不齐。0 强制三列严格等宽。 */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.pm-query-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* 标签与输入框左右结构 */
.pm-query-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    /* grid 项的 min-width 默认 auto —— 由内容撑开。
       设为 0 让父网格的 1fr 能强制均分，否则内容宽的列会更宽，上下两行就错位。 */
    min-width: 0;
}

.pm-query-label {
    width: 72px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
    color: #475569;
}

.pm-query-input,
.pm-query-select {
    flex: 1;
    /* flex 项默认 min-width:auto, 内容会把输入框顶宽、撑破网格列 */
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
}

.pm-query-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* 查询贴左侧区域顶部, 重置贴左侧区域底部 */
    justify-content: space-between;
    flex-shrink: 0;
}

/* 操作区 */
.pm-actions-section {
    background: #fff;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.pm-actions-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.pm-dropdown {
    position: relative;
    display: inline-block;
}

.pm-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 120px;
    z-index: 100;
}

.pm-dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    transition: background 0.15s;
}

.pm-dropdown-item:hover {
    background: #f1f5f9;
}

.pm-dropdown-item:first-child {
    border-radius: 4px 4px 0 0;
}

.pm-dropdown-item:last-child {
    border-radius: 0 0 4px 4px;
}

.pm-dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background: #e2e8f0;
}

/* 表格区 */
/* 表格区: 表头 sticky 的滚动容器。
   顶部不留 padding —— 内容会滚动穿过 padding-top 区域, 若留白会在表头上方露出行。 */
.pm-table-section {
    flex: 1;
    overflow: auto;
    background: #fff;
    padding: 0 20px 20px;
}

.pm-product-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: auto;
}

.pm-product-table thead {
    background: #f1f5f9;
}

/* 表头固定在滚动容器(.pm-table-section)顶部。
   sticky 必须加在 th 上(加在 thead/tr 上部分浏览器无效);
   背景必须不透明 + z-index 高于 tbody, 否则滚动的行会透过/盖住表头。
   border-collapse: collapse 下 sticky 单元格的边框不跟随, 故用 box-shadow 画分隔线。 */
.pm-product-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    box-shadow: inset 0 -2px 0 #e2e8f0;
    white-space: nowrap;
}

.pm-product-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.pm-product-table td.pm-nowrap {
    white-space: nowrap;
}

.pm-product-table tbody tr:hover {
    background: #f8fafc;
}

.pm-product-table tbody tr.pm-sku-row {
    background: #fef3c7;
}

.pm-product-table tbody tr.pm-sku-row:hover {
    background: #fde68a;
}

.pm-table-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    font-size: 13px;
}

.pm-table-select {
    width: 100%;
    min-width: 100px;
    padding: 4px 24px 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    font-size: 13px;
}

.pm-thumb-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.pm-sku-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #fff;
    color: #f97316;
    border: 2px solid #f97316;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.pm-detail-images {
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}

/* 缩略图不被压缩，保证横向排列 */
.pm-detail-images > .pm-thumb-img,
.pm-detail-images > .pm-detail-thumb {
    flex: 0 0 auto;
}

/* 编辑态：最多8张，允许换行 */
.pm-detail-images-edit {
    flex-wrap: wrap;
    max-width: 208px;
}

.pm-more-images {
    font-size: 12px;
    color: #f97316;
    font-weight: 500;
}

.pm-ops {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
}

.pm-op-link {
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
    font-size: 14px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.pm-op-link:hover {
    opacity: 0.7;
}

.pm-op-save { color: #3b82f6; }
.pm-op-cancel { color: #1e293b; }
.pm-op-addsku { color: #f97316; }
.pm-op-main { color: #f97316; }
.pm-op-edit { color: #3b82f6; }
.pm-op-delete { color: #ef4444; }

.pm-empty-tip {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 16px;
}

/* 分页 */
.pm-pagination {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.pm-page-info {
    color: #64748b;
    font-size: 14px;
}

.pm-page-size-select {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.pm-page-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pm-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.pm-page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.pm-page-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.pm-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.pm-page-ellipsis {
    padding: 0 4px;
    color: #94a3b8;
}

.pm-goto-page {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 14px;
    color: #64748b;
}

.pm-goto-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}

/* 列表字段配置弹窗样式 */
.pm-modal-medium {
    width: 90%;
    max-width: 600px;
}

.pm-field-config-body {
    padding: 20px 24px;
    max-height: 500px;
    overflow-y: auto;
}

.pm-field-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pm-field-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    transition: background 0.15s;
}

.pm-field-item:hover {
    background: #f1f5f9;
}

.pm-field-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.pm-field-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pm-checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pm-checkbox-box.checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.pm-checkbox-box.checked::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.pm-checkbox-box.disabled {
    background: #e2e8f0;
    border-color: #cbd5e1;
    cursor: not-allowed;
}

.pm-checkbox-box.disabled.checked {
    background: #cbd5e1;
    border-color: #94a3b8;
}

.pm-checkbox-box.disabled.checked::after {
    color: #64748b;
}

.pm-field-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s;
}

.pm-field-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.pm-field-input.pm-field-readonly {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.pm-field-add {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.btn-link {
    background: transparent;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    transition: color 0.15s;
}

.btn-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* AI文件导入页面样式 */
.ai-import-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.ai-import-container h1 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 24px;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 32px;
}

.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-dropzone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-dropzone.drag-over {
    border-color: #3b82f6;
    background: #dbeafe;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-text p {
    margin: 8px 0;
    color: #475569;
    font-size: 14px;
}

.upload-hint {
    font-size: 12px;
    color: #94a3b8;
}

.upload-progress {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    color: #64748b;
}

/* 筛选区域 */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: #475569;
}

.filter-group select {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
}

.btn-refresh {
    padding: 8px 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #2563eb;
}

/* 记录列表 */
.records-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table thead {
    background: #f1f5f9;
}

.records-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #334155;
    font-size: 14px;
    border-bottom: 2px solid #e2e8f0;
}

.records-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #475569;
}

.records-table tbody tr:hover {
    background: #f8fafc;
}

.empty-msg {
    text-align: center;
    padding: 48px;
    color: #94a3b8;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-0 {
    background: #fef3c7;
    color: #d97706;
}

.status-1 {
    background: #d1fae5;
    color: #059669;
}

.status-2 {
    background: #fee2e2;
    color: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    margin-right: 4px;
}

.btn-view {
    background: #eff6ff;
    color: #3b82f6;
}

.btn-view:hover:not(:disabled) {
    background: #dbeafe;
}

.btn-view:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fecaca;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.pagination button {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    font-size: 14px;
    color: #64748b;
}

/* 详情弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 18px;
    color: #1e293b;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-body h3 {
    font-size: 16px;
    color: #334155;
    margin: 24px 0 12px 0;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.detail-info {
    background: #f8fafc;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.detail-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #475569;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    background: #f8fafc;
}

.product-item h4 {
    font-size: 15px;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.product-attributes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.attr-item {
    font-size: 13px;
    color: #475569;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
}

.attr-key {
    font-weight: 600;
    color: #334155;
}

.attr-value {
    color: #64748b;
}

.text-preview {
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 4px;
    border-left: 3px solid #3b82f6;
}

.text-preview strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #334155;
}

.text-preview p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* 产品图片展示 */
.product-images {
    margin-top: 16px;
}

.product-images h5 {
    font-size: 14px;
    color: #334155;
    margin: 0 0 12px 0;
}

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.image-item {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-type-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
}

.confidence-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    font-size: 13px;
    color: #334155;
}

/* ============ 工厂列表分页 ============ */
.pm-factory-pagination {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.pm-factory-page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pm-factory-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.pm-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}

.pm-page-btn:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
}

.pm-page-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.pm-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #f3f4f6;
}

.pm-page-ellipsis {
    padding: 0 4px;
    color: #9ca3af;
}

.pm-page-info {
    color: #6b7280;
    font-size: 12px;
}

/* ============ 批量操作弹窗 ============ */
.pm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pm-modal {
    background: #fff;
    border-radius: 8px;
    width: 500px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.pm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.pm-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.pm-modal-close {
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color .2s;
}

.pm-modal-close:hover {
    color: #374151;
}

.pm-modal-body {
    padding: 20px;
}

.pm-modal-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #1e40af;
    font-size: 14px;
}

.pm-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.pm-modal-field {
    margin-bottom: 16px;
}

.pm-modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.pm-required {
    color: #ef4444;
    margin-left: 2px;
}

.pm-modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color .2s;
}

.pm-modal-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.pm-modal-select {
    width: 100%;
    min-height: 120px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color .2s;
}

.pm-modal-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.pm-modal-checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px;
}

.pm-modal-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background-color .2s;
    border-radius: 4px;
}

.pm-modal-checkbox-item:hover {
    background-color: #f3f4f6;
}

.pm-modal-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.pm-modal-checkbox-item span {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

/* 表格内复选框列表 */
.pm-table-checkbox-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}

.pm-category-search {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.pm-category-search:focus {
    border-color: #3b82f6;
}

.pm-no-results {
    padding: 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.pm-table-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    cursor: pointer;
    transition: background-color .2s;
    border-radius: 3px;
    font-size: 13px;
}

.pm-table-checkbox-item:hover {
    background-color: #f3f4f6;
}

.pm-table-checkbox-item input[type="checkbox"] {
    cursor: pointer;
    flex-shrink: 0;
}

.pm-table-checkbox-item span {
    flex: 1;
    color: #374151;
    line-height: 1.4;
}

/* 批量移动搜索结果 */
.pm-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin-top: 8px;
}

.pm-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color .2s;
    border-bottom: 1px solid #f3f4f6;
}

.pm-search-result-item:last-child {
    border-bottom: none;
}

.pm-search-result-item:hover {
    background-color: #f9fafb;
}

.pm-search-result-item.active {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.pm-result-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.pm-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pm-result-name {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-result-sku {
    font-size: 12px;
    color: #9ca3af;
}

.pm-selected-target {
    margin-top: 12px;
    padding: 10px 12px;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    color: #1e40af;
    font-size: 14px;
}

/* 确认弹窗样式 */
.pm-modal-small {
    width: 400px;
}

.pm-confirm-message {
    padding: 20px 0;
    text-align: center;
    font-size: 16px;
    color: #374151;
}

/* 图片选择器弹窗 */
.pm-modal-large {
    width: 900px;
    max-width: 90vw;
    max-height: 80vh;
}

.pm-image-picker-body {
    display: flex;
    gap: 20px;
    height: 500px;
    padding: 0 !important;
}

.pm-date-list {
    width: 200px;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 16px 0;
}

.pm-date-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pm-date-item:hover {
    background-color: #f3f4f6;
}

.pm-date-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

.pm-date-count {
    font-size: 12px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

.pm-date-item.active .pm-date-count {
    background: #dbeafe;
    color: #2563eb;
}

.pm-image-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pm-image-list-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.pm-image-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    align-content: start;
}

.pm-image-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.pm-image-item:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.pm-image-item.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pm-image-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pm-image-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(59, 130, 246, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.pm-image-item.selected .pm-image-item-overlay {
    opacity: 1;
}

.pm-image-item-overlay span {
    color: white;
    font-size: 32px;
    font-weight: bold;
}

/* 图片选择器：多选提示 */
.pm-picker-hint {
    margin-left: 8px;
    font-size: 13px;
    font-weight: normal;
    color: #3b82f6;
}

/* 产品细节图：已选数量 */
.pm-detail-count {
    margin-left: 6px;
    font-size: 12px;
    color: #6b7280;
}

/* 产品细节图：可删除缩略图 */
.pm-detail-thumb {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.pm-detail-thumb .pm-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-style: normal;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.pm-detail-thumb:hover .pm-thumb-remove {
    opacity: 1;
}

.pm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

