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

:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --success: #16a34a;
    --success-light: #dcfce7;
    --info: #0891b2;
    --info-light: #cffafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Microsoft YaHei', sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
    /* 竖排：顶部横幅（示例数据警告）出现时，下面的内容自动让位，不会被顶出屏幕 */
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    /* 原来是 height: 100vh —— 改成"占满剩余高度"，这样横幅出现/消失都不会挤坏布局 */
    flex: 1 1 auto;
    min-height: 0;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 220px;
    background: var(--gray-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon { font-size: 28px; }
.logo-text { font-size: 14px; font-weight: 600; line-height: 1.4; }

.nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    text-decoration: none;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item span { font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 24px;
}

.stat-item { text-align: center; }
.stat-num { display: block; font-size: 20px; font-weight: 700; color: #fff; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.5); }

/* ===== 主内容区 ===== */
.main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.page { display: none; flex: 1; flex-direction: column; padding: 24px; }
.page.active { display: flex; }

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

.page-header h2 { font-size: 20px; font-weight: 600; }

.badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* ===== 聊天 ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.chat-header { margin-bottom: 16px; }
.chat-header h2 { font-size: 20px; margin-bottom: 4px; }
.chat-hint { color: var(--gray-500); font-size: 13px; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-bottom: 12px;
    min-height: 300px;
}

.msg { display: flex; gap: 12px; margin-bottom: 20px; }
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}
.msg.bot .msg-avatar { background: var(--primary); color: #fff; }
.msg.user .msg-avatar { background: var(--gray-300); color: var(--gray-700); }

.msg-content { max-width: 75%; }
.msg-body {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 16px;
    white-space: pre-wrap;
    line-height: 1.6;
}
.msg.user .msg-body { background: var(--primary-light); border-color: var(--primary); }

/* 回复元信息标签 */
.msg-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.tag.intent { background: var(--info-light); color: var(--info); }
.tag.sku { background: var(--primary-light); color: var(--primary); }
.tag.transfer { background: var(--danger-light); color: var(--danger); }
.tag.safe { background: var(--success-light); color: var(--success); }

.reply-section {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}
.reply-en {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
    margin-bottom: 6px;
}
.reply-cn {
    background: var(--gray-50);
    border-left: 3px solid var(--gray-300);
    color: var(--gray-500);
}
.reply-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 4px;
    display: block;
}

.quick-prompts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.quick-prompts button {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}
.quick-prompts button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chat-input-area { display: flex; gap: 12px; }
#chatInput {
    flex: 1;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}
#chatInput:focus { outline: none; border-color: var(--primary); }

/* ===== 按钮 ===== */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.btn-edit { background: var(--primary-light); color: var(--primary); }
.btn-delete { background: var(--danger-light); color: var(--danger); }

/* ===== 表格 ===== */
.table-wrap {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--gray-50);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
}
.data-table tr:hover { background: var(--gray-50); }

