/* ============================================================
   文飞科技工作台 - 样式
   ============================================================ */

/* --- 基础重置 --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --bg: #f1f5f9;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* --- 登录页 --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
}

.login-card {
    width: 400px;
    background: var(--bg-white);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder { color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
/* 需要占满整行的按钮（如登录）显式加 .btn-block */
.btn-block { width: 100%; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12.5px;
}

.btn-outline {
    background: var(--bg-white);
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-warning {
    background: #f59e0b;
    color: white;
}
.btn-warning:hover { background: #d97706; }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #16a34a; }

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: none;
}

.login-error.show { display: block; }

/* --- 管理布局 --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* --- 侧边栏 --- */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.sidebar-header .version {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: 0 10px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-detail { min-width: 0; }

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.logout-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.logout-btn:hover { color: white; }

/* --- 主内容区 --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: var(--bg-white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
}

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

.page-body {
    flex: 1;
    padding: 24px 32px;
}

/* --- 仪表盘 --- */
.dashboard-welcome {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    margin-bottom: 24px;
}

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

.dashboard-welcome h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.dashboard-welcome p {
    color: var(--text-secondary);
    font-size: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; }
.stat-icon.green { background: #f0fdf4; }
.stat-icon.amber { background: #fffbeb; }
.stat-icon.purple { background: #faf5ff; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.module-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.module-card .module-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.module-card h4 {
    font-size: 15px;
    margin-bottom: 6px;
}

.module-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* --- 表格 --- */
.table-container {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-toolbar {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.table-toolbar h3 {
    font-size: 16px;
    font-weight: 600;
}

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

thead th {
    background: #f8fafc;
    padding: 12px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* --- HR 员工列表：表头排序 + 列筛选（2026-09-19） --- */
.hr-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.hr-table th.sortable:hover { color: var(--primary); }
.hr-table th.hr-seq-col,
.hr-table td.hr-seq-col {
    width: 56px;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.hr-table th.hr-ops-col,
.hr-table td.hr-ops-col { width: 72px; white-space: nowrap; }
.hr-table .hr-filter-row th {
    padding: 6px 12px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.hr-table .hr-filter-row th:first-child { padding-left: 20px; }
.hr-table select.hr-col-filter {
    width: 100%;
    min-width: 82px;
    height: auto;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

/* --- 档案列表：表头排序 + 列筛选（2026-09-19） --- */
.ar-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.ar-table th.sortable:hover { color: var(--primary); }
.ar-table th.ar-seq-col,
.ar-table td.ar-seq-col {
    width: 56px;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.ar-table th.ar-ops-col,
.ar-table td.ar-ops-col { width: 132px; white-space: nowrap; }
.ar-table .ar-filter-row th {
    padding: 6px 12px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.ar-table .ar-filter-row th:first-child { padding-left: 20px; }
.ar-table select.ar-col-filter {
    width: 100%;
    min-width: 82px;
    height: auto;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #eff6ff;
    color: #2563eb;
}

.badge-user {
    background: #f1f5f9;
    color: #64748b;
}

.badge-hr {
    background: #fef3c7;
    color: #d97706;
}

.badge-active {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-inactive {
    background: #fef2f2;
    color: #dc2626;
}

/* --- 弹窗 --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 32px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 24px;
}

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

/* --- 通用弹窗内容盒（档案库预览 / 员工附件预览共用） --- */
.modal-box {
    background: var(--bg-white);
    border-radius: 12px;
    width: 860px;
    max-width: 94vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-close {
    background: none;
    border: 0;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 16px 18px;
    overflow: auto;
}

/* --- Toast --- */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--text); }

/* --- 加载 --- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* --- CRM 客户卡片 --- */
.customer-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.customer-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 4px solid transparent;
}

.customer-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.customer-card.level-战略客户 { border-left-color: #ef4444; }
.customer-card.level-重点客户 { border-left-color: #f59e0b; }
.customer-card.level-普通客户 { border-left-color: #3b82f6; }
.customer-card.level-潜在客户 { border-left-color: #94a3b8; }

.customer-card-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.customer-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.customer-card-project {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.customer-card-body {
    padding: 14px 20px;
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.customer-card-body span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.customer-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- 客户级别标签 --- */
.level-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.level-tag.战略客户 { background: #fef2f2; color: #dc2626; }
.level-tag.重点客户 { background: #fffbeb; color: #d97706; }
.level-tag.普通客户 { background: #eff6ff; color: #2563eb; }
.level-tag.潜在客户 { background: #f1f5f9; color: #64748b; }

/* --- 状态标签 --- */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-tag.合作中 { background: #f0fdf4; color: #16a34a; }
.status-tag.洽谈中 { background: #fffbeb; color: #d97706; }
.status-tag.暂停 { background: #fef2f2; color: #dc2626; }
.status-tag.已终止 { background: #f1f5f9; color: #94a3b8; }
.status-tag.潜在 { background: #eff6ff; color: #2563eb; }

/* --- 档案表单 --- */
.profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.profile-tab {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.profile-panel { display: none; }
.profile-panel.active { display: block; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.form-group.inline {
    display: flex;
    align-items: center;
    gap: 12px;
}
.form-group.inline label {
    margin-bottom: 0;
    white-space: nowrap;
    min-width: 80px;
}

/* --- 部门/联系人卡片 --- */
.section-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.section-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.section-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-item-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.section-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.section-item-grid .form-group {
    margin-bottom: 0;
}

.section-item-grid .form-group label {
    font-size: 12px;
    margin-bottom: 3px;
}

.section-item-grid .form-input {
    height: 36px;
    font-size: 13px;
    padding: 0 10px;
}

/* --- 审核对比 --- */
.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.diff-container .diff-label {
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.diff-old {
    background: #fef2f2;
    padding: 10px 14px;
    font-size: 13px;
    color: #dc2626;
    text-decoration: line-through;
}

.diff-new {
    background: #f0fdf4;
    padding: 10px 14px;
    font-size: 13px;
    color: #16a34a;
}

/* --- 项目分组 --- */
.crm-search-bar {
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.crm-search-bar .btn {
    flex-shrink: 0;
    white-space: nowrap;
}
.crm-search-bar .form-input {
    flex: 1 1 auto;
    width: auto;
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input, var(--bg));
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.crm-search-bar .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.project-group {
    margin-bottom: 28px;
}

.project-group-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-group-title .count {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

/* --- 审核页分组 --- */
.audit-group {
    margin-bottom: 20px;
}

.audit-group-header {
    background: var(--primary-light);
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-group-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.audit-group-body {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 16px 20px;
}

.audit-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

/* --- 驾驶舱树图 --- */
.tree-container {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 40px;
    overflow: auto;
    min-height: 500px;
}

.tree-root {
    text-align: center;
    margin-bottom: 24px;
}

.tree-root-title {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
}

.tree-level {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
}

.tree-node {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tree-node:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.tree-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.tree-node-customer {
    border-left: 4px solid var(--primary);
    min-width: 240px;
}

.tree-node-dept {
    border-left: 3px solid #f59e0b;
    min-width: 180px;
    font-size: 13px;
}

.tree-node-contact {
    border-left: 3px solid #22c55e;
    min-width: 160px;
    font-size: 13px;
    padding: 10px 14px;
}

.tree-node-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.tree-node-detail {
    font-weight: 400;
    font-size: 12px;
    color: var(--primary);
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.15s;
}
.tree-node-customer:hover .tree-node-detail,
.tree-node-clickable:hover .tree-node-detail {
    opacity: 1;
}
.tree-node-customer:hover,
.tree-node-clickable:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.tree-node-clickable {
    cursor: pointer;
}

/* 从驾驶舱点进档案后，目标部门/联系人的定位高亮 */
.hl-flash {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    animation: hlFlash 1.2s ease 2;
}
@keyframes hlFlash {
    0% { background: rgba(37, 99, 235, 0.10); }
    50% { background: rgba(37, 99, 235, 0.22); }
    100% { background: rgba(37, 99, 235, 0.10); }
}

.tree-node-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.tree-node .expand-icon {
    float: right;
    font-size: 12px;
    color: var(--text-muted);
}

.tree-children {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 0 16px 24px;
    margin-left: 16px;
    border-left: 2px dashed var(--border);
}

/* --- 审核页 --- */
.audit-btn-group {
    display: flex;
    gap: 8px;
}

/* --- select inside form inline --- */
select.form-input {
    appearance: auto;
}

/* --- 模块子导航 --- */
.module-subnav {
    display: flex;
    gap: 0;
    background: var(--bg-white);
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    padding: 0 24px;
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-sm);
}

.module-subtab {
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    position: relative;
}

.module-subtab:hover { color: var(--text); }
.module-subtab.active { color: var(--primary); border-bottom-color: var(--primary); }

.module-subtab .subtab-badge {
    position: absolute;
    top: 6px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
}

.module-content {
    background: var(--bg-white);
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-sm);
    padding: 24px;
    min-height: 400px;
}

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

.module-page-header h1 {
    font-size: 20px;
    font-weight: 700;
}

/* --- 面包屑 --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--primary);
    cursor: pointer;
}

.breadcrumb .sep {
    color: var(--text-muted);
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; }
    .page-body { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .customer-cards { grid-template-columns: 1fr; }
    .diff-container { grid-template-columns: 1fr; }
}

/* --- 档案管理 - 到期提醒徽章 --- */
.expire-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
}
.expire-badge.expired {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fca5a5;
}
.expire-badge.expiring {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fcd34d;
}
.expire-badge.warning {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

/* --- stat-icon color variants --- */
.stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }

/* --- 档案上传识别卡片 --- */
.archive-upload-card {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 18px 20px;
}
.archive-upload-card .btn {
    margin: 0;
}

/* 角色权限矩阵 */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 18px 20px;
}
.perm-module {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.perm-module-head {
    padding: 12px 14px;
    font-weight: 600;
    background: var(--bg-subtle, #f8fafc);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.perm-icon { font-size: 18px; }
.perm-actions {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}
.perm-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.perm-cell input { cursor: pointer; }
.uperm-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    cursor: default;
}
.uperm-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.uperm-base {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    line-height: 1.5;
}
.uperm-base.has { background: #eaf3de; color: #3b6d11; }
.uperm-base.no { background: #f1efe8; color: #5f5e5a; }
.uperm-select {
    min-width: 110px;
    padding: 4px 8px;
    font-size: 13px;
}
.no-permission {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.no-perm-icon { font-size: 48px; margin-bottom: 12px; }

/* ===================== 报价库模块 ===================== */
.q-upload-zone {
    border: 2px dashed var(--border, #d6dae0);
    border-radius: 12px;
    padding: 22px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    background: #fafbfc;
    cursor: pointer;
    margin-bottom: 14px;
    transition: .15s;
}
.q-upload-zone:hover, .q-upload-zone.drag { border-color: var(--primary, #3b82f6); background: #f0f6ff; color: var(--primary, #3b82f6); }
.q-batch { margin-bottom: 12px; }
.batch-title { font-size: 13px; color: var(--text-muted, #6b7280); margin-bottom: 6px; }
.batch-item { padding: 7px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--border, #e5e7eb); margin-bottom: 6px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.batch-item.ok { border-color: #bbf7d0; background: #f0fdf4; color: #16a34a; }
.batch-item.fail { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.spinner { width: 13px; height: 13px; border: 2px solid #cbd5e1; border-top-color: var(--primary, #3b82f6); border-radius: 50%; display: inline-block; animation: qspin .7s linear infinite; }
@keyframes qspin { to { transform: rotate(360deg); } }

.q-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.q-price-sep { color: var(--text-muted, #6b7280); font-size: 13px; }
.q-chk { font-size: 13px; color: var(--text-muted, #6b7280); display: flex; align-items: center; gap: 4px; }

/* 报价库商品缩略图 */
.q-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border, #e5e7eb);
    cursor: zoom-in;
    display: block;
    background: #f6f7f9;
}
.q-thumb:hover { transform: scale(1.6); box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 5; position: relative; }

.combobox { position: relative; min-width: 220px; }
.cb-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-tag { background: #e0edff; color: #1d4ed8; border-radius: 12px; padding: 2px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.cb-x { cursor: pointer; font-weight: bold; }
.cb-input { width: 100%; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none; }
.cb-input:focus { border-color: var(--primary, #3b82f6); }
.cb-drop { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; margin-top: 4px; max-height: 220px; overflow-y: auto; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.1); }

/* --- 报价库批量上传：每文件一行 + 进度条 --- */
.q-batch-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: var(--text-secondary);
    margin: 10px 0 6px;
}
.q-batch-clear { padding: 0 10px !important; height: 26px !important; font-size: 12px !important; }

.q-up-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 220px;
    gap: 10px;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 13px;
}
.q-up-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text);
}
.q-up-stage {
    color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-up-stage-error { color: var(--danger); }
.q-up-stage-done { color: var(--success); font-weight: 500; }

.q-up-progress {
    position: relative;
    background: #f1f5f9;
    border-radius: 999px;
    height: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.q-up-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    border-radius: 999px;
    transition: width 0.25s ease;
    background: var(--primary);
}
.q-up-fill-uploading { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.q-up-fill-parsing  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.q-up-fill-done     { background: linear-gradient(90deg, #16a34a, #22c55e); }
.q-up-fill-error    { background: linear-gradient(90deg, #ef4444, #f87171); }
.q-up-pct {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-size: 11px; color: var(--text);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 2px rgba(255,255,255,.7);
}
.q-up-result {
    grid-column: 1 / -1;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.q-result-ok { color: var(--success); font-weight: 500; }
.q-result-fail { color: var(--danger); }
.cb-opt { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.cb-opt:hover { background: #f0f6ff; }

.badge-active { background: #dcfce7; color: #16a34a; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-expired { background: #fef3c7; color: #d97706; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.price-cell { color: #dc2626; font-weight: 600; }
.list-count { margin-top: 10px; font-size: 13px; color: var(--text-muted, #6b7280); }
.empty-tip { text-align: center; padding: 50px 20px; color: var(--text-muted, #6b7280); }

.compare-wrap { display: flex; flex-direction: column; gap: 18px; }
.compare-group { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px; }
.compare-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.offer-num { font-size: 12px; color: var(--text-muted, #6b7280); font-weight: 400; }
.offer-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.offer-card { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 12px; background: #fafbfc; }
.offer-card.lowest { border-color: #86efac; background: #f0fdf4; }
.offer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.offer-sup { font-weight: 600; font-size: 14px; }
.tag-lowest { background: #16a34a; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.tag-soon { background: #f59e0b; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.offer-price { font-size: 20px; font-weight: 700; color: #dc2626; margin-bottom: 6px; }
.offer-price small { font-size: 12px; color: var(--text-muted, #6b7280); font-weight: 400; }
.offer-meta { font-size: 12px; color: var(--text-muted, #6b7280); margin-bottom: 3px; }

.q-detail-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-muted, #6b7280); margin: 10px 0; }
.q-detail-actions { margin: 10px 0; }
.q-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.q-img { width: 90px; height: 90px; object-fit: cover; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; }

/* ===================== 知识库 KB（栏目化） ===================== */
.kb-search-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.kb-search-head { font-size: 13px; color: var(--text-muted, #6b7280); margin-bottom: 8px; }
.kb-search-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: border-color .15s; }
.kb-search-item:hover { border-color: var(--primary, #3b82f6); }
.kb-search-title { font-size: 13px; color: var(--text, #1f2937); }
.kb-chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef4ff; color: var(--primary, #3b82f6); white-space: nowrap; }

.kb-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.kb-board-card { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 18px; cursor: pointer; transition: all .15s; }
.kb-board-card:hover { border-color: var(--primary, #3b82f6); transform: translateY(-2px); }
.kb-board-icon { font-size: 26px; margin-bottom: 8px; }
.kb-board-name { font-size: 15px; font-weight: 600; color: var(--text, #1f2937); margin-bottom: 5px; }
.kb-board-desc { font-size: 12px; color: var(--text-muted, #6b7280); line-height: 1.6; min-height: 32px; }
.kb-board-meta { font-size: 12px; color: var(--primary, #3b82f6); margin-top: 8px; }

.kb-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border, #e5e7eb); padding-bottom: 10px; }
.kb-tab { border: 1px solid var(--border, #e5e7eb); background: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--text, #1f2937); cursor: pointer; transition: all .15s; }
.kb-tab:hover { border-color: var(--primary, #3b82f6); }
.kb-tab.active { background: var(--primary, #3b82f6); border-color: var(--primary, #3b82f6); color: #fff; }
.kb-tab-count { margin-left: 6px; font-size: 11px; opacity: .75; }

.kb-layout { display: flex; gap: 18px; align-items: flex-start; }
.kb-side { width: 232px; flex-shrink: 0; background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 12px; position: sticky; top: 14px; }
.kb-side-title { font-weight: 600; font-size: 13px; margin-bottom: 10px; color: var(--text-muted, #6b7280); }
.kb-side-item { padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text, #1f2937); transition: background .15s; margin-bottom: 3px; }
.kb-side-item:hover { background: #f0f6ff; }
.kb-side-item.active { background: var(--primary, #3b82f6); color: #fff; }
.kb-side-num { flex-shrink: 0; width: 18px; text-align: center; font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.kb-side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-dot { color: #f59e0b; font-size: 16px; line-height: 1; }
.kb-main { flex: 1; min-width: 0; }

.kb-entry { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 20px 22px; }
.kb-entry-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kb-entry-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--primary, #3b82f6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.kb-entry-title { font-size: 16px; font-weight: 600; color: var(--text, #1f2937); }
.kb-status { font-size: 11px; padding: 2px 9px; border-radius: 10px; }
.kb-status-draft { background: #f3f4f6; color: #6b7280; }
.kb-status-pending { background: #fef3c7; color: #b45309; }
.kb-hint { background: #eff6ff; border-left: 3px solid var(--primary, #3b82f6); border-radius: 6px; padding: 9px 12px; font-size: 13px; color: #1e40af; margin-bottom: 10px; line-height: 1.7; }
.kb-path { font-size: 12px; color: var(--text-muted, #6b7280); margin-bottom: 12px; }
.kb-reject { background: #fef2f2; border-left: 3px solid #dc2626; border-radius: 6px; padding: 9px 12px; font-size: 13px; color: #b91c1c; margin-bottom: 10px; }
.kb-body { font-size: 14px; line-height: 1.85; color: var(--text, #1f2937); }
.kb-body p { margin: 0 0 12px; }

.kb-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 13px; }
.kb-table th, .kb-table td { border: 1px solid var(--border, #e5e7eb); padding: 8px 10px; text-align: left; }
.kb-table th { background: #f8fafc; font-weight: 600; color: var(--text, #1f2937); }

.kb-steps { margin: 4px 0 14px; }
.kb-step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid #f2f4f7; }
.kb-step:first-child { border-top: none; }
.kb-step-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: #eef4ff; color: var(--primary, #3b82f6); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.kb-step-body { flex: 1; min-width: 0; }
.kb-step-text { font-size: 14px; line-height: 1.75; color: var(--text, #1f2937); }
.kb-step-img { display: block; max-width: 100%; margin-top: 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; cursor: zoom-in; }

.kb-goto-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kb-goto { border: 1px solid var(--primary, #3b82f6); background: #eef4ff; color: var(--primary, #3b82f6); border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; transition: all .15s; }
.kb-goto:hover { background: var(--primary, #3b82f6); color: #fff; }

.kb-atts { border-top: 1px solid #f2f4f7; padding-top: 12px; }
.kb-atts-title { font-size: 12px; color: var(--text-muted, #6b7280); margin-bottom: 8px; }
.kb-att { display: inline-block; margin: 0 10px 8px 0; font-size: 13px; color: var(--primary, #3b82f6); text-decoration: none; }
.kb-att:hover { text-decoration: underline; }

.kb-entry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #f2f4f7; }
.kb-danger { color: #dc2626; border-color: #fca5a5; }

.kb-empty { text-align: center; color: var(--text-muted, #6b7280); font-size: 13px; padding: 48px 12px; }
.kb-empty-sm { color: var(--text-muted, #6b7280); font-size: 12px; padding: 10px 4px; }

.kb-form { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 20px 22px; }
.kb-form-title { font-size: 15px; font-weight: 600; color: var(--text, #1f2937); margin-bottom: 16px; }
.kb-field { margin-bottom: 16px; }
.kb-label { display: block; font-size: 13px; font-weight: 500; color: var(--text, #1f2937); margin-bottom: 5px; }
.kb-req { color: #dc2626; }
.kb-help { font-size: 12px; color: var(--text-muted, #6b7280); line-height: 1.75; margin-top: 5px; }
.kb-help code { background: #f3f4f6; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.kb-textarea { resize: vertical; line-height: 1.8; font-family: inherit; }

.kb-steps-edit { margin-bottom: 8px; }
.kb-step-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kb-step-row-num { flex-shrink: 0; width: 18px; text-align: center; font-size: 12px; color: var(--text-muted, #6b7280); }
.kb-step-row-text { flex: 1; min-width: 0; }
.kb-thumb-wrap { position: relative; flex-shrink: 0; }
.kb-thumb { width: 38px; height: 38px; object-fit: cover; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; display: block; }
.kb-thumb-del { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 11px; line-height: 16px; text-align: center; cursor: pointer; }

.kb-btns-edit { margin-bottom: 8px; }
.kb-btn-row-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kb-btn-row-edit select { flex: 1.4; min-width: 0; }
.kb-btn-row-edit input { flex: 1; min-width: 0; }

.kb-atts-edit { margin-bottom: 8px; }
.kb-att-edit { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 10px; background: #f8fafc; border-radius: 6px; margin-bottom: 5px; }
.kb-att-del { color: #dc2626; cursor: pointer; font-size: 12px; flex-shrink: 0; }

.kb-form-actions { display: flex; gap: 8px; margin-top: 20px; }
.kb-form-note { font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 10px; line-height: 1.7; }

.kb-review-item { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.kb-review-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kb-review-title { font-size: 14px; color: var(--text, #1f2937); font-weight: 500; }
.kb-review-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kb-preview-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px; }
.kb-preview-box { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.kb-preview-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e7eb); font-size: 15px; }
.kb-preview-close { cursor: pointer; font-size: 20px; line-height: 1; color: var(--text-muted, #6b7280); }
.kb-preview-body { padding: 18px; overflow-y: auto; }


/* ===================== 售后管理 After-sale ===================== */
.as-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.as-filter input, .as-filter select { font-size: 13px; }
.as-form-wrap { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 20px; }
.as-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
.as-form-grid .form-group { display: flex; flex-direction: column; gap: 5px; }
.as-form-grid label { font-size: 13px; font-weight: 500; color: var(--text, #1f2937); }
.as-form-grid textarea.form-input { resize: vertical; }
.as-table { width: 100%; }
.as-table th.sortable { cursor: pointer; user-select: none; }
.as-table th.sortable:hover { color: var(--primary, #3b82f6); }
.as-num { text-align: right; font-variant-numeric: tabular-nums; }
.as-pos { color: #16a34a; }
.as-neg { color: #dc2626; }
.as-ops { white-space: nowrap; }
.as-ops a { margin-right: 10px; color: var(--primary, #3b82f6); cursor: pointer; text-decoration: none; font-size: 13px; }
.as-ops a:hover { text-decoration: underline; }
.as-ops a.as-del { color: #dc2626; }
.as-pager { margin-top: 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted, #6b7280); flex-wrap: wrap; }
.as-pager button:disabled { opacity: .5; cursor: not-allowed; }
.as-pager-info b { color: var(--text, #1f2937); }
.as-pager .as-page-size { width: auto; height: auto; padding: 5px 8px; font-size: 13px; }
.as-table tfoot .as-total-row td {
    font-weight: 600;
    background: #f8fafc;
    border-top: 2px solid var(--border, #e5e7eb);
    color: var(--text, #1f2937);
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ===================== 询价匹配 Inquiry Match ===================== */
.q-match-panel { background:#fff; border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:20px; }
.q-match-head h3 { margin:0 0 6px; font-size:16px; }
.q-match-tip { margin:0 0 14px; color:var(--text-muted,#6b7280); font-size:13px; line-height:1.6; }
.q-match-tip b { color:var(--text,#1f2937); }
.q-match-warn { margin:0 0 14px; padding:10px 14px; background:#fff7ed; border:1px solid #fdba74; border-left:4px solid #f97316; border-radius:8px; color:#9a3412; font-size:13px; line-height:1.6; }
.q-match-warn b { color:#7c2d12; }
.q-match-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:10px; }
.qm-fname { font-size:13px; color:var(--text-muted,#6b7280); }
.q-match-msg { font-size:13px; color:var(--primary,#3b82f6); }
.q-match-paste { margin:6px 0 12px; }
.q-match-paste summary { cursor:pointer; font-size:13px; color:var(--primary,#3b82f6); }
.q-match-paste textarea { width:100%; margin-top:8px; font-family:inherit; }
.q-match-summary { display:flex; flex-wrap:wrap; gap:8px; margin:6px 0 14px; }
.qm-badge { background:#f1f5f9; border:1px solid var(--border,#e5e7eb); border-radius:20px; padding:4px 12px; font-size:13px; color:var(--text,#1f2937); }
.qm-badge b { font-size:14px; }
.qm-badge.hit { background:#e7f7ec; border-color:#b7e4c7; color:#15803d; }
.qm-badge.gap { background:#fdeaea; border-color:#f5c2c2; color:#b91c1c; }
.qm-badge.over { background:#fff3e0; border-color:#f5c99a; color:#e65100; }
.qm-table { width:100%; border-collapse:collapse; font-size:13px; }
.qm-table th, .qm-table td { border:1px solid var(--border,#e5e7eb); padding:8px 10px; text-align:left; vertical-align:top; }
.qm-table th { background:#f8fafc; font-weight:600; white-space:nowrap; }
.qm-table td.qm-price { text-align:right; font-weight:600; font-variant-numeric:tabular-nums; }
.qm-row-hit { background:#f3fbf5; }
.qm-row-gap { background:#fdf3f3; }
.qm-tag { display:inline-block; padding:2px 8px; border-radius:6px; font-size:12px; font-weight:600; }
.qm-tag.hit { background:#16a34a; color:#fff; }
.qm-tag.gap { background:#dc2626; color:#fff; }
.qm-gap-note { color:#b91c1c; font-weight:500; }
.qm-table small { color:var(--text-muted,#6b7280); }
.qm-over { color:#dc2626; font-weight:600; font-size:12px; margin-left:4px; }



/* ===== 供应商联系方式弹窗 ===== */
.supplier-link {
    color: var(--primary, #3b82f6);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary, #3b82f6);
    cursor: pointer;
    font-weight: 500;
    transition: opacity .15s;
}
.supplier-link:hover { opacity: .75; }

.sup-contact-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0 8px;
}
.sup-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.sup-label {
    flex: 0 0 62px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
    padding-top: 1px;
}
.sup-val {
    flex: 1;
    color: var(--text, #1f2937);
    word-break: break-all;
}
.sup-val a { color: var(--primary, #3b82f6); text-decoration: none; }
.sup-val a:hover { text-decoration: underline; }
.sup-phone { font-weight: 600; font-size: 15px; }

/* ============================================================
   商品链接（京东/天猫详情）：点击新窗口打开
   ============================================================ */
.qlink-btn {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--primary, #3b82f6);
    border-radius: 999px;
    background: rgba(59, 130, 246, .08);
    color: var(--primary, #3b82f6);
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.qlink-btn:hover { background: var(--primary, #3b82f6); color: #fff; }
.qlink-btn::after { content: " ↗"; opacity: .7; }
.qm-na { color: var(--text-muted, #9ca3af); }
.offer-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* ============================================================
   CRM 权限透视（管理员专用）
   ============================================================ */
.vis-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.vis-stat {
    flex: 1 1 140px; background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px; padding: 14px 16px; text-align: center;
}
.vis-stat-n { font-size: 26px; font-weight: 700; color: var(--text, #111827); line-height: 1.2; }
.vis-stat-l { font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 4px; }
.vis-stat-warn { border-color: #fca5a5; background: #fef2f2; }
.vis-stat-warn .vis-stat-n { color: #dc2626; }

.vis-block { background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.vis-block-warn { border-color: #fca5a5; }
.vis-h3 { margin: 0 0 12px; font-size: 15px; color: var(--text, #111827); }

.vis-table-wrap { overflow-x: auto; }
.vis-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vis-table th, .vis-table td { padding: 9px 12px; text-align: left;
    border-bottom: 1px solid var(--border, #eef0f3); vertical-align: top; }
.vis-table th { background: var(--bg-soft, #f8fafc); color: var(--text-muted, #6b7280);
    font-weight: 600; white-space: nowrap; }
.vis-table tbody tr:hover { background: var(--bg-soft, #f8fafc); }
.vis-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vis-u { font-weight: 600; }
.vis-sub { font-size: 11px; color: var(--text-muted, #9ca3af); margin-top: 2px; }
.vis-na { color: var(--text-muted, #9ca3af); }

.vis-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.vis-tag-all { background: rgba(59,130,246,.12); color: #2563eb; }
.vis-tag-assign { background: #f1f5f9; color: #64748b; }
.vis-tag-ok { background: rgba(16,185,129,.12); color: #059669; }
.vis-tag-part { background: rgba(245,158,11,.14); color: #d97706; }

.vis-projs { display: flex; flex-wrap: wrap; gap: 6px; }
.vis-chip { background: #f1f5f9; color: #334155; border-radius: 8px; padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.vis-chip b { color: #2563eb; }

.vis-viewers { display: flex; flex-direction: column; gap: 5px; }
.vis-viewer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vis-role { font-size: 11px; color: var(--text-muted, #9ca3af); }

/* ============================================================
   客户管理 - 二级模块导航（客户列表 / 工作计划 / 商机管理）
   ============================================================ */
.module-modnav {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.module-modtab {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all .15s;
}
.module-modtab:hover { color: var(--text, #1f2937); }
.module-modtab.active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
}

/* ============================================================
   工作计划
   ============================================================ */
.plan-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.plan-toolbar label { font-size: 13px; font-weight: 600; }
.plan-toolbar .form-input { width: auto; min-width: 190px; }
.plan-hint { font-size: 12px; color: var(--text-muted, #6b7280); }
.plan-review-note {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}
.plan-table .plan-s { min-width: 96px; font-size: 12px; padding: 5px 6px; }
.plan-table input[type="text"], .plan-table input.form-input { font-size: 12px; padding: 5px 6px; }
.plan-table.compact td, .plan-table.compact th { padding: 6px 10px; }
.plan-summary { margin-top: 16px; }
.plan-summary label { display: block; margin-bottom: 6px; font-size: 13px; }
.plan-summary textarea { width: 100%; }

.team-plan-card {
    background: var(--bg-white, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.team-plan-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    flex-wrap: wrap;
}
.team-plan-head:hover { background: var(--bg-soft, #f8fafc); }
.team-plan-role { font-size: 12px; color: var(--text-muted, #6b7280); }
.team-plan-meta { font-size: 12px; color: var(--text-muted, #6b7280); margin-left: auto; }
.team-plan-toggle { font-size: 11px; color: var(--text-muted, #9ca3af); transition: transform .2s; }
.team-plan-card.open .team-plan-toggle { transform: rotate(180deg); }
.team-plan-body { display: none; padding: 0 16px 14px; border-top: 1px solid var(--border, #eef2f7); }
.team-plan-card.open .team-plan-body { display: block; }
.team-plan-empty { font-size: 13px; color: var(--text-muted, #9ca3af); padding: 8px 0; }
.team-plan-summary { font-size: 13px; margin-top: 10px; padding: 8px 12px; background: var(--bg-soft, #f8fafc); border-radius: 6px; }
.team-plan-review { margin-top: 12px; }
.team-plan-review label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }
.team-plan-review textarea { width: 100%; }

.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-orange { background: #ffedd5; color: #ea580c; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-purple { background: #f3e8ff; color: #9333ea; }
.stat-sub { display: block; font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 2px; }
.stat-card.highlight { border-left: 3px solid var(--primary, #2563eb); }

/* ============================================================
   商机管理
   ============================================================ */
.opp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.opp-stats .stat-card { padding: 16px; }
.opp-funnel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.opp-funnel .stat-card { padding: 12px 16px; }
.opp-lost { font-size: 11px; color: #dc2626; margin-top: 3px; }
.opp-lost-box { background: #fef2f2; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin: 10px 0; }
.opp-stage-select { min-width: 104px; font-size: 12px; padding: 4px 6px; }

.opp-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}
.opp-detail-grid label { display: block; font-size: 11px; color: var(--text-muted, #6b7280); }
.opp-detail-grid span { font-size: 14px; font-weight: 500; }
.opp-detail-remark { margin: 10px 0; }
.opp-detail-remark label { font-size: 11px; color: var(--text-muted, #6b7280); }
.opp-detail-remark p { font-size: 13px; margin: 2px 0 0; }
.opp-follow-head { margin: 16px 0 8px; font-size: 14px; border-top: 1px solid var(--border, #e5e7eb); padding-top: 12px; }
.opp-follow-form { background: var(--bg-soft, #f8fafc); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.follow-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.follow-row:last-child { margin-bottom: 0; }
.follow-row .form-input { flex: 1; min-width: 140px; }
.opp-follow-list { display: flex; flex-direction: column; gap: 8px; }
.follow-item { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 10px 12px; }
.follow-meta { font-size: 12px; color: var(--text-muted, #6b7280); margin-bottom: 4px; }
.follow-content { font-size: 13px; white-space: pre-wrap; }
.follow-next { font-size: 12px; color: #2563eb; margin-top: 4px; }

/* ============================================================
   全局列表 · 表头吸顶（2026-09-22）
   目的：所有模块的列表在页面（或弹窗内）滚动时，表头行保持可见，
         不会随内容一起滚上去。
   实现要点：
   1) 用 thead th 的 position: sticky —— 浏览器对「表头单元格」的 sticky
      支持最广（比 sticky 整个 thead 更稳）。
   2) border-collapse: collapse 下，sticky 单元格的 border-bottom 会随内容
      滚走（滚动时表头下划线消失）；用 inset box-shadow 补这条线。
   3) 表头背景必须不透明，否则下方内容会透出来（各表格类已各自设了背景）。
   4) HR 员工 / 档案列表是「两行表头」（标题行 + 筛选行），
      第二行要错开 top，规则见下。
   ============================================================ */
:root { --thead-h: 46px; }

thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    box-shadow: inset 0 -1px 0 var(--border);
}

/* 两行表头：第一行给固定高度，第二行（筛选行）才能精确贴在其正下方 */
.hr-table thead tr:first-child th,
.ar-table thead tr:first-child th { height: var(--thead-h); }

.hr-table thead tr:nth-child(2) th,
.ar-table thead tr:nth-child(2) th {
    top: var(--thead-h);
    z-index: 5;
}

/* 横向滚动包装层（.vis-table-wrap）：overflow-x:auto 会让它成为滚动上下文，
   表头便只能相对「它」吸顶。给它一个纵向上限，使其同时充当纵向滚动容器，
   表头即可在容器内正常吸顶（表格不长时不会出现内滚动条，外观不变）。 */
.vis-table-wrap {
    overflow: auto;
    max-height: calc(100vh - 190px);
}
