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

html {
    height: 100%;
}

body {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 13px;
    background: #f5f5f5;
    color: #333;
}

/* ===== HEADER ===== */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
}

.header-logo {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    cursor: pointer;
    font-size: 13px;
}

.header-user:hover { color: #1890ff; }

/* ===== NAVBAR ===== */
.navbar {
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 40px;
    gap: 4px;
}

.navbar a {
    text-decoration: none;
    color: #333;
    padding: 8px 14px;
    border-radius: 3px;
    font-size: 13px;
    display: inline-block;
}

.navbar a:hover {
    background: #e8e8e8;
    color: #1890ff;
}

.navbar a.active {
    background: #e6f7ff;
    color: #1890ff;
}

/* Navbar dropdown */
.nav-has-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-dropdown-trigger {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 14px; border-radius: 3px;
    font-size: 13px; color: #333; cursor: pointer;
    user-select: none; white-space: nowrap;
}
.nav-has-dropdown:hover .nav-dropdown-trigger,
.nav-has-dropdown.active .nav-dropdown-trigger {
    background: #e8e8e8; color: #1890ff;
}
.nav-dropdown-menu {
    display: none;
    position: absolute; top: 100%; left: 0;
    min-width: 140px; background: #fff;
    border: 1px solid #e0e0e0; border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    z-index: 500; padding: 4px 0;
}
.nav-has-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
    display: block; padding: 8px 16px;
    font-size: 13px; color: #333; text-decoration: none;
    white-space: nowrap;
}
.nav-dropdown-item:hover { background: #f0f7ff; color: #1890ff; }

/* ===== MAIN LAYOUT ===== */
.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== RESIZE HANDLE ===== */
.resize-handle {
    width: 5px;
    min-width: 5px;
    background: #e0e0e0;
    cursor: col-resize;
    position: relative;
    transition: background 0.15s;
    flex-shrink: 0;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: #1890ff;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.6);
    border-radius: 1px;
}

/* ===== LEFT PANEL ===== */
.left-panel {
    width: 464px;
    min-width: 220px;
    max-width: 70vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.left-panel-top {
    padding: 10px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.search-label {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 28px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    padding: 0 26px 0 8px;
    font-size: 12px;
    outline: none;
}

.search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover { color: #666; }

.search-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}

.btn-icon {
    width: 28px;
    height: 28px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #fafafa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
}

.btn-icon:hover { background: #e8e8e8; color: #333; }

.brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #666;
    flex-wrap: wrap;
}

.brand-link {
    color: #1890ff;
    cursor: pointer;
    text-decoration: none;
    font-size: 11px;
    margin-right: 10px;
    white-space: nowrap;
}

.brand-link:hover { text-decoration: underline; }
.brand-link.active { font-weight: bold; color: #e65c00; text-decoration: underline; }

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}


/* Table area */
.table-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.btn-sm {
    height: 26px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #fafafa;
    cursor: pointer;
    font-size: 12px;
    color: #555;
}

.btn-sm:hover { background: #e8f0fe; border-color: #1890ff; color: #1890ff; }

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

.product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.product-table th {
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.product-table th .sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 10px;
    padding: 0 2px;
}

.product-table th .sort-btn:hover { color: #1890ff; }

.product-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    word-break: break-word;
    white-space: normal;
}

.product-table td.col-product-name {
    font-size: 80%;
}

.product-table th:first-child,
.product-table td:first-child {
    color: #999;
    width: 42px;
    min-width: 42px;
    text-align: center;
}

/* Column widths */
.product-table th:nth-child(2),
.product-table td:nth-child(2) { width: 80px; }

.product-table th:nth-child(3),
.product-table td:nth-child(3) { width: 110px; }

.product-table th:nth-child(4),
.product-table td:nth-child(4) { width: 90px; }

.product-table th:nth-child(5),
.product-table td:nth-child(5) { max-width: 160px; }

.product-table tr:hover td { background: #f5f8ff; cursor: pointer; }

.product-table tr.selected td {
    background: #1890ff;
    color: #ffffff;
}

.product-table tr.selected td:first-child { color: #ffffff; }

.product-table tr.selected:hover td { background: #1890ff; }

/* Pagination */
.pagination {
    padding: 8px 10px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pagination .total { flex: 1; }

.page-btn {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.page-btn:hover { border-color: #1890ff; color: #1890ff; }
.page-btn.active { background: #1890ff; border-color: #1890ff; color: #fff; }
.page-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ===== RIGHT PANEL ===== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

/* Tabs */
.tab-bar {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    padding: 0 12px;
    flex-shrink: 0;
    overflow-x: auto;
}

.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.tab-item {
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.tab-item:hover { color: #1890ff; }

.tab-item.active {
    color: #1890ff;
    border-bottom-color: #1890ff;
    font-weight: 500;
}

/* Content area */
.right-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Image gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.image-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    background: #fafafa;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.image-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-item:hover { border-color: #1890ff; }

.image-placeholder {
    color: #ccc;
    font-size: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.image-placeholder span {
    font-size: 11px;
    color: #bbb;
}

/* Gallery nav */
.gallery-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.gallery-nav a {
    color: #1890ff;
    text-decoration: none;
    font-size: 13px;
}

.gallery-nav a:hover { text-decoration: underline; }

/* Product detail */
.product-detail {
    border-top: 1px solid #e8e8e8;
    padding-top: 12px;
}

.product-detail h2 {
    font-size: 15px;
    font-weight: bold;
    color: #222;
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 13px;
    margin-bottom: 10px;
}

.detail-label {
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}

.detail-value {
    color: #333;
    width: 100%; box-sizing: border-box;
    border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 4px 7px; font-size: 13px;
    background: #f5f5f5;
    display: block; min-height: 28px; line-height: 20px;
}

.detail-section {
    margin-top: 8px;
}

.detail-section-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
    font-size: 13px;
}

.detail-section-body {
    color: #555;
    line-height: 1.6;
    font-size: 13px;
}

/* Tab content panels */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 产品描述 - 图片展示栏 */
.desc-image-strip {
    border-bottom: 1px solid #e8e8e8;
    background: #f9f9f9;
    padding: 12px 16px 6px;
}
.desc-image-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    min-height: 120px;
}
.desc-image-cell {
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    background: #fff;
    cursor: pointer;
    transition: box-shadow .2s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.desc-cell-dl, .desc-cell-del {
    position: absolute; top: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: #fff; font-size: 13px;
    display: none; align-items: center; justify-content: center;
    line-height: 1; cursor: pointer; text-decoration: none; border: none;
    z-index: 2;
}
.desc-cell-dl  { left: 4px; }
.desc-cell-del { right: 4px; padding: 0; font-size: 12px; }
.desc-image-cell:hover .desc-cell-dl,
.desc-image-cell:hover .desc-cell-del { display: flex; }
.desc-cell-dl:hover  { background: #1890ff; }
.desc-cell-del:hover { background: #ff4d4f; }
.desc-image-cell:hover { box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.desc-image-cell img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}
.desc-image-info {
    padding: 5px 6px 6px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}
.desc-img-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.desc-img-dim, .desc-img-size { color: #999; }
.desc-image-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 13px;
    min-height: 80px;
}
.desc-image-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 0 4px;
    font-size: 13px;
    color: #555;
}
.desc-nav-btn {
    cursor: pointer;
    color: #1890ff;
    user-select: none;
    font-size: 13px;
}
.desc-nav-btn:hover { color: #096dd9; }

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #bbb;
    font-size: 14px;
    gap: 8px;
}

.empty-state .icon { font-size: 48px; }

/* 描述栏 - 添加图片按钮 */
.desc-image-actions {
    display: flex;
    justify-content: center;
    padding: 6px 0 4px;
}
.desc-add-btn {
    background: none;
    border: 1px dashed #1890ff;
    color: #1890ff;
    border-radius: 4px;
    padding: 4px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s;
}
.desc-add-btn:hover { background: #e6f7ff; }

/* 弹窗 */
.desc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.desc-modal {
    background: #fff;
    border-radius: 8px;
    width: 680px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.desc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e8e8e8;
    font-weight: 600;
    font-size: 15px;
}
.desc-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}
.desc-modal-close:hover { color: #333; }
.desc-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    align-content: start;
}
.desc-modal-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #bbb;
    padding: 40px 0;
    font-size: 13px;
}
/* 弹窗缩略图 */
.desc-modal-thumb {
    position: relative;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background: #f9f9f9;
    transition: border-color .2s;
}
.desc-modal-thumb:hover { border-color: #1890ff; }
.desc-modal-thumb.selected { border-color: #1890ff; background: #e6f7ff; }
.desc-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.desc-modal-thumb .thumb-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: transparent;
    transition: all .15s;
}
.desc-modal-thumb.selected .thumb-check {
    border-color: #1890ff;
    background: #1890ff;
    color: #fff;
}
.desc-modal-thumb .thumb-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 弹窗底部 */
.desc-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #e8e8e8;
    justify-content: flex-end;
}
.desc-modal-footer span { flex: 1; font-size: 13px; color: #888; }
.desc-modal-cancel {
    padding: 5px 18px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.desc-modal-cancel:hover { border-color: #1890ff; color: #1890ff; }
.desc-modal-confirm {
    padding: 5px 18px;
    border: none;
    border-radius: 4px;
    background: #1890ff;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
}
.desc-modal-confirm:hover { background: #096dd9; }

/* Scrollbar styling */
.product-table-wrap::-webkit-scrollbar { width: 6px; }
.product-table-wrap::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.product-table-wrap::-webkit-scrollbar-thumb:hover { background: #bbb; }

.right-content::-webkit-scrollbar { width: 6px; }
.right-content::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ===== Gallery ===== */
#tab-images { padding: 0; flex-direction: column; height: 100%; }
#tab-images.active { display: flex; }

.gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: #1890ff;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background .2s;
}
.upload-btn:hover { background: #096dd9; }

.gallery-count { font-size: 13px; color: #888; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #bbb;
    font-size: 13px;
    padding: 60px 0;
}

.gallery-item {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s, transform .2s;
    background: #fafafa;
    position: relative;
}
.gallery-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-2px); }

.gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #f5f5f5;
    display: block;
}

.gallery-info {
    padding: 6px 8px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}
.gallery-info .g-filename {
    font-size: 11px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.gallery-info .g-meta {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.gallery-item .del-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.gallery-item:hover .del-btn { display: flex; }
.gallery-item .del-btn:hover { background: #ff4d4f; }

.gallery-item .dl-btn {
    position: absolute;
    top: 4px; left: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,.5);
    color: #fff; text-decoration: none;
    border-radius: 50%; font-size: 14px; cursor: pointer;
    display: none; align-items: center; justify-content: center; line-height: 1;
}
.gallery-item:hover .dl-btn { display: flex; }
.gallery-item .dl-btn:hover { background: #1890ff; }

/* Lightbox */
.gallery-lightbox { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.lightbox-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
.lightbox-box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-box img { max-width: 80vw; max-height: 75vh; object-fit: contain; border-radius: 4px; }
.lightbox-close {
    position: absolute;
    top: -36px; right: 0;
    background: none; border: none;
    color: #fff; font-size: 24px; cursor: pointer;
}
.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.2);
    border: none; color: #fff;
    font-size: 36px; cursor: pointer;
    padding: 8px 14px; border-radius: 4px;
    transition: background .2s;
}
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,.4); }
.lightbox-info { color: #ccc; font-size: 13px; margin-top: 10px; }

/* ===== Manual Tab ===== */
#tab-manual { padding: 0; flex-direction: column; height: 100%; }
#tab-manual.active { display: flex; }

.manual-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.manual-item {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}
.manual-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-2px); }

/* 文件图标区域（非图片文件） */
.manual-icon {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #d9d9d9;
    flex-shrink: 0;
}
.manual-icon-pdf  { background: #ff4d4f; }
.manual-icon-doc  { background: #1890ff; }
.manual-icon-docx { background: #1890ff; }
.manual-icon-xls  { background: #52c41a; }
.manual-icon-xlsx { background: #52c41a; }
.manual-icon-ppt  { background: #fa8c16; }
.manual-icon-pptx { background: #fa8c16; }
.manual-icon-txt  { background: #722ed1; }
.manual-icon-zip  { background: #13c2c2; }
.manual-icon-rar  { background: #13c2c2; }

.manual-icon-svg { font-size: 32px; opacity: .9; }
.manual-ext-label { font-size: 16px; font-weight: 700; letter-spacing: 1px; }

/* 图片缩略图（图片格式的说明书） */
.manual-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
    display: block;
}

.manual-item .del-btn {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    border: none; color: #fff;
    font-size: 12px; cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    line-height: 1;
}
.manual-item:hover .del-btn { display: flex; }
.manual-item .del-btn:hover { background: #ff4d4f; }

.manual-item .dl-btn {
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: #fff; text-decoration: none;
    font-size: 13px; cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    line-height: 1;
}
.manual-item:hover .dl-btn { display: flex; }
.manual-item .dl-btn:hover { background: #1890ff; }

.manual-no-preview-btn {
    margin-top: 16px;
    padding: 8px 24px;
    background: #1890ff; color: #fff;
    border: none; border-radius: 6px;
    font-size: 14px; cursor: pointer;
    text-decoration: none; display: inline-block;
}
.manual-no-preview-btn:hover { background: #40a9ff; }

/* 文件预览 Modal */
#manual-preview-modal {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}
.manual-preview-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.75);
}
.manual-preview-box {
    position: relative; z-index: 1;
    background: #1a1a1a; border-radius: 8px;
    display: flex; flex-direction: column; align-items: center;
    max-width: 92vw; max-height: 92vh;
    min-width: 320px;
}
.manual-preview-content {
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.manual-preview-content img {
    max-width: 80vw; max-height: 80vh; object-fit: contain; border-radius: 4px;
}
.manual-preview-content iframe {
    width: 82vw; height: 84vh; border: none; border-radius: 4px; background: #fff;
}
.manual-no-preview {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 60px 40px;
    color: #aaa; font-size: 15px;
}
#manual-preview-modal .lightbox-close {
    position: absolute; top: -36px; right: 0;
    background: none; border: none;
    color: #fff; font-size: 24px; cursor: pointer;
}
#manual-preview-modal .lightbox-info {
    color: #aaa; font-size: 12px; padding: 8px 0 10px;
}

/* 视频网格项 播放图标 */
.video-play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -65%);
    width: 40px; height: 40px;
    background: rgba(0,0,0,.5);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; pointer-events: none;
    padding-left: 3px;
}

/* ===== 基本信息 Tab ===== */
.btn-new-product {
    background: #2563eb; color: #fff; border: none;
}
.btn-new-product:hover { background: #1d4ed8; }

.info-form {
    padding: 16px 20px 32px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.info-mode-banner {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 14px;
    background: #e0f2fe;
    color: #0369a1;
    align-self: flex-start;
}
.info-mode-banner.create-mode {
    background: #dcfce7;
    color: #15803d;
}
.info-row {
    display: flex;
    gap: 12px;
}
.info-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    flex: 1;
    min-width: 0;
}
.info-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}
.info-required { color: #e53e3e; }
.info-input {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 6px 9px;
    font-size: 13px;
    color: #222;
    outline: none;
    transition: border-color .15s;
    background: #fff;
}
.info-input:focus { border-color: #2563eb; }
select.info-input { appearance: auto; cursor: pointer; }
.info-input[readonly] {
    background: #f5f5f5;
    color: #888;
    cursor: not-allowed;
}
.info-textarea {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 6px 9px;
    font-size: 13px;
    color: #222;
    outline: none;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    transition: border-color .15s;
}
.info-textarea:focus { border-color: #2563eb; }
.info-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: 0;
}
.info-save-btn {
    background: #2563eb; color: #fff;
    border: none; border-radius: 5px;
    padding: 7px 22px; font-size: 13px;
    cursor: pointer; font-weight: 500;
    transition: background .15s;
}
.info-save-btn:hover { background: #1d4ed8; }
.info-reset-btn {
    background: #f3f4f6; color: #444;
    border: 1px solid #ddd; border-radius: 5px;
    padding: 7px 18px; font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}
.info-reset-btn:hover { background: #e5e7eb; }
.info-delete-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed #e8e8e8;
}
.info-delete-btn {
    background: #fff; color: #dc2626;
    border: 1px solid #dc2626; border-radius: 5px;
    padding: 6px 18px; font-size: 13px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.info-delete-btn:hover { background: #dc2626; color: #fff; }
.info-delete-btn:disabled {
    opacity: .4; cursor: not-allowed;
}

/* ===== 可编辑字段 (描述 tabs) ===== */
.detail-header-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.detail-header-row h2 { margin: 0; flex: 1; }
.detail-delete-btn {
    background: #fff; color: #dc2626; border: 1px solid #dc2626;
    border-radius: 5px; padding: 5px 14px; font-size: 12px;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    transition: background .15s, color .15s;
}
.detail-delete-btn:hover { background: #dc2626; color: #fff; }

.detail-input {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 4px 7px; font-size: 13px; color: #222;
    background: #fafafa; outline: none;
    transition: border-color .15s, background .15s;
    font-family: inherit;
}
.detail-input:focus { border-color: #2563eb; background: #fff; }

.detail-select {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 4px 7px; font-size: 13px; color: #222;
    background: #fafafa; outline: none;
    transition: border-color .15s, background .15s;
    font-family: inherit; cursor: pointer;
}
.detail-select:focus { border-color: #2563eb; background: #fff; }

/* Multi-select dropdown for detail panel */
.detail-multisel { position: relative; width: 100%; }
.detail-multisel-btn {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; box-sizing: border-box;
    border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 4px 7px; font-size: 13px; color: #222;
    background: #fafafa; outline: none; cursor: pointer;
    font-family: inherit; text-align: left;
    transition: border-color .15s;
}
.detail-multisel-btn:hover, .detail-multisel-btn:focus { border-color: #2563eb; background: #fff; }
.detail-multisel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-multisel-menu {
    display: none; position: absolute; top: calc(100% + 2px); left: 0;
    width: 100%; background: #fff; border: 1px solid #d1d5db;
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.1);
    z-index: 300; padding: 4px 0;
}
.detail-multisel-menu.open { display: block; }
.detail-multisel-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; font-size: 12px; color: #374151;
    cursor: pointer; user-select: none;
}
.detail-multisel-item:hover { background: #f1f5f9; }
.detail-multisel-item input[type="checkbox"] {
    width: 13px; height: 13px; accent-color: #3b82f6; cursor: pointer; flex-shrink: 0;
}
body:not(.manage-mode) .detail-multisel-btn {
    pointer-events: none;
    background: #f5f5f5;
    color: #333;
    cursor: default;
}
body:not(.manage-mode) .detail-multisel-btn svg { display: none; }

.detail-textarea {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e0e0e0; border-radius: 4px;
    padding: 5px 7px; font-size: 13px; color: #222;
    background: #fafafa; outline: none; resize: vertical;
    min-height: 60px; font-family: inherit; line-height: 1.6;
    transition: border-color .15s, background .15s;
}
.detail-textarea:focus { border-color: #2563eb; background: #fff; }

.detail-save-row {
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}
.detail-save-btn {
    background: #2563eb; color: #fff;
    border: none; border-radius: 5px;
    padding: 7px 22px; font-size: 13px;
    cursor: pointer; font-weight: 500;
    transition: background .15s;
}
.detail-save-btn:hover { background: #1d4ed8; }

/* ===== 新增产品 modal ===== */
#new-product-modal {
    position: fixed; inset: 0; z-index: 3000;
}
.new-product-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.new-product-box {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff; border-radius: 10px;
    width: 520px; max-width: 95vw;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    display: flex; flex-direction: column;
}
.new-product-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
    font-weight: 600; font-size: 15px;
}
.new-product-close {
    background: none; border: none; font-size: 18px;
    cursor: pointer; color: #999; padding: 0 4px;
}
.new-product-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 0; }
.new-product-footer {
    display: flex; gap: 10px; padding: 14px 20px;
    border-top: 1px solid #f0f0f0;
}

.btn-delete-product {
    background: #fff; color: #dc2626;
    border: 1px solid #dc2626;
}
.btn-delete-product:hover { background: #dc2626; color: #fff; }

/* ===== 导入按钮 ===== */
.btn-import {
    background: #fff; color: #2563eb;
    border: 1px solid #2563eb;
}
.btn-import:hover { background: #eff6ff; }

.btn-template {
    background: #fff; color: #059669;
    border: 1px solid #059669;
    text-decoration: none; display: inline-flex; align-items: center;
}
.btn-template:hover { background: #ecfdf5; }

/* ===== 导入弹窗 ===== */
.import-box { width: 480px; }

.import-drop-zone {
    border: 2px dashed #d1d5db; border-radius: 8px;
    padding: 32px 20px; text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s;
}
.import-drop-zone:hover, .import-drop-zone.drag-over {
    border-color: #2563eb; background: #eff6ff;
}
.import-drop-icon { font-size: 36px; margin-bottom: 8px; }
.import-drop-text { font-size: 14px; color: #333; margin-bottom: 4px; }
.import-drop-hint { font-size: 12px; color: #9ca3af; }

.import-filename {
    margin-top: 10px; font-size: 13px; color: #2563eb;
    background: #eff6ff; border-radius: 4px; padding: 6px 10px;
}

.import-result { margin-top: 12px; font-size: 13px; }
.import-result-summary {
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px;
    padding: 10px 14px; color: #166534; margin-bottom: 8px;
}
.import-result-errors {
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px;
    padding: 10px 14px; color: #9a3412; max-height: 160px; overflow-y: auto;
}
.import-err-title { font-weight: 600; margin-bottom: 6px; }
.import-err-item { font-size: 12px; padding: 2px 0; }

.import-sheet-result { margin-bottom: 10px; }
.import-sheet-name { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.import-sheet-result .import-result-summary { margin-bottom: 4px; }

/* ===== 产品查询模式：只读，保留编辑外观但禁止交互 ===== */
body:not(.manage-mode) .detail-input,
body:not(.manage-mode) .detail-textarea {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: default;
    pointer-events: none;
    resize: none;
    color: #333;
}
body:not(.manage-mode) .detail-section-body {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 5px 7px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
    min-height: 28px;
}
body:not(.manage-mode) .detail-select {
    background: #f5f5f5;
    cursor: default;
    pointer-events: none;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
}
body:not(.manage-mode) .detail-save-row { display: none !important; }
body.manage-mode    .pn-readonly  { display: none !important; }
body.manage-mode    .pn-edit-wrap { display: flex !important; align-items: center; }
body:not(.manage-mode) .pn-edit-wrap { display: none !important; }
body:not(.manage-mode) .upload-btn { display: none !important; }
body:not(.manage-mode) .desc-image-actions { display: none !important; }
body:not(.manage-mode) .file-cell-del,
body:not(.manage-mode) .img-cell-del,
body:not(.manage-mode) .img-cell-dl,
body:not(.manage-mode) .file-cell-dl { display: none !important; }

/* ===== 产品FAQ Tab ===== */
.faq-toolbar { display:flex; align-items:center; gap:10px; padding:12px 16px 0; }
.faq-link-btn {
    background:#3b82f6; color:#fff; border:none; border-radius:6px;
    padding:6px 16px; font-size:13px; font-weight:600; cursor:pointer;
}
.faq-link-btn:hover { background:#2563eb; }

/* FAQ Cards */
#faq-cards { padding:12px 16px; display:flex; flex-direction:column; gap:10px; }
.faq-card {
    background:#fff; border:1px solid #e2e8f0; border-radius:10px;
    padding:14px 16px; display:flex; align-items:flex-start; gap:12px;
    transition:box-shadow .15s;
}
.faq-card:hover { box-shadow:0 3px 12px rgba(0,0,0,.07); }
.faq-card-body { flex:1; }
.faq-card-title { font-size:14px; font-weight:600; color:#1e293b; margin-bottom:4px; }
.faq-card-title a { color:inherit; text-decoration:none; }
.faq-card-title a:hover { color:#3b82f6; }
.faq-card-meta { font-size:12px; color:#94a3b8; margin-bottom:6px; display:flex; gap:8px; flex-wrap:wrap; }
.faq-card-cat { background:#eff6ff; color:#3b82f6; border-radius:4px; padding:1px 7px; font-size:11px; font-weight:600; }
.faq-card-excerpt { font-size:13px; color:#64748b; line-height:1.6; }
.faq-card-tags { margin-top:8px; display:flex; flex-wrap:wrap; gap:6px; }
.faq-card-tag { background:#f1f5f9; color:#64748b; border-radius:10px; padding:2px 9px; font-size:11px; }
.faq-card-del {
    background:none; border:none; color:#d1d5db; font-size:16px; cursor:pointer;
    padding:2px 6px; border-radius:5px; line-height:1; flex-shrink:0;
}
.faq-card-del:hover { background:#fee2e2; color:#ef4444; }
body:not(.manage-mode) .faq-card-del { display:none !important; }

/* FAQ Modal */
.faq-modal-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:9000;
    display:flex; align-items:center; justify-content:center;
}
.faq-modal {
    background:#fff; border-radius:12px; width:620px; max-width:96vw;
    max-height:80vh; display:flex; flex-direction:column;
    box-shadow:0 20px 60px rgba(0,0,0,.25);
}
.faq-modal-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:16px 20px; border-bottom:1px solid #e2e8f0;
    font-size:15px; font-weight:600; color:#1e293b;
}
.faq-modal-close {
    background:none; border:none; font-size:16px; color:#94a3b8; cursor:pointer; padding:4px;
}
.faq-modal-close:hover { color:#374151; }
.faq-modal-search { display:flex; gap:8px; padding:12px 16px 0; }
.faq-search-input {
    flex:1; padding:8px 12px; border:1px solid #d1d5db; border-radius:7px;
    font-size:13px; outline:none;
}
.faq-search-input:focus { border-color:#3b82f6; }
.faq-cat-select {
    padding:8px 10px; border:1px solid #d1d5db; border-radius:7px;
    font-size:13px; outline:none; color:#374151;
}
.faq-tag-bar { padding:8px 16px 0; display:flex; flex-wrap:wrap; gap:6px; min-height:30px; }
.faq-tag-chip {
    background:#f1f5f9; color:#64748b; border:none; border-radius:10px;
    padding:3px 10px; font-size:12px; cursor:pointer;
}
.faq-tag-chip:hover, .faq-tag-chip.active { background:#dbeafe; color:#1d4ed8; }
.faq-modal-list { flex:1; overflow-y:auto; padding:10px 16px 16px; }
.faq-loading { text-align:center; color:#94a3b8; padding:30px 0; font-size:13px; }
.faq-modal-item {
    display:flex; align-items:flex-start; gap:10px;
    padding:10px 12px; border-radius:8px; cursor:pointer;
    border:1px solid transparent; margin-bottom:6px; transition:all .12s;
}
.faq-modal-item:hover { background:#f8fafc; border-color:#e2e8f0; }
.faq-modal-item.linked { background:#f0fdf4; border-color:#86efac; }
.faq-modal-item-info { flex:1; }
.faq-modal-item-title { font-size:13px; font-weight:600; color:#1e293b; margin-bottom:3px; }
.faq-modal-item-sub { font-size:12px; color:#94a3b8; }
.faq-modal-item-btn {
    font-size:12px; padding:4px 12px; border-radius:5px; border:none; cursor:pointer;
    font-weight:600; flex-shrink:0;
}
.faq-modal-item-btn.add    { background:#dbeafe; color:#1d4ed8; }
.faq-modal-item-btn.add:hover    { background:#bfdbfe; }
.faq-modal-item-btn.remove { background:#fee2e2; color:#dc2626; }
.faq-modal-item-btn.remove:hover { background:#fecaca; }

/* ===== 产品列表 - 复选框列 ===== */
.product-table th:first-child,
.product-table td:first-child {
    width: 28px;
    padding: 4px 6px;
    text-align: center;
}
.product-table .row-cb {
    cursor: pointer;
    accent-color: #1890ff;
}

/* ===== 导出工具栏 ===== */
.export-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #e6f7ff;
    border-top: 1px solid #91d5ff;
    font-size: 12px;
    flex-shrink: 0;
}
.export-bar.visible {
    display: flex;
}
.export-bar-info {
    color: #0958d9;
    flex-shrink: 0;
}
.export-bar-info strong {
    font-size: 13px;
}
.export-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s;
    flex-shrink: 0;
}
.export-bar-btn:hover { background: #40a9ff; }
.export-bar-btn-all {
    background: #fff;
    color: #1890ff;
    border: 1px solid #91d5ff;
}
.export-bar-btn-all:hover { background: #e6f7ff; }
.export-bar-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: inherit;
}
.export-bar-clear:hover { color: #ff4d4f; background: #fff2f0; }