.status-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.status-在售 { background: var(--success-light); color: var(--success); }
.status-pending { background: var(--warning-light); color: var(--warning); }
.status-停售 { background: var(--danger-light); color: var(--danger); }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
}
.faq-item-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}
.faq-sku-tag {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.faq-q { font-weight: 600; margin-bottom: 6px; color: var(--gray-800); }
.faq-a { color: var(--gray-700); line-height: 1.6; }

/* ===== 品类能力卡片 ===== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}
.cat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px;
}
.cat-card h3 { font-size: 15px; margin-bottom: 12px; color: var(--primary); }
.cat-card dl { font-size: 13px; }
.cat-card dt { font-weight: 600; color: var(--gray-500); margin-top: 8px; }
.cat-card dd { margin-left: 0; line-height: 1.5; color: var(--gray-700); }

/* ===== 参数表单 ===== */
.params-container {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 700px;
}
.param-section { margin-bottom: 24px; }
.param-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-200);
}
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== 权限边界卡片 ===== */
.rules-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
}
.rule-card {
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid;
}
.rule-card.danger { background: var(--danger-light); border-color: #fca5a5; }
.rule-card.warning { background: var(--warning-light); border-color: #fcd34d; }
.rule-card.info { background: var(--info-light); border-color: #67e8f9; }
.rule-card h3 { font-size: 15px; margin-bottom: 12px; }
.rule-card ul { list-style: none; }
.rule-card li {
    padding: 6px 0;
    line-height: 1.5;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.rule-card li:last-child { border-bottom: none; }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.show {
    display: flex !important;
}
.modal-content {
    background: #fff;
    border-radius: var(--radius);
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-large { width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 17px; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
}
.modal-body { padding: 20px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }

/* ===== 微信助手 ===== */
.wechat-status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
}
.status-dot.active { background: var(--success); }
.status-dot.error { background: var(--danger); }

.wechat-setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    .wechat-setup { grid-template-columns: 1fr; }
}
.wechat-section {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px;
}
.wechat-section h3 { font-size: 15px; margin-bottom: 10px; }
.wechat-hint { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.wechat-section textarea {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.wechat-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}
.autofill-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.wechat-guide {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.8;
    padding-left: 20px;
}
.wechat-warn {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--warning-light);
    border-radius: 6px;
    font-size: 12px;
    color: var(--warning);
    line-height: 1.5;
}

.wechat-log-section {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px;
}
.wechat-log-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.wechat-log {
    max-height: 500px;
    overflow-y: auto;
}
.wechat-log-empty {
    text-align: center;
    color: var(--gray-500);
    padding: 40px 0;
}
.wc-log-item {
    border-bottom: 1px solid var(--gray-100);
    padding: 12px 0;
}
.wc-log-item:last-child { border-bottom: none; }
.wc-log-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.wc-log-contact {
    font-weight: 600;
    font-size: 13px;
}
.wc-log-time {
    font-size: 11px;
    color: var(--gray-500);
}
.wc-log-msg {
    font-size: 13px;
    margin-bottom: 4px;
}
.wc-log-msg .label {
    font-weight: 600;
    color: var(--gray-500);
}
.wc-log-reply {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 6px;
    white-space: pre-wrap;
}
.wc-log-cn {
    background: var(--gray-50);
    border-left: 3px solid var(--gray-300);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}
.wc-log-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.wc-log-filled {
    font-size: 11px;
    color: var(--success);
    font-weight: 600;
}
.wc-log-transfer {
    font-size: 11px;
    color: var(--danger);
    font-weight: 600;
}
.wc-log-sys {
    font-size: 12px;
    color: var(--gray-500);
    padding: 6px 0;
}
.wc-log-sys.error { color: var(--danger); }
.wc-log-sys.warning { color: var(--warning); }
.wc-log-sys.info { color: var(--info); }

/* ===== 顶部横幅：示例数据警告 =====
   常驻、通栏、深红 —— 因为它是"现在报的价是编的"这种级别的信息，
   不该藏在某个页面里。真实数据核对好之后，后端不再返回它，这里自然就收起来了。 */
.top-banner {
    display: none;            /* 默认隐藏；后端说 demo_data=true 时由 JS 改成 flex */
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 16px;
    background: #7f1d1d;
    color: #fee2e2;
    font-size: 13px;
    line-height: 1.5;
}

/* ===== 运维页 ===== */
.ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.ops-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
}

.ops-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--gray-800);
}

.ops-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--gray-200);
    font-size: 13px;
}

.ops-row:last-child { border-bottom: none; }

.ops-ok { color: var(--success); font-weight: 600; }
.ops-bad { color: var(--danger); font-weight: 600; }

.ops-note {
    color: var(--gray-500);
    font-size: 12px;
    line-height: 1.7;
}

.ops-pre {
    margin-top: 12px;
    padding: 12px;
    background: #0f172a;
    color: #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.6;
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.ops-form input[type="text"] {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
}

.ops-form input[type="file"] { margin-bottom: 10px; font-size: 13px; }

/* ===== 对话日志 ===== */
.tr-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tr-right { margin-left: auto; }

.tr-tab {
    padding: 6px 14px;
    border: 1px solid var(--gray-300);
    background: #fff;
    border-radius: 999px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
}

.tr-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.tr-item { border-left: 4px solid var(--gray-300); }

.tr-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 12px;
}

.tr-when { color: var(--gray-500); }

.tr-src {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 1px 8px;
    border-radius: 999px;
}

