/* ==================== RESET & BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #111;
    height: 100vh;
    overflow: hidden;
}

button { cursor: pointer; font-family: inherit; }

/* ==================== LAYOUT ==================== */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px 14px;
    gap: 8px;
}

/* ==================== HEADER ==================== */
.header {
    background: #fff;
    border-radius: 14px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 28px; height: 28px; color: #4a7dff; flex-shrink: 0; }
.header h1 { font-size: 16px; font-weight: 700; color: #1a1a2e; letter-spacing: 0.3px; }

/* ==================== TAB BAR ==================== */
.tab-bar {
    display: flex;
    gap: 6px;
    background: #fff;
    padding: 5px 8px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #8e8e93;
    background: transparent;
    transition: all 0.2s;
}
.tab-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.tab-btn:hover { background: #f0f4ff; color: #4a7dff; }
.tab-btn.active { background: #4a7dff; color: #fff; }

/* ==================== PANELS ==================== */
.tab-panel { display: none; flex: 1; min-height: 0; overflow: hidden; }
.tab-panel.active { display: flex; flex-direction: column; }

/* ==================== CHAT ==================== */
/* ==================== AI智能问答顶部提示 ==================== */
.ai-tip-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #fff8e6 0%, #fff3cc 100%);
    border-bottom: 1px solid #ffe066;
    font-size: 13px;
    color: #7a4f00;
    font-weight: 500;
    flex-shrink: 0;
    animation: tipBannerIn 0.4s ease;
}
@keyframes tipBannerIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-panel {
    display: flex; flex-direction: column; flex: 1; min-height: 0;
    background: #fff; border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}
.chat-messages {
    flex: 1; padding: 16px 20px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px; background: #fafafa;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.chat-row { display: flex; align-items: flex-start; gap: 10px; }
.chat-row.user { flex-direction: row-reverse; }

.chat-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar-user { background: #4a7dff; }
.avatar-user::after { content: ''; width: 16px; height: 16px; background: #fff; mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/%3E%3C/svg%3E"); mask-size: contain; -webkit-mask-size: contain; }
.avatar-ai { background: #fff; border: 1.5px solid #e0e4ee; }
.avatar-ai::after { content: ''; width: 16px; height: 16px; background: #4a7dff; mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 14s1.5 2 4 2 4-2 4-2' stroke='%234a7dff' stroke-width='1.5' fill='none'/%3E%3Cline x1='9' y1='9' x2='9.01' y2='9' stroke='%234a7dff' stroke-width='2'/%3E%3Cline x1='15' y1='9' x2='15.01' y2='9' stroke='%234a7dff' stroke-width='2'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 14s1.5 2 4 2 4-2 4-2' stroke='%234a7dff' stroke-width='1.5' fill='none'/%3E%3Cline x1='9' y1='9' x2='9.01' y2='9' stroke='%234a7dff' stroke-width='2'/%3E%3Cline x1='15' y1='9' x2='15.01' y2='9' stroke='%234a7dff' stroke-width='2'/%3E%3C/svg%3E"); mask-size: contain; -webkit-mask-size: contain; }

.chat-bubble {
    max-width: 72%; padding: 11px 16px;
    border-radius: 14px; font-size: 14px; line-height: 1.6;
}
.user .chat-bubble { background: #4a7dff; color: #fff; border-bottom-right-radius: 5px; }
.bot .chat-bubble { background: #fff; color: #111; border-bottom-left-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.bot .chat-bubble ul { margin: 8px 0 0 18px; }
.bot .chat-bubble li { margin-bottom: 4px; color: #555; }
.bot .chat-bubble p { margin-bottom: 5px; }
.rcard { background: #fff; border: 1.5px solid #eee; border-radius: 12px; padding: 14px; margin-top: 8px; }
.rcard h4 { font-size: 14px; color: #111; margin-bottom: 10px; font-weight: 700; }
.rcard .rc-error { padding: 10px 12px; background: #fef5f5; border-radius: 8px; border-left: 3px solid #ef4444; font-size: 13px; color: #dc2626; }

.chat-input-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-top: 1px solid #f0f0f0; background: #fff; flex-shrink: 0;
}
.chat-input-bar input {
    flex: 1; padding: 13px 18px;
    border: 2px solid #e4e6ec; border-radius: 12px;
    font-size: 15px; background: #fafafc; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-bar input:focus { border-color: #4a7dff; background: #fff; box-shadow: 0 0 0 4px rgba(74,125,255,0.1); }
.chat-send-btn {
    width: 52px; height: 52px; border-radius: 12px; border: none;
    background: #4a7dff; color: #fff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.1s; box-shadow: 0 4px 12px rgba(74,125,255,0.3);
}
.chat-send-btn svg { width: 20px; height: 20px; }
.chat-send-btn:hover { background: #3560e8; transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.96); }

.typing { display: flex; gap: 5px; padding: 10px 16px; }
.typing span { width: 7px; height: 7px; background: #aaa; border-radius: 50%; animation: tping 1.4s infinite ease-in-out both; }
.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes tping { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* ==================== UPLOAD LAYOUT ==================== */
.upload-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 14px 14px;
    flex: 1;
    min-height: 0;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
}

/* ==================== UPLOAD CARD ==================== */
.upload-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.upload-card-hd {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    flex-shrink: 0;
}
.hd-icon { width: 17px; height: 17px; color: #4a7dff; flex-shrink: 0; }

/* ==================== CAMERA PREVIEW ==================== */
.upload-preview {
    position: relative;
    background: #111;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.upload-preview video,
.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.upload-preview img { object-fit: contain; }

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255,255,255,0.25);
    flex: 1;
    height: 100%;
}
.preview-icon-svg { width: 48px; height: 48px; }
.preview-placeholder span:last-child { font-size: 12px; }

.preview-loading {
    position: absolute; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; color: #fff; z-index: 2;
}
.preview-loading span { font-size: 13px; font-weight: 600; }

.spinner {
    width: 34px; height: 34px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Camera buttons row */
.preview-btns {
    display: flex; gap: 8px; justify-content: center; align-items: center;
    padding: 8px 10px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.preview-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 8px 16px; border-radius: 20px;
    border: 1.5px solid #d0d4e0; background: #fff;
    font-size: 13px; font-weight: 600; color: #444;
    transition: all 0.2s; flex: 1; justify-content: center;
    white-space: nowrap;
}
.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }
.preview-btn:hover { border-color: #4a7dff; color: #4a7dff; background: #f0f4ff; }

.capture-btn {
    width: 52px; height: 52px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.6);
    background: #fff; cursor: pointer; flex-shrink: 0;
    transition: border-color 0.2s, transform 0.15s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: relative;
}
.capture-btn::after {
    content: ''; position: absolute; inset: 6px;
    background: #e0e0e0; border-radius: 50%;
    transition: background 0.15s, transform 0.15s;
}
.capture-btn:hover { transform: scale(1.1); }
.capture-btn:hover::after { background: #c0c0c0; transform: scale(0.9); }
.capture-btn:active::after { transform: scale(0.8); }
.capture-btn.has-photo { border-color: #22c55e; }
.capture-btn.has-photo::after { background: #22c55e; }
.capture-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.capture-btn:disabled:hover { transform: none; }

/* ==================== FORM BODY ==================== */
.form-body {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 14px;
    flex: 1; min-height: 0; overflow-y: auto;
}
.form-body::-webkit-scrollbar { width: 3px; }
.form-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.form-row { display: flex; gap: 8px; align-items: flex-end; }
.form-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 12px; font-weight: 700; color: #444; }
.label-opt { font-weight: 400; color: #aaa; }

.form-field select,
.form-field input[type="text"],
.form-field input[type="number"] {
    padding: 10px 12px; border: 1.5px solid #e0e2e8; border-radius: 10px;
    font-size: 14px; font-family: inherit; color: #222; background: #fff;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
}
.form-field select:focus,
.form-field input:focus { border-color: #4a7dff; box-shadow: 0 0 0 3px rgba(74,125,255,0.1); }

.btn-add-sm {
    padding: 0 12px; height: 38px; border-radius: 10px;
    border: none; background: #4a7dff; color: #fff;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: background 0.2s; white-space: nowrap;
}
.btn-add-sm:hover { background: #3560e8; }

/* Thumbnail */
.thumb-wrap {
    display: flex; align-items: center; gap: 8px;
    background: #f0f4ff; border: 1.5px solid #d0d8f8;
    border-radius: 10px; padding: 8px 10px;
}
.thumb-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.thumb-label { flex: 1; font-size: 12px; color: #4a7dff; font-weight: 600; }
.thumb-clear {
    width: 24px; height: 24px; border-radius: 50%;
    border: none; background: #e0e0ec; color: #888;
    font-size: 12px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background 0.2s;
}
.thumb-clear:hover { background: #ef4444; color: #fff; }

/* Form footer */
.form-footer { margin-top: auto; padding-top: 6px; }
.btn-save {
    width: 100%; padding: 14px;
    border: none; border-radius: 12px;
    background: #4a7dff; color: #fff;
    font-size: 15px; font-weight: 700; cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 4px 14px rgba(74,125,255,0.3);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-save:hover:not(:disabled) { background: #3560e8; transform: translateY(-1px); }
.btn-save:disabled { background: #d8dbe8; color: #aaa; cursor: not-allowed; box-shadow: none; }

/* ==================== RECOGNITION ==================== */
.recog-body {
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 14px; flex: 1; min-height: 0; overflow-y: auto;
}
.recog-body::-webkit-scrollbar { width: 3px; }
.recog-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.recog-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; flex: 1; min-height: 200px;
    color: #aaa; text-align: center;
}
.recog-empty-svg { width: 44px; height: 44px; opacity: 0.5; }
.recog-empty span { font-size: 13px; }
.recog-empty-sub { color: #ccc; font-size: 12px !important; }

.match-card {
    background: #fff; border: 1.5px solid #e4e6ec;
    border-radius: 12px; padding: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.match-card:hover { border-color: #333; box-shadow: none; }

.mcard-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.mcard-name { font-size: 15px; font-weight: 800; color: #111; }
.mcard-sku { font-size: 11px; font-weight: 400; color: #aaa; margin-left: 6px; }

.badge { padding: 3px 10px; border-radius: 3px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid #ddd; color: #111; background: #fff; }

.mcard-locs { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.mcard-loc { display: flex; justify-content: space-between; align-items: center; background: #fff; border-radius: 4px; padding: 5px 9px; font-size: 11px; border: 1px solid #ddd; }
.mcard-loc span:first-child { color: #333; }
.loc-qty { font-weight: 700; font-size: 12px !important; color: #111 !important; }

/* ERP 档案区块 */
.erp-profile-block { background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; }
.erp-section-title { font-size: 11px; font-weight: 700; color: #111; margin-bottom: 6px; padding-left: 7px; border-left: 2px solid #333; }
.erp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
.erp-field { display: flex; gap: 5px; font-size: 11px; align-items: baseline; line-height: 1.7; }
.erp-label { color: #888; min-width: 58px; flex-shrink: 0; }
.erp-value { color: #111; font-weight: 600; word-break: break-all; }

/* 颜色变体 */
.color-variants { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.variant-item { display: flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid #ddd; border-radius: 3px; font-size: 11px; }
.variant-name { color: #111; font-weight: 600; }
.variant-price { color: #111; font-weight: 700; }
.variant-sku { color: #888; font-size: 11px; }

/* 库存来源标签 */
.inv-source-label { font-size: 11px; color: #888; margin-bottom: 4px; }

/* 候选列表导航 */
.cand-nav-bar {
    background: #4a7dff;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
    display: flex; align-items: center;
}
.cand-nav-bar:hover { background: #3660e0; }
.cand-nav-back { display: flex; align-items: center; gap: 6px; }

.cand-filter-hint {
    font-size: 12px;
    color: #8b6f00;
    background: #fffbe6;
    border: 1px solid #ffe066;
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* ==================== 两阶段检索栏 ==================== */
.cand-stage-wrap {
    background: #fff;
    border: 1px solid #e4e6ec;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* 阶段一搜索行 */
.cand-stage1-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #f0f2f8;
}
.cand-stage1-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.cand-stage1-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.cand-stage-label {
    font-size: 12px;
    font-weight: 700;
    color: #4a7dff;
    white-space: nowrap;
    flex-shrink: 0;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #d0d8f8;
}
.cand-stage-input {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid #dde4f0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fafbfc;
    color: #111;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.cand-stage-input:focus {
    border-color: #4a7dff;
    box-shadow: 0 0 0 3px rgba(74,125,255,0.08);
    background: #fff;
}
.cand-stage-input::placeholder {
    color: #b0b8cc;
}

/* 阶段二搜索行 */
.cand-stage2-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9ff;
    border-bottom: 1px solid #eef0f8;
    animation: stage2FadeIn 0.2s ease;
}
@keyframes stage2FadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.cand-stage2-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.cand-stage-arrow {
    font-size: 9px;
    color: #8b95b8;
    flex-shrink: 0;
}
.cand-stage-label-sub {
    color: #7c8db8;
    background: #eef1f8;
    border-color: #dde2f0;
}
.cand-stage-input-sub {
    background: #fff;
}

/* 按钮 */
.cand-btn {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    border: 1.5px solid transparent;
    font-family: inherit;
    white-space: nowrap;
}
.cand-btn-primary {
    background: #4a7dff;
    color: #fff;
    border-color: #4a7dff;
}
.cand-btn-primary:hover { background: #3660e8; border-color: #3660e8; }
.cand-btn-secondary {
    background: #fff;
    color: #4a7dff;
    border-color: #4a7dff;
}
.cand-btn-secondary:hover { background: #eef2ff; }
.cand-btn-clear {
    background: #f0f2f5;
    color: #666;
    border-color: #e4e6ec;
}
.cand-btn-clear:hover { background: #e8eaf0; color: #333; }

/* 筛选标签行 */
.cand-chips-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 8px;
    background: #fff;
}
.cand-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.cand-chip-s1 {
    background: #eef2ff;
    color: #4a7dff;
    border: 1px solid #d0d8f8;
}
.cand-chip-s2 {
    background: #f0fbf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.cand-chip-x {
    font-size: 14px;
    cursor: pointer;
    opacity: 0.6;
    line-height: 1;
}
.cand-chip-x:hover { opacity: 1; }

.cand-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1.5px solid #e4e6ec;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cand-list-item:hover { border-color: #4a7dff; box-shadow: 0 2px 10px rgba(74,125,255,0.1); }
.cand-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-shrink: 0;
    margin-right: 10px;
    background: #f9f9f9;
}
.cand-thumb-wrap {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-shrink: 0;
    margin-right: 10px;
    overflow: hidden;
    background: #f5f5f5;
}
.cand-thumb-no-img {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-shrink: 0;
    margin-right: 10px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #bbb;
    user-select: none;
}
.cand-thumb-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 1px solid #eee;
    background: #f5f5f5;
    flex-shrink: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cand-list-left { flex: 1; min-width: 0; }
.cand-list-name { font-size: 14px; font-weight: 700; color: #111; margin-bottom: 3px; }
.cand-list-meta { font-size: 11px; color: #999; line-height: 1.5; }
.cand-list-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cand-src-tag { background: #e8f0ff; color: #4a7dff; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.cand-arrow { font-size: 20px; color: #c0c8e0; font-weight: 300; }
.cand-score { background: #fff7ed; color: #e07b39; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.tray-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.price-hl { color: #111; font-weight: 700; }

/* Out row */
.out-row { display: flex; align-items: center; gap: 7px; padding-top: 10px; border-top: 1px solid #f0f0f0; }
.out-select {
    flex: 1; padding: 8px 10px; border: 1.5px solid #ddd;
    border-radius: 8px; font-size: 13px; background: #fafafa;
    outline: none; color: #333; min-width: 0;
}
.out-select:focus { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.1); }
.out-qty {
    width: 54px; padding: 7px 5px; text-align: center;
    border: 1.5px solid #ddd; border-radius: 8px;
    font-size: 13px; background: #fafafa; outline: none;
}
.out-qty:focus { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.1); }
.btn-out {
    padding: 8px 14px; border-radius: 8px; border: none;
    background: #22c55e; color: #fff; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.btn-out:hover { background: #16a34a; }
.btn-out:disabled { background: #c0c0c0; cursor: not-allowed; }

/* ==================== OUT-MANAGE TABS ==================== */
.outmanage-tabs {
    display: flex; gap: 5px; padding: 8px 14px;
    background: #fff; border-bottom: 1px solid #eee;
}
.outmanage-tab {
    padding: 6px 16px; border: none; border-radius: 20px;
    font-size: 13px; font-family: inherit; cursor: pointer;
    background: #f0f0f0; color: #666; transition: background 0.2s, color 0.2s;
    display: flex; align-items: center; gap: 5px;
}
.tab-icon-sm { width: 14px; height: 14px; flex-shrink: 0; }
.outmanage-tab.active { background: #4a7dff; color: #fff; font-weight: 600; }
.outmanage-body { overflow-y: auto; flex: 1; }

/* ==================== INVENTORY OVERVIEW ==================== */
.inv-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: #fafafa; border-bottom: 1px solid #eee;
}
.inv-search {
    flex: 1; padding: 7px 12px; border: 1.5px solid #ddd; border-radius: 8px;
    font-size: 13px; font-family: inherit; outline: none; background: #fff;
}
.inv-search:focus { border-color: #4a7dff; }
.inv-table-wrap { padding: 8px 14px; overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 580px; }
.inv-table th { text-align: left; padding: 8px 10px; color: #999; font-weight: 700; border-bottom: 2px solid #eee; white-space: nowrap; }
.inv-table td { padding: 9px 10px; border-bottom: 1px solid #f5f5f5; color: #333; }
.inv-table tr:hover td { background: #f9faff; }
.cell-name { font-weight: 700; }
.cell-sku { color: #4a7dff; font-family: monospace; font-size: 11px; }
.cell-total { font-weight: 800; font-size: 15px; text-align: center; }
.total-ok { color: #22c55e; }
.total-zero { color: #ccc; }
.cell-locs { color: #666; white-space: normal; }
.loc-tag { display: inline-block; background: #f0f4ff; color: #4a7dff; border-radius: 5px; padding: 1px 6px; font-size: 12px; margin: 1px; }
.text-muted { color: #ccc; font-size: 12px; }
.cell-qty { font-weight: 700; color: #222; text-align: center; }
.cell-time { color: #999; font-size: 12px; white-space: nowrap; }
.cell-loc { white-space: nowrap; color: #666; }
.empty-cell { text-align: center; color: #aaa; padding: 28px 0 !important; font-size: 13px; }

/* ==================== BUTTONS ==================== */
.btn-outline-sm {
    padding: 6px 12px; border: 1.5px solid #d8dbe4; border-radius: 8px;
    font-size: 12px; font-weight: 700; background: #fff; color: #444;
    display: inline-flex; align-items: center; gap: 5px;
    transition: all 0.2s; cursor: pointer;
}
.btn-icon-sm { width: 13px; height: 13px; flex-shrink: 0; }
.btn-outline-sm:hover { border-color: #4a7dff; color: #4a7dff; background: #f0f4ff; }

.btn-outline-md {
    padding: 10px 22px; border: 1.5px solid #d8dbe4; border-radius: 10px;
    font-size: 14px; font-weight: 700; background: #fff; color: #444;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s; cursor: pointer;
}
.btn-outline-md:hover { border-color: #4a7dff; color: #4a7dff; background: #f0f4ff; }

.btn-primary-md {
    padding: 10px 22px; border: none; border-radius: 10px;
    font-size: 14px; font-weight: 700; background: #4a7dff; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.2s; cursor: pointer; box-shadow: 0 3px 10px rgba(74,125,255,0.3);
}
.btn-primary-md:hover { background: #3560e8; }

.btn-op-sm {
    padding: 3px 10px; border-radius: 6px; border: none;
    font-size: 12px; font-weight: 700; cursor: pointer; margin-right: 4px;
    transition: background 0.2s;
}
.btn-op-sm.btn-op-in { background: #e8f0fe; color: #1565c0; }
.btn-op-sm.btn-op-in:hover { background: #d0e0fc; }
.btn-op-sm.btn-op-out { background: #e8f5e9; color: #2e7d32; }
.btn-op-sm.btn-op-out:hover { background: #d0ecd8; }

/* ==================== MANUAL OPS ==================== */
.manual-ops-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    padding: 12px 14px;
}

.op-card { background: #fff; border: 1.5px solid #eee; border-radius: 12px; overflow: hidden; }
.op-card-hd {
    padding: 10px 14px; font-size: 14px; font-weight: 700;
    border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 7px;
}
.op-icon { width: 16px; height: 16px; flex-shrink: 0; }
.op-card-body { padding: 12px 14px; }
.op-field { margin-bottom: 9px; }
.op-field label { display: block; font-size: 11px; font-weight: 700; color: #999; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.op-field select,
.op-field input {
    width: 100%; padding: 8px 10px;
    border: 1.5px solid #e0e2e8; border-radius: 8px;
    font-size: 13px; font-family: inherit; background: #fafafa;
    outline: none; box-sizing: border-box; color: #222;
}
.op-field select:focus,
.op-field input:focus { border-color: #4a7dff; background: #fff; box-shadow: 0 0 0 3px rgba(74,125,255,0.08); }

.btn-op {
    width: 100%; padding: 11px; border-radius: 10px;
    border: none; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background 0.2s; margin-top: 4px;
}
.btn-op-in { background: #4a7dff; color: #fff; box-shadow: 0 3px 10px rgba(74,125,255,0.3); }
.btn-op-in:hover { background: #3560e8; }
.btn-op-out { background: #22c55e; color: #fff; box-shadow: 0 3px 10px rgba(34,197,94,0.3); }
.btn-op-out:hover { background: #16a34a; }

.op-msg { margin-top: 7px; font-size: 13px; min-height: 18px; }
.msg-ok { color: #22c55e; font-weight: 600; }
.msg-err { color: #ef4444; font-weight: 600; }
.msg-loading { color: #999; }

.stock-info { background: #f8f9fa; border-radius: 8px; padding: 8px 10px; margin-bottom: 9px; }
.stock-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.stock-tag { display: inline-block; background: #e8f0fe; color: #1565c0; border-radius: 5px; padding: 2px 8px; font-size: 12px; font-weight: 600; }

/* ==================== HISTORY ==================== */
.hist2-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 14px; background: #fafafa;
    border-bottom: 1px solid #eee; flex-wrap: wrap;
}
.hist2-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist2-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.hist-filters { display: flex; gap: 5px; }
.hist-filter {
    padding: 4px 12px; border: 1.5px solid #ddd; border-radius: 14px;
    font-size: 12px; cursor: pointer; background: #fff; color: #555;
    font-family: inherit; transition: all 0.2s;
}
.hist-filter.active { background: #4a7dff; color: #fff; border-color: #4a7dff; }

.date-range { display: flex; align-items: center; gap: 5px; }
.date-range input {
    padding: 4px 8px; border: 1.5px solid #ddd; border-radius: 7px;
    font-size: 12px; font-family: inherit; outline: none; background: #fff;
}
.date-range input:focus { border-color: #4a7dff; }
.date-range span { font-size: 11px; color: #aaa; }

.hist-search {
    padding: 6px 10px; border: 1.5px solid #ddd; border-radius: 8px;
    font-size: 12px; font-family: inherit; outline: none; background: #fff; min-width: 140px;
}
.hist-search:focus { border-color: #4a7dff; }

.hist2-summary {
    display: flex; padding: 0 14px;
    border-bottom: 1px solid #eee; background: #fff;
}
.hist-sum-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 6px; border-right: 1px solid #f0f0f0;
}
.hist-sum-item:last-child { border-right: none; }
.hist-sum-label { font-size: 10px; color: #aaa; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.hist-sum-val { font-size: 17px; font-weight: 800; color: #333; margin-top: 2px; }
.hist-val-in { color: #22c55e !important; }
.hist-val-out { color: #ef4444 !important; }

.history-table-wrap { padding: 8px 14px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.history-table th { text-align: left; padding: 7px 10px; color: #999; font-weight: 700; border-bottom: 2px solid #eee; white-space: nowrap; }
.history-table td { padding: 8px 10px; border-bottom: 1px solid #f5f5f5; }
.history-table tr:hover td { background: #f9faff; }
.row-checked td { background: #f0f4ff !important; }

.col-check { width: 34px; text-align: center; }
.col-check input { width: 15px; height: 15px; cursor: pointer; accent-color: #4a7dff; }

.hist-tag { display: inline-block; padding: 2px 7px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.hist-in { background: #e8f5e9; color: #2e7d32; }
.hist-out { background: #fff3e0; color: #e65100; }

.sync-tag { display: inline-block; padding: 2px 7px; border-radius: 8px; font-size: 11px; }
.sync-ok { background: #e3f2fd; color: #1565c0; }
.sync-pending { background: #fff8e1; color: #f57f17; }

.hist2-batch-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; background: #fff8f8;
    border-top: 2px solid #ef4444; font-size: 13px; color: #ef4444; font-weight: 600;
}
.btn-del { padding: 4px 12px; border: 1.5px solid #ef4444; border-radius: 7px; background: transparent; color: #ef4444; font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 5px; }
.btn-del:hover { background: #fef0f0; }

.btn-del-sm { background: #fef5f5; color: #ef4444; border: none; border-radius: 5px; padding: 2px 7px; font-size: 11px; cursor: pointer; }
.btn-del-sm:hover { background: #fdd; }

.hist2-pager {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 8px 14px; border-top: 1px solid #eee; background: #fafafa;
}
.hist-page-info { font-size: 12px; color: #999; }

/* ==================== MODAL ==================== */
.modal-bg {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.modal-box {
    background: #fff; border-radius: 16px;
    width: 420px; max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
}
.modal-hd h3 { font-size: 16px; color: #111; font-weight: 800; }
.modal-close {
    width: 30px; height: 30px; border-radius: 8px; border: none;
    background: #f0f0f0; color: #888;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.2s;
}
.modal-close:hover { background: #eee; color: #333; }
.modal-bd { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-ft { padding: 12px 20px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 8px; }

.modal-field { display: flex; flex-direction: column; gap: 5px; }
.modal-field label { font-size: 12px; font-weight: 700; color: #444; }
.modal-field input {
    padding: 11px 14px; border: 1.5px solid #e0e2e8; border-radius: 10px;
    font-size: 14px; font-family: inherit; background: #fafafc; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-field input:focus { border-color: #4a7dff; background: #fff; box-shadow: 0 0 0 3px rgba(74,125,255,0.1); }
.modal-msg { font-size: 13px; min-height: 16px; }
.modal-msg.ok { color: #22c55e; }
.modal-msg.er { color: #ef4444; }

/* ==================== TOAST ==================== */
.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    padding: 12px 22px; border-radius: 12px;
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; gap: 9px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 99999; animation: toastIn 0.3s ease;
    white-space: nowrap;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast-success { background: #fff; color: #111; border: 1.5px solid #22c55e; }
.toast-error { background: #fff; color: #111; border: 1.5px solid #ef4444; }

.toast-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.toast-dot-success { background: #22c55e; }
.toast-dot-error { background: #ef4444; }

/* ==================== GALLERY ==================== */
.upload-gallery {
    margin-top: 14px;
    border: 1.5px solid #e0e2e8;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafc;
}
.gallery-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f2f5;
    border-bottom: 1px solid #e8eaee;
}
.gallery-title { font-size: 12px; font-weight: 700; color: #444; }
.gallery-close {
    background: none; border: none; color: #999;
    cursor: pointer; padding: 2px 5px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.gallery-close:hover { background: #e0e0e0; color: #333; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}
.gallery-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #e8eaee;
    background: #111;
    aspect-ratio: 1;
    transition: transform 0.15s, border-color 0.15s;
}
.gallery-item:hover { transform: scale(1.05); border-color: #4a7dff; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item-name { font-size: 10px; color: #666; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
.gallery-empty { padding: 16px; text-align: center; font-size: 12px; color: #aaa; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .upload-layout { grid-template-columns: 1fr; }
    .tab-btn span { display: none; }
    .tab-btn svg { width: 20px; height: 20px; }
    .chat-send-btn { width: 48px; height: 48px; }
}

/* ==================== 商品详情完整字段展示 ==================== */

/* 顶层：图片 + 基础档案 */
.erp-detail-top {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    align-items: flex-start;
}
.erp-detail-img-wrap {
    flex-shrink: 0;
    width: 80px;
}
.erp-detail-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    display: block;
}
.erp-detail-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}
.erp-thumb {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #ddd;
    cursor: pointer;
    opacity: 0.65;
}
.erp-thumb:hover { opacity: 1; border-color: #333; }
.erp-detail-base { flex: 1; min-width: 0; }
.erp-detail-name {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    line-height: 1.5;
    margin-bottom: 6px;
    word-break: break-all;
}
.erp-detail-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.erp-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid #ddd;
    color: #111;
    background: #fff;
}
.erp-base-row {
    display: flex;
    gap: 6px;
    font-size: 11px;
    line-height: 1.8;
}
.erp-base-label {
    color: #888;
    min-width: 68px;
    flex-shrink: 0;
}
.erp-base-value { color: #111; font-weight: 600; word-break: break-all; }

/* 板块标题（无 emoji，纯文字 + 左侧细线装饰） */
.erp-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 12px;
    letter-spacing: 0.3px;
}

/* 板块外层包裹：每组（标题+卡片）包一个 block，视觉上形成独立卡片 */
.erp-section-block {
    background: #fff;
    border: 1px solid #e4e6ec;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* 板块卡片框 */
.erp-section-card {
    background: #fff;
    border: 1px solid #e4e6ec;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

/* 字段分组网格（套在 erp-section-block 内部） */
.erp-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    padding: 8px 10px;
}
.erp-fields-subgroup {
    background: #fafbfc;
    border: 1px solid #e8ebf0;
    border-radius: 6px;
    padding: 0;
}
.erp-fields-subgroup-title {
    font-size: 11px;
    font-weight: 700;
    color: #4a7dff;
    padding: 6px 8px;
    border-bottom: 1px solid #e8ebf0;
    letter-spacing: 0.2px;
    grid-column: 1 / -1;
}

/* 价格高亮 */
.price-hl { color: #111; font-weight: 700; }

/* 仓库库存列表 */
.mcard-locs { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.mcard-loc {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 9px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 11px;
}
.tray-grid { grid-template-columns: 1fr 1fr !important; }
.loc-qty { font-weight: 700; font-size: 12px; }

/* 颜色变体 */
.color-variants { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.variant-item {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    padding: 5px 9px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 11px;
}
.variant-name { color: #111; font-weight: 600; }
.variant-sku { color: #888; font-size: 10px; }
.variant-price { color: #111; font-weight: 700; font-size: 12px; margin-left: auto; }

/* 订单表格 */
table tr:hover { background: #f9f9f9; }

/* ==================== AI 对话商品卡片（企业级） ==================== */

/* 智能搜索结果容器 */
.search-result-wrap {
    margin-top: 10px;
    background: #f8f9ff;
    border: 1px solid #e4ebff;
    border-radius: 12px;
    overflow: hidden;
}

/* 结果头部：标签 + 统计 */
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid #e8edff;
    background: #fff;
}
.result-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.result-badge-high {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
    border: 1px solid #86efac;
}
.result-badge-medium {
    background: linear-gradient(135deg, #fef9c3, #fef08a);
    color: #a16207;
    border: 1px solid #fde047;
}
.result-badge-single {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
    border: 1px solid #a5b4fc;
}
.result-badge-low {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #64748b;
    border: 1px solid #cbd5e1;
}
.result-count {
    font-size: 12px;
    color: #64748b;
}
.result-count strong {
    color: #334155;
    font-weight: 700;
}

/* 纠错提示条 */
.correction-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: 12px;
    color: #92400e;
}
.correction-banner svg { flex-shrink: 0; }
.correction-banner strong { color: #d97706; }

/* 骨架屏动画 */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton-card {
    background: #fff;
    border: 1px solid #e8edff;
    border-radius: 10px;
    padding: 10px;
    cursor: default;
}
.skeleton-img {
    width: 100%;
    height: 100px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f4ff 25%, #e8edff 50%, #f0f4ff 75%);
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    margin-bottom: 8px;
}
.skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f4ff 25%, #e8edff 50%, #f0f4ff 75%);
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    margin-bottom: 6px;
}
.skeleton-line.short { width: 60%; }
.skeleton-line.xshort { width: 40%; }

/* 商品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px 12px;
}
.product-card {
    background: #fff;
    border: 1.5px solid #e4ebff;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
.product-card:hover {
    box-shadow: 0 6px 24px rgba(74, 125, 255, 0.15);
    border-color: #4f8aff;
    transform: translateY(-2px);
}
.product-card:active {
    transform: translateY(0);
}

/* 卡片顶部：图片 + 相关度条 */
.product-img-wrap {
    position: relative;
    width: 100%;
    height: 110px;
    border-radius: 8px;
    background: #f5f7ff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.product-img-wrap .no-img {
    color: #c7d2fe;
    font-size: 12px;
    text-align: center;
}

/* 相关度进度条（卡片内） */
.confidence-bar-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.9);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}
.confidence-bar {
    height: 100%;
    border-radius: 0 0 0 8px;
    transition: width 0.6s ease;
}
.confidence-bar-high { background: linear-gradient(90deg, #22c55e, #4ade80); }
.confidence-bar-medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.confidence-bar-low { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }

/* 变体角标 */
.card-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(30, 41, 59, 0.72);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* 相关度标签（右上角） */
.card-conf-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}
.card-conf-high { background: rgba(34,197,94,0.88); color: #fff; }
.card-conf-medium { background: rgba(245,158,11,0.88); color: #fff; }
.card-conf-low { background: rgba(100,116,139,0.7); color: #fff; }

/* 商品名称 */
.product-name {
    font-size: 12px;
    color: #1e293b;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    margin-bottom: 5px;
    font-weight: 600;
}

/* 元信息行（品牌+条码） */
.product-meta-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}
.card-barcode {
    font-size: 10px;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
}
.card-brand {
    font-size: 10px;
    color: #4f8aff;
    font-weight: 600;
}

/* 价格+相关度行 */
.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}
.product-price {
    font-size: 15px;
    color: #ef4444;
    font-weight: 800;
}
.rel-score {
    font-size: 10px;
    font-weight: 700;
}

/* 分组标题 */
.group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 6px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}
.group-title-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4f8aff;
    flex-shrink: 0;
}

/* 查看更多按钮 */
.show-more-wrap {
    display: flex;
    justify-content: center;
    padding: 10px 12px 12px;
    background: #f8f9ff;
}
.show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: #fff;
    border: 1.5px solid #4f8aff;
    border-radius: 20px;
    color: #4f8aff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.show-more-btn:hover {
    background: #4f8aff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 138, 255, 0.35);
}
.show-more-btn.expanded {
    background: #f0f2ff;
    border-color: #c7d2fe;
    color: #6366f1;
}
.show-more-btn.expanded:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #4338ca;
    box-shadow: none;
}
.show-more-btn svg {
    transition: transform 0.25s;
}
.show-more-btn.expanded svg {
    transform: rotate(180deg);
}

/* 结果底部提示 */
.product-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    text-align: center;
    padding: 0 12px 8px;
}

/* 单品直达样式 */
.rcard-single {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f4ff, #e8edff);
    border: 1.5px solid #c7d2fe;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
    margin-top: 8px;
}
.rcard-single:hover {
    box-shadow: 0 4px 16px rgba(79, 138, 255, 0.2);
    border-color: #4f8aff;
}
.rcard-img-wrap {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rcard-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.rcard-info { flex: 1; min-width: 0; }
.rcard-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
}
.rcard-brand { font-size: 11px; color: #4f8aff; font-weight: 600; margin-bottom: 2px; }
.rcard-price { font-size: 14px; color: #ef4444; font-weight: 800; }
.rcard-action-hint { font-size: 10px; color: #94a3b8; margin-top: 3px; }

/* AI 置信度引导标签 */
.ai-reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.ai-conf-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
.ai-conf-high { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.ai-conf-medium { background: #fef9c3; color: #a16207; border: 1px solid #fde047; }
.ai-conf-low { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.ai-conf-none { background: #fff; color: #94a3b8; border: 1px solid #e2e8f0; }

/* 商品详情弹窗（聊天内嵌） */
.product-detail-popup {
    max-width: 340px;
}
.popup-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}
.popup-table {
    width: 100%;
    border-collapse: collapse;
}
.popup-table th {
    text-align: left;
    font-size: 11px;
    color: #999;
    padding: 4px 8px 4px 0;
    white-space: nowrap;
    width: 80px;
}
.popup-table td {
    font-size: 12px;
    color: #333;
    padding: 4px 0;
    word-break: break-all;
}

/* ==================== 商品详情侧边抽屉 ==================== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.drawer-overlay.open {
    pointer-events: all;
    opacity: 1;
}
.drawer-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 640px;
    max-width: 90vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
}
.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
}
.drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
}
.drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: background 0.15s, color 0.15s;
}
.drawer-close:hover {
    background: #fee2e2;
    color: #ef4444;
}
.drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px 24px;
    background: #fafafa;
}
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ==================== 智能问答 - single 模式 ==================== */
.rcard-single {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #fff 100%);
    border: 1px solid #dde4ff;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.rcard-single:hover {
    box-shadow: 0 3px 16px rgba(74,125,255,0.18);
    border-color: #4f8aff;
}
.rcard-img-wrap {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rcard-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rcard-img-wrap .no-img {
    font-size: 11px;
}
.rcard-info { flex: 1; min-width: 0; }
.rcard-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcard-brand { font-size: 11px; color: #888; margin-top: 2px; }
.rcard-price { font-size: 14px; font-weight: 700; color: #e53e3e; margin-top: 2px; }
.rcard-action-hint { font-size: 11px; color: #4f8aff; margin-top: 4px; }

/* ==================== 智能问答 - paginated 紧凑列表模式 ==================== */
.product-list-compact { margin-top: 8px; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.12s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #f5f7ff; }
.list-item-name { font-size: 13px; color: #222; flex: 1; }
.list-item-meta { display: flex; gap: 12px; font-size: 12px; color: #666; flex-shrink: 0; }

/* ==================== 商品详情四大卡片布局 ==================== */

/* 大卡片容器 */
.dcard {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e4e6ec;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 12px;
    /* overflow: hidden removed — allows flex children to auto-size */
}

/* 大卡片标题栏 */
.dcard-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}
.dcard-hd-icon {
    width: 16px;
    height: 16px;
    color: #4a7dff;
    flex-shrink: 0;
}

/* 大卡片内容区 */
.dcard-body {
    padding: 14px 16px;
}

/* ---- 卡片一：商品概览 ---- */
.dcard-overview-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.dcard-img-col {
    flex-shrink: 0;
    margin-right: 14px;
}
.dcard-img-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dcard-img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e8eaf0;
    display: block;
    cursor: pointer;
    background: #f8f9fc;
}
.dcard-img-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    border: 1px solid #e8eaf0;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #aaa;
}
.dcard-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.dcard-thumb {
    width: 26px;
    height: 26px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.dcard-thumb:hover { opacity: 1; }

.dcard-info-col { flex: 1; min-width: 0; }
.dcard-product-name {
    font-size: 17px;
    font-weight: 800;
    color: #111;
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-all;
}

.dcard-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.dcard-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.dcard-tag-green { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.dcard-tag-orange { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.dcard-tag-gray { background: #f5f5f5; color: #888; border: 1px solid #e0e0e0; }
.dcard-tag-blue { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.dcard-tag-purple { background: #f3e5f5; color: #7b1fa2; border: 1px solid #e1bee7; }
.dcard-tag-red { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.dcard-tag-teal { background: #e0f2f1; color: #00695c; border: 1px solid #b2dfdb; }

.dcard-core-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
}
.dcard-core-item {
    display: flex;
    gap: 6px;
    font-size: 11px;
    line-height: 1.8;
    align-items: baseline;
}
.dcard-core-label {
    color: #999;
    min-width: 60px;
    flex-shrink: 0;
}
.dcard-core-value {
    color: #222;
    font-weight: 600;
    word-break: break-all;
}

/* ---- 卡片二：档案信息（Tab 切换） ---- */
.dcard-profile-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
.dcard-tab-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #e0e4ec;
    background: #fafbfc;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.dcard-tab-btn:hover { border-color: #4a7dff; color: #4a7dff; background: #f0f4ff; }
.dcard-tab-btn.active { background: #4a7dff; color: #fff; border-color: #4a7dff; }

.dcard-tab-panel { display: none; }
.dcard-tab-panel.active { display: block; }

.dcard-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
}
.dcard-profile-item {
    display: flex;
    gap: 6px;
    font-size: 11px;
    line-height: 1.8;
    align-items: baseline;
    padding: 2px 0;
    border-bottom: 1px solid #f8f9fc;
}
.dcard-profile-label {
    color: #999;
    min-width: 70px;
    flex-shrink: 0;
}
.dcard-profile-value {
    color: #222;
    font-weight: 600;
    word-break: break-all;
}

/* ---- 通用：小标题行 ---- */
.dcard-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #4a7dff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    margin-top: 12px;
    padding-left: 6px;
    border-left: 2px solid #4a7dff;
}
.dcard-section-title:first-child { margin-top: 0; }

/* ---- 通用：两列网格 ---- */
.dcard-2col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
}
.dcard-2col-item {
    display: flex;
    gap: 6px;
    font-size: 11px;
    line-height: 1.8;
    align-items: baseline;
    padding: 2px 0;
    border-bottom: 1px solid #f8f9fc;
}
.dcard-2col-label {
    color: #999;
    min-width: 70px;
    flex-shrink: 0;
}
.dcard-2col-value {
    color: #222;
    font-weight: 600;
    word-break: break-all;
}
.dcard-price-value { color: #e53935; font-weight: 700; }
.dcard-qty-value { color: #2e7d32; font-weight: 700; }
.dcard-2col-total {
    background: #f0f4ff;
    border-radius: 6px;
    padding: 4px 8px !important;
    border: 1px solid #d0d8f8 !important;
    margin-top: 2px;
}

/* ---- 变体列表 ---- */
.dcard-variants-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dcard-variant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8f9fc;
    border: 1px solid #e8eaf0;
    border-radius: 7px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dcard-variant-item:hover { border-color: #4a7dff; background: #f0f4ff; }
.dcard-variant-name { font-size: 12px; font-weight: 600; color: #222; flex: 1; }
.dcard-variant-meta { font-size: 10px; color: #999; }
.dcard-variant-price { font-size: 12px; font-weight: 700; color: #e53935; margin-left: auto; }

/* ---- 表格 ---- */
.dcard-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #eee;
}
.dcard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    min-width: 1200px;
}
.dcard-table th {
    background: #f8f9fc;
    color: #999;
    font-weight: 700;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
.dcard-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
}
.dcard-table tr:last-child td { border-bottom: none; }
.dcard-table tr:hover td { background: #fafbff; }

/* ---- 空状态提示 ---- */
.dcard-empty-tip {
    font-size: 12px;
    color: #bbb;
    padding: 12px 0;
    text-align: center;
}

/* ==================== 多图识别布局 ==================== */
.recog-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 10px;
    padding: 10px 14px 14px;
    background: #fff;
}

.recog-left {
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    width: 300px;
    flex-shrink: 0;
    overflow: hidden;
}

.recog-right {
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* 图册 */
.recog-gallery {
    flex: 1;
    min-height: 0;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}
.recog-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 120px;
    color: #aaa;
    font-size: 12px;
}
.recog-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

/* 图册项 */
.gallery-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e4e6ec;
    background: #111;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.gallery-item:hover { border-color: #4a7dff; transform: scale(1.04); }
.gallery-item-active { border-color: #4a7dff !important; box-shadow: 0 0 0 2px rgba(74,125,255,0.25); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item-num {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    text-align: center;
}
.gallery-del-btn {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.gallery-item:hover .gallery-del-btn { opacity: 1; }
.gallery-del-btn:hover { background: #ef4444; }

.gallery-badge {
    position: absolute;
    top: 4px; left: 4px;
    border-radius: 50%;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}
.gallery-badge-loading { background: rgba(0,0,0,0.55); }
.gallery-badge-err { background: #ef4444; color: #fff; font-weight: 700; }

.spinner-sm {
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 加号上传按钮 */
.gallery-add-btn {
    width: 72px; height: 72px;
    border-radius: 8px;
    border: 2px dashed #c0c8e0;
    background: #f5f7ff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #4a7dff;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.gallery-add-btn:hover { border-color: #4a7dff; background: #eef2ff; }

/* 识别结果区 */
.recog-session-wrap { padding: 0 12px 12px; }

/* 候选表格 */
.recog-table-hint {
    font-size: 12px;
    color: #888;
    padding: 8px 0 6px;
}
.recog-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e4e6ec; }
.recog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 900px;
    background: #fff;
}
.recog-table thead th {
    text-align: left;
    padding: 9px 10px;
    background: #f8f9fc;
    color: #666;
    font-weight: 700;
    border-bottom: 2px solid #e4e6ec;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.recog-table tbody tr { transition: background 0.1s; }
.recog-table tbody tr:hover { background: #f5f7ff; }
.recog-table tbody tr:last-child td { border-bottom: none; }
.recog-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f2f5;
    color: #333;
    vertical-align: middle;
}
.recog-table-empty { text-align: center; color: #aaa; padding: 24px !important; font-size: 13px; }

/* 表格各列样式 */
.td-name { font-weight: 700; color: #111; max-width: 180px; }
.td-sku { font-family: monospace; font-size: 11px; color: #4a7dff; }
.td-qty { text-align: center; font-weight: 700; color: #16a34a; }
.td-price { font-weight: 700; color: #e53935; }
.td-profit { font-weight: 700; }
.td-barcode { font-family: 'Courier New', monospace; font-size: 11px; color: #888; }

/* session loading 状态 */
.recog-session-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
}
.recog-session-img-wrap {
    width: 80px; height: 80px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e4e6ec;
}
.recog-session-thumb { width: 100%; height: 100%; object-fit: cover; }

/* ==================== AI 聊天抽屉（右侧） ==================== */
.ai-chat-modal {
    position: fixed; inset: 0; z-index: 99999;
    pointer-events: none; opacity: 0;
    transition: opacity 0.3s ease;
}
.ai-chat-modal.open {
    pointer-events: all; opacity: 1;
}
.ai-chat-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
}
.ai-chat-box {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 620px; max-width: 85vw;
    background: #fff;
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0,0,0,0.18);
}
.ai-chat-modal.open .ai-chat-box {
    transform: translateX(0);
}
.ai-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
.ai-chat-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 600; color: #374151;
}
.ai-chat-close {
    width: 30px; height: 30px; border-radius: 8px; border: none;
    background: #e5e7eb; color: #6b7280; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: background 0.15s, color 0.15s;
}
.ai-chat-close:hover { background: #d1d5db; color: #374151; }

.ai-chat-thumb-wrap {
    width: 100%; height: auto; max-height: 300px;
    overflow: hidden; flex-shrink: 0;
    background: #f5f7ff;
    display: flex; align-items: center; justify-content: center;
}
.ai-chat-thumb-wrap img {
    width: 100%; height: auto; max-height: 300px;
    object-fit: contain;
}
.ai-chat-context-hint {
    padding: 10px 18px; font-size: 12px; color: #6b7280;
    background: #f8fafc; border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    display: flex; align-items: center; gap: 10px;
}
.ai-chat-img-preview {
    width: 48px; height: 48px;
    object-fit: cover; border-radius: 6px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.ai-chat-messages {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 16px 18px; display: flex; flex-direction: column; gap: 14px;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ai-msg-item {
    display: flex; align-items: flex-start; gap: 10px;
}
.ai-msg { flex-direction: row; }
.user-msg { flex-direction: row-reverse; }

.ai-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    color: #fff; font-size: 11px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ai-msg-bubble {
    max-width: 75%; padding: 10px 14px;
    border-radius: 14px; font-size: 13px; line-height: 1.6;
    word-break: break-all;
}
.ai-msg .ai-msg-bubble {
    background: #f0f2ff; color: #222;
    border-bottom-left-radius: 4px;
}
.user-msg .ai-msg-bubble {
    background: #4a7dff; color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-typing {
    display: flex; align-items: center; gap: 2px; padding: 12px 16px;
}
.ai-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: #8b95b8; animation: typingBounce 1.2s infinite;
}
.dot2 { animation-delay: 0.2s; }
.dot3 { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* AI 回复商品列表样式 */
.ai-intro-text {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 12px;
}
.ai-prod-list {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.ai-prod-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.15s;
}
.ai-prod-row:last-child {
    border-bottom: none;
}
.ai-prod-header {
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.ai-prod-row:not(.ai-prod-header):hover {
    background: #eef2ff;
}
.ai-prod-cell-num {
    width: 70px;
    flex-shrink: 0;
    text-align: center;
}
.ai-prod-cell-name {
    flex: 1;
    font-size: 13px;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-pick-icon {
    width: 18px;
    height: 18px;
    color: #d1d5db;
    flex-shrink: 0;
    margin-left: 8px;
    transition: color 0.15s;
}
.ai-prod-row:hover .ai-pick-icon {
    color: #4a7dff;
}
.ai-prod-extra {
    padding: 8px 14px;
    font-size: 12px;
    color: #6b7280;
    background: #fff;
}

.ai-chat-input-row {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-top: 1px solid #f0f2f5;
    background: #fafbfc; flex-shrink: 0;
}
.ai-chat-input {
    flex: 1; padding: 10px 14px;
    border: 1.5px solid #dde4f0; border-radius: 10px;
    font-size: 13px; font-family: inherit; outline: none;
    background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-chat-input:focus {
    border-color: #4a7dff;
    box-shadow: 0 0 0 3px rgba(74,125,255,0.1);
}
.ai-chat-input::placeholder { color: #b0b8cc; }
.ai-chat-send-btn {
    padding: 10px 18px; border-radius: 10px;
    border: none; background: #4a7dff; color: #fff;
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: background 0.15s;
    font-family: inherit; white-space: nowrap;
}
.ai-chat-send-btn:hover { background: #3660e8; }

/* ==================== 候选表格勾选列 ==================== */
.recog-table-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 0 6px; flex-wrap: wrap;
}
.recog-table-hint {
    font-size: 12px; color: #888;
}
.recog-table-checkbar {
    display: flex; align-items: center; gap: 6px;
}
.recog-check-count {
    font-size: 12px; color: #4a7dff; font-weight: 700;
}
.th-check { width: 36px; text-align: center; }
.th-num { width: 40px; text-align: center; }
.th-check input { width: 15px; height: 15px; cursor: pointer; accent-color: #4a7dff; }

.td-check { width: 36px; text-align: center; }
.td-check input { width: 15px; height: 15px; cursor: pointer; accent-color: #4a7dff; }
.td-num { text-align: center; font-weight: 700; color: #888; font-size: 11px; }

.cand-row { cursor: pointer; }
.cand-row-checked { background: #f0f4ff !important; }
.cand-row-checked td { background: #f0f4ff; }

@keyframes candFlash {
    0%, 100% { background: #fff; }
    30% { background: #dbeafe; }
    60% { background: #bfdbfe; }
}
.cand-row-flash {
    animation: candFlash 1.2s ease-in-out;
}

/* ==================== AI 聊天按钮 ==================== */
.ai-chat-btn-wrap {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 8px 0 0;
}
.cand-btn-ai {
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    color: #fff; border-color: transparent;
    padding: 8px 18px; font-size: 13px;
    box-shadow: 0 3px 12px rgba(74,125,255,0.3);
    display: inline-flex; align-items: center; gap: 7px;
}
.cand-btn-ai:hover { background: linear-gradient(135deg, #3660e8, #5850e8); box-shadow: 0 5px 18px rgba(74,125,255,0.4); }

.cand-btn-ai-lg {
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    color: #fff; border: none;
    padding: 10px 24px; font-size: 14px; font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(74,125,255,0.35);
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.cand-btn-ai-lg:hover {
    background: linear-gradient(135deg, #3660e8, #5850e8);
    box-shadow: 0 6px 24px rgba(74,125,255,0.45);
    transform: translateY(-1px);
}

.ai-toolbar-btn-wrap {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 10px 0 6px;
}

.recog-action-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 4px 8px;
    gap: 12px;
}
.recog-action-left { display: flex; align-items: center; }
.recog-action-right { display: flex; align-items: center; }

.cand-btn-confirm-lg {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff; border: none;
    padding: 10px 24px; font-size: 14px; font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(5,150,105,0.35);
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.cand-btn-confirm-lg:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #059669);
    box-shadow: 0 6px 24px rgba(5,150,105,0.45);
    transform: translateY(-1px);
}
.cand-btn-confirm-lg:disabled {
    opacity: 0.45; cursor: not-allowed;
}

.global-confirm-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, #065f46, #059669);
    border-top: 2px solid #10b981;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.global-confirm-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d1fae5;
    font-size: 15px;
}
.global-confirm-left strong {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
}
.global-confirm-right {}
.global-confirm-btn {
    background: #ffffff;
    color: #065f46;
    border: none;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.2s;
    font-family: inherit;
}
.global-confirm-btn:hover:not(:disabled) {
    background: #f0fdf4;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    transform: translateY(-1px);
}
.global-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 页面底部留白，防止内容被固定栏遮挡 */
body { padding-bottom: 68px; }
.cand-btn-outline-sm {
    padding: 5px 12px; border-radius: 7px; border: 1.5px solid #d0d8f0;
    font-size: 12px; font-weight: 700; background: #fff; color: #4a7dff;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.cand-btn-outline-sm:hover { background: #eef2ff; border-color: #4a7dff; }

/* ==================== AI 聊天左侧抽屉 ==================== */
.ai-drawer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.ai-drawer.open {
    pointer-events: all;
    opacity: 1;
}
.ai-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    animation: drawerOverlayIn 0.3s ease;
}
@keyframes drawerOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.ai-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 90vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
}
.ai-drawer.open .ai-drawer-panel {
    transform: translateX(0);
}
.ai-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f2f5;
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    flex-shrink: 0;
    flex-direction: row-reverse;
}
.ai-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}
.ai-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.ai-drawer-close:hover {
    background: rgba(255, 255, 255, 0.35);
}
.ai-drawer-thumb-wrap {
    width: 100%;
    height: auto;
    max-height: 300px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f7ff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-drawer-thumb-wrap img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}
.ai-drawer-context-hint {
    padding: 8px 18px;
    font-size: 12px;
    color: #666;
    background: #f8f9ff;
    border-bottom: 1px solid #eef0f8;
    flex-shrink: 0;
}
.ai-drawer-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafafa;
}
.ai-drawer-messages::-webkit-scrollbar {
    width: 4px;
}
.ai-drawer-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}
.ai-ref-link {
    color: #4a7dff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    padding: 1px 5px;
    border-radius: 4px;
    background: #eef2ff;
    border: 1px solid #d0d8f8;
    transition: background 0.15s, color 0.15s;
    display: inline-block;
    margin: 0 2px;
}
.ai-ref-link:hover {
    background: #4a7dff;
    color: #fff;
}
.ai-ref-invalid {
    color: #ccc;
    text-decoration: none;
}
/* AI 聊天 — 增强版回复样式 */
.ai-msg-line {
    margin-bottom: 6px;
    line-height: 1.6;
    word-break: break-word;
}
.ai-msg-line.ai-msg-empty {
    height: 4px;
    margin-bottom: 0;
}
.ai-msg-line.ai-msg-with-ref {
    line-height: 1.7;
}
.ai-table-wrap {
    overflow-x: auto;
    margin: 6px 0;
}
.ai-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ai-ref-table td,
.ai-ref-table th {
    border: 1px solid #e5e7eb;
    padding: 5px 10px;
    text-align: left;
}
.ai-ref-table th {
    background: #f9fafb;
    font-weight: 600;
}
.ai-table-row-clickable {
    cursor: pointer;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin: 4px 0;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.ai-table-row-clickable:hover {
    box-shadow: 0 2px 8px rgba(74, 125, 255, 0.15);
    border-color: #4a7dff;
}
.ai-table-row-clickable .ai-ref-table {
    margin: 0;
}
.ai-table-row-clickable .ai-ref-table td {
    background: #fff;
}
.ai-table-row-clickable:hover .ai-ref-table td {
    background: #f8faff;
}
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #f0f2f5;
    background: #fff;
    flex-shrink: 0;
}
.ai-drawer-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid #dde4f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-drawer-input:focus {
    border-color: #4a7dff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(74, 125, 255, 0.1);
}
.ai-drawer-input::placeholder {
    color: #b0b8cc;
}
.ai-drawer-send-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #4a7dff, #6c63ff);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(74, 125, 255, 0.3);
}
.ai-drawer-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(74, 125, 255, 0.4);
}
.ai-drawer-send-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   AI 智能选品 — 结构化表格 & 进度条
   ============================================================ */

/* 进度条容器 */
.ai-thinking-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    flex: 1;
}
.ai-progress-bar-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}
.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #34d399, #60a5fa);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}
.ai-progress-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    min-width: 130px;
}

/* 流式加载中的摘要区 */
.ai-stream-summary {
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
    line-height: 1.6;
    min-height: 20px;
    font-weight: 500;
}

/* 结构化结果表格 */
.ai-json-summary {
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
    line-height: 1.6;
    padding: 8px 12px;
    background: #f0f9ff;
    border-left: 3px solid #4a7dff;
    border-radius: 0 6px 6px 0;
}

.ai-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 6px;
}
.ai-result-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 7px 10px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.ai-result-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
    color: #1e293b;
}
.ai-result-row {
    cursor: pointer;
    transition: background 0.15s;
}
.ai-result-row:hover td {
    background: #eff6ff;
}
.ai-result-row:active td {
    background: #dbeafe;
}
.ai-result-row-missed td {
    color: #94a3b8;
    background: #f8fafc;
}
.ai-result-name {
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}
.ai-result-brand {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}
.ai-result-reason {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    max-width: 200px;
}

/* 置信度徽章 */
.ai-conf-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* AI 结果表格 — 匹配度分数 */
.ai-score {
    font-family: "Consolas", "Fira Code", monospace;
    font-weight: 700;
    color: #1e293b;
    font-size: 13px;
}
.ai-index {
    font-family: "Consolas", "Fira Code", monospace;
    font-weight: 800;
    color: #4a7dff;
    font-size: 12px;
}

/* 错误消息 */
.ai-msg-error .ai-msg-bubble {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca;
}

/* Loading 动画（来自 Csv-AISearch） */
.ai-modal-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    font-size: 12px;
    color: #6b7280;
}
.ai-modal-typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7280;
    animation: typingBounce 1.2s infinite;
}
.ai-modal-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-modal-typing .dot:nth-child(3) { animation-delay: 0.4s; }

/* AI 气泡白色背景（表格用） */
.ai-bubble-white {
    background: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

/* 表格白底 */
.ai-result-table-white {
    background: #ffffff;
}
.ai-result-table-white th {
    background: #f1f5f9;
}

/* 用户头像 */
.ai-avatar-user {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    flex-shrink: 0;
}