.tr-tag { padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.tr-tag.tr-normal { background: var(--success-light); color: var(--success); }
.tr-tag.tr-wrong { background: var(--danger-light); color: var(--danger); }
.tr-tag.tr-resolved { background: var(--info-light); color: var(--info); }

.tr-cd { color: var(--gray-500); }
.tr-fb { color: var(--warning); font-weight: 600; }

.tr-block {
    display: flex;
    gap: 8px;
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.65;
    color: var(--gray-800);
}

.tr-k {
    flex: 0 0 34px;
    color: var(--gray-500);
    font-size: 12px;
    padding-top: 2px;
}

.tr-nodraft { color: var(--warning); font-weight: 600; }
.tr-note { color: var(--gray-700); }

.tr-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

.tr-acts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-del {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.tr-rerun {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--gray-700);
}

/* ===== 知识库体检（产品目录页顶部）===== */
.kb-issues { margin-bottom: 14px; }

.kb-issues-head {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #7f1d1d;
    color: #fee2e2;
    padding: 10px 14px;
    border-radius: 8px 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

.kb-issues-head > span { flex: 1; }

.kb-refresh {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.kb-refresh:hover { background: rgba(255, 255, 255, .3); }
.kb-refresh:disabled { opacity: .6; cursor: default; }

.kb-clickable { cursor: pointer; }
.kb-clickable:hover { background: var(--gray-50); }
.kb-clickable:hover .kb-issue-what { text-decoration: underline; }

/* 从体检条目跳过来时，那一行要一直看得见 ——
   底色常驻，直到你编辑完这一行（或点了另一条冲突）才取消。
   ⚠️ 不要在这种"需要长期保留"的状态上用一次性动画：
   动画播完样式就回到原样，用户看到的就是"闪一下就没"。 */
#productsTable tbody tr.row-jump-stay {
    background: #fef3c7 !important;
    box-shadow: inset 0 0 0 2px var(--warning);
}

#productsTable tbody tr.row-jump-stay td:first-child {
    border-left: 4px solid var(--warning);
    font-weight: 800;
}

/* 到达时闪两下做提示，闪完仍然停在黄色底上 */
#productsTable tbody tr.row-jump {
    animation: rowjump 0.9s ease-in-out 2;
}

@keyframes rowjump {
    0%, 100% { background: #fef3c7; }
    50% { background: #fbbf24; }
}

.kb-issue {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: none;
    padding: 10px 14px;
}

.kb-issue:last-child { border-radius: 0 0 8px 8px; }
.kb-error { border-left: 4px solid var(--danger); }
.kb-warn { border-left: 4px solid var(--warning); }

.kb-issue-what {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.6;
}

.kb-issue-detail {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.75;
    color: var(--gray-500);
}

/* 每条体检结果右边一个「忽略」按钮 */
.kb-issue-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.kb-issue-main { flex: 1; min-width: 0; }

.kb-issue-acts { flex: 0 0 auto; }

.kb-ignore {
    background: #fff;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.kb-ignore:hover { border-color: var(--gray-500); color: var(--gray-800); }
.kb-ignore:disabled { opacity: .55; cursor: default; }

.kb-ignored { opacity: .55; }
.kb-ignored .kb-issue-what { font-weight: 400; }

.kb-ignored-toggle {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--gray-600);
    cursor: pointer;
}

.kb-ignored-toggle:hover { background: var(--gray-200); }

/* 数据里没有的字段，显示成浅灰的"未填"，一眼能看出是缺口而不是内容 */
.cell-empty {
    color: var(--gray-400);
    font-style: italic;
    font-size: 12px;
}

.cell-warn { color: var(--warning); font-weight: 600; font-size: 12px; }

/* ===== 产品目录的筛选 / 排序工具条 ===== */
.prod-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.prod-search {
    flex: 1 1 240px;
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
}

.prod-toolbar select {
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--gray-800);
}

.prod-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

/* 批量改那一行：视觉上从上面的筛选条里分出来 */
.prod-bulk {
    margin-top: -4px;
    padding: 8px 10px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
}

.bulk-label { color: var(--gray-600); }
.bulk-hint { font-size: 12px; color: var(--gray-400); }

.bulk-input {
    padding: 7px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    min-width: 200px;
}

/* ===== 检索调试页 ===== */
.sd-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sd-form input[type="text"] {
    flex: 1 1 320px;
    min-width: 220px;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
}

.sd-check { font-size: 12px; color: var(--gray-600); white-space: nowrap; }
.sd-hint { color: var(--gray-400); font-size: 11px; }

.sd-result { margin-top: 12px; }

.sd-hero {
    padding: 10px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 12px;
}

.sd-line { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.sd-line span { color: var(--gray-500); }
.sd-line strong { font-size: 15px; color: var(--primary); }
.sd-mode { margin-top: 4px; font-size: 13px; color: var(--gray-800); }
.sd-meta { margin-top: 4px; font-size: 12px; color: var(--gray-500); line-height: 1.7; }

.sd-rewrite, .sd-note {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.sd-rewrite { background: #eff6ff; border: 1px solid #bfdbfe; }
.sd-note { background: #fffbeb; border: 1px solid #fde68a; }

.sd-rewrite pre, .sd-note pre {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .75);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: Consolas, monospace;
}

.sd-rank-head {
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.sd-table td { font-size: 12px; }
.sd-why { color: var(--gray-500); white-space: normal; max-width: 420px; }

/* 行首勾选框 + 表头全选 */
#productsTable .row-check,
#productsTable .th-check input {
    vertical-align: middle;
    margin-right: 6px;
    cursor: pointer;
}

#productsTable .th-check { cursor: pointer; white-space: nowrap; }

/* ===== 产品表单底部的按钮行（管理字段 / 保存）===== */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-200);
}

.btn-ghost {
    background: #fff;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 字段管理弹窗 ===== */
.fm-add {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.fm-add input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
}

.fm-list {
    margin-top: 12px;
    max-height: 52vh;
    overflow: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.fm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--gray-100);
}

.fm-row:last-child { border-bottom: none; }
.fm-name { flex: 1; min-width: 0; font-size: 13px; color: var(--gray-800); }
.fm-acts { flex: 0 0 auto; }

.fm-key {
    margin-left: 8px;
    font-size: 11px;
    color: var(--gray-400);
    font-family: Consolas, monospace;
}

.fm-hint { margin-top: 2px; font-size: 11px; color: var(--gray-500); }
.fm-lock { font-size: 12px; color: var(--gray-400); }
.fm-hidden { opacity: .5; }
.fm-hidden .fm-name strong { text-decoration: line-through; }

/* 表格单元格里的第二行：源表的「描述」（英文描述 / 中文描述） */
.cell-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.5;
}

/* ============================================================
   产品目录：一张 27 列的宽表
   ============================================================
   两个诉求：
     · 往下滚看产品时，表头要一直在（不然看到第 20 行就忘了哪列是什么）
     · 每个产品的字段要全部显示出来，列多就横向滚

   实现要点：
     ① 表头吸顶（position: sticky）**要求滚动容器就是外框自己** ——
        所以给 .table-wrap 一个高度上限，让纵向滚动发生在框内；
        横向也在这个框里滚，不用整页左右晃。
     ② 再把首列（SKU）钉在左边、末列（操作）钉在右边 ——
        横向滚到中间时，你还知道这是哪个产品、还能直接点编辑。
     ③ 固定列的单元格必须有不透明底色，否则下面的内容会透出来。
   ============================================================ */
#productsWrap {
    max-height: 68vh;
    overflow: auto;
}

#productsTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--gray-50);
    box-shadow: inset 0 -1px 0 var(--gray-200);
    white-space: nowrap;
}

/* 列多，默认不换行（换行会把行高搞得参差不齐）；例外见 .wrap-cell */
#productsTable td, #productsTable th { white-space: nowrap; }

/* 长文本列允许换行并限宽，否则一个"注意事项"就能把表撑到几千像素 */
#productsTable td.wrap-cell {
    white-space: normal;
    min-width: 160px;
    max-width: 260px;
    line-height: 1.6;
}

/* 首列固定 */
#productsTable th:first-child,
#productsTable td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: inset -1px 0 0 var(--gray-200);
}

#productsTable thead th:first-child { z-index: 4; background: var(--gray-50); }

/* 末列（操作）固定 */
#productsTable th:last-child,
#productsTable td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: inset 1px 0 0 var(--gray-200);
}

#productsTable thead th:last-child { z-index: 4; background: var(--gray-50); }

#productsTable td.op-cell { white-space: nowrap; padding: 8px 10px; }
#productsTable td.op-cell .btn-sm { margin-right: 4px; }

/* 跳转高亮时，两个固定列也要跟着变黄（它们有独立底色，否则会露出白底） */
#productsTable tbody tr.row-jump-stay td,
#productsTable tbody tr.row-jump td {
    background: #fef3c7 !important;
}

/* ===== 环境管理（运维页） ===== */
.env-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 0;
    flex-wrap: wrap;
}

.env-row > span:first-child { color: var(--gray-500); min-width: 92px; }
.env-row code {
    background: var(--gray-100);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
}

.env-running { color: var(--gray-400); font-size: 12px; }

.env-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.env-versions { margin-top: 6px; }

.env-ver {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    background: #fff;
}

.env-ver-cur { background: #f0fdf4; border-color: #86efac; }
.env-when { color: var(--gray-400); font-size: 12px; margin-left: auto; }
.env-badge { color: var(--success); font-weight: 600; font-size: 12px; }

.env-result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.env-result pre {
    margin: 6px 0 0;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.7;
    font-family: Consolas, monospace;
}

.env-pending { background: #fffbeb; border: 1px solid #fde68a; }
.env-ok { background: #f0fdf4; border: 1px solid #86efac; }
.env-fail { background: #fef2f2; border: 1px solid #fecaca; }
/* ===== 运维页：内部标签 + 密码锁 ===== */
.ops-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
}

.ops-tab {
    padding: 6px 14px;
    border: 1px solid var(--gray-300);
    background: #fff;
    border-radius: 999px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
}

.ops-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.ops-tab-right { margin-left: auto; }

.ops-lock {
    max-width: 460px;
    margin: 40px auto;
    padding: 28px 26px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    text-align: center;
}

.ops-lock-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.ops-lock h3 { margin: 0 0 10px; font-size: 17px; color: var(--gray-800); }
.ops-lock .ops-note { text-align: left; line-height: 1.8; }

.ops-lock-form {
    display: flex;
    gap: 8px;
    margin: 16px 0 8px;
}

.ops-lock-form input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

#opsLockMsg { min-height: 18px; color: var(--danger); font-size: 12px; text-align: left; }
/* ===== 批量导入 ===== */
.imp-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.imp-form input[type="file"] {
    font-size: 13px;
    padding: 6px 0;
}

.imp-result { margin-top: 12px; }

.imp-file {
    font-size: 13px;
    color: var(--gray-700);
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 10px;
}

.imp-summary { display: flex; gap: 10px; margin: 10px 0; }
.imp-summary span {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.imp-new { background: #dcfce7; color: #15803d; }
.imp-upd { background: #fef3c7; color: #b45309; }
.imp-same { background: var(--gray-100); color: var(--gray-500); }

.imp-table td { font-size: 12px; }
.imp-detail { color: var(--gray-600); white-space: normal; max-width: 460px; }
.imp-src { color: var(--gray-400); font-size: 11px; white-space: nowrap; }

.imp-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.imp-ack {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
}

.imp-ack input { margin-right: 6px; }
/* ===== 待确认区（产品目录页）===== */
.pending-box {
    border: 2px solid #fbbf24;
    background: #fffbeb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.pending-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: 10px;
}

.pending-tip { color: var(--gray-600); font-size: 13px; }
.pending-stat { display: flex; gap: 8px; }
.pending-stat span { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pending-actions { margin-left: auto; display: flex; gap: 8px; }
.pending-toolbar { margin: 8px 0; }
.pending-wrap { max-height: 46vh; }
.pending-wrap .data-table th, .pending-wrap .data-table td { font-size: 12px; }
.pending-row-actions { white-space: nowrap; }
.pending-row-actions .btn-sm { margin-right: 4px; }
.col-check { width: 34px; text-align: center; }

/* ===== 批量导入面板（产品目录页）===== */
.imp-panel {
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.imp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
}
/* 危险操作按钮（批量删除之类）—— 视觉上就要让人停一下 */
.btn-danger {
    padding: 8px 16px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-danger:hover { background: #b91c1c; }
/* 页头右侧的按钮组。
   ⚠️ 必须包一层：.page-header 用的是 justify-content: space-between，
      直接往里塞多个按钮会被摊开（"批量导入"就会跑到屏幕中间去）。
      包起来之后整组贴右，按钮之间用 gap 保持间距。 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
/* 知识库体检的"收起/展开"按钮 —— 和「重新检测」长一样，免得两个按钮风格不一致 */
/* ⚠️ 必须和 .kb-refresh 长一样：它们都长在 .kb-issues-head 那条**深色**标题栏上。
   第一版写成白底深字，在深色条上非常突兀。 */
.kb-collapse {
    flex: 0 0 auto;
    margin-left: 8px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.kb-collapse:hover { background: rgba(255, 255, 255, .28); }

/* 收起时只留标题栏，条目整体藏起来 */
.kb-issues-body { margin-top: 8px; }