/* ========================================
   平衡点CRM 设计令牌系统 + 简洁主题覆盖层
   加载于 style.css 之后。
   结构：Design Tokens → 全局覆盖 → 组件 → 页面级（仪表盘）
   回滚方式：删掉 base.html 里对本文件的引用即可。
   ======================================== */

/* ============================================================
   Design Tokens
   唯一事实来源：颜色、字体、间距、圆角、阴影、动效、图表色板
   ============================================================ */
:root {
    /* ---- 品牌色阶（深蓝，自 50 浅底到 900 深）---- */
    --brand-50:  #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #3d63dd;
    --brand-500: #2e3fa0;
    --brand-600: #142878;   /* 主品牌色 */
    --brand-700: #0f1f5c;
    --brand-800: #0b1747;
    --brand-900: #081033;

    /* ---- 中性色阶 ---- */
    --gray-50:  #fafbfc;   /* 表头/浅底 */
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;   /* 主边框 */
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;   /* 三级文字 */
    --gray-500: #6b7280;   /* 二级文字 */
    --gray-700: #374151;
    --gray-900: #111827;   /* 一级文字 */

    /* ---- 语义色（浅底/深字/描边成对，文本对比度 ≥ 4.5:1）---- */
    --success-bg: #e8f5ec;  --success-text: #1a7f37;  --success-border: #b7e1c1;
    --warning-bg: #fdf3e2;  --warning-text: #9a5b00;  --warning-border: #f0d9a8;
    --danger-bg:  #fdeceb;  --danger-text:  #b42318;  --danger-border:  #f2b8b2;
    --info-bg:    #e8f1fb;  --info-text:    #1a5fa8;  --info-border:    #bcd6f0;

    /* ---- 字体 ---- */
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;

    --text-xs:   11px;
    --text-sm:   12px;
    --text-base: 13px;
    --text-md:   14px;
    --text-lg:   16px;
    --text-xl:   20px;
    --text-2xl:  24px;
    --text-3xl:  28px;

    --leading-tight:  1.25;
    --leading-normal: 1.6;

    /* ---- 间距（4pt 网格）---- */
    --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
    --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;

    /* ---- 圆角 ---- */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-pill: 999px;

    /* ---- 阴影（轻量层级，仅在浮层使用）---- */
    --shadow-xs: 0 1px 2px rgba(17, 24, 39, .04);
    --shadow-sm: 0 2px 6px -2px rgba(17, 24, 39, .08);
    --shadow-md: 0 8px 20px -6px rgba(17, 24, 39, .15);
    --shadow-lg: 0 12px 32px -8px rgba(17, 24, 39, .18);

    /* ---- 动效 ---- */
    --ease: cubic-bezier(.4, 0, .2, 1);
    --dur-fast: 120ms;
    --dur-base: 200ms;

    /* ---- 图表色板（序列色，与品牌协调）---- */
    --chart-1: #142878;
    --chart-2: #3d63dd;
    --chart-3: #7c9aff;
    --chart-4: #1a7f37;
    --chart-5: #d97706;
    --chart-6: #b42318;
    --chart-7: #6b7280;
    --chart-8: #12a594;

    /* ---- 兼容别名（历史规则引用，勿删）---- */
    --c-bg: #f7f8fa;
    --c-surface: #ffffff;
    --c-border: var(--gray-200);
    --c-border-soft: #f0f2f5;
    --c-text: var(--gray-900);
    --c-text-2: var(--gray-500);
    --c-text-3: var(--gray-400);
    --c-brand: var(--brand-600);
    --c-brand-soft: var(--brand-50);
    --c-radius: var(--radius-md);
}

/* 全局：等宽数字（表格/KPI 对齐）、统一字体栈 */
body {
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
}

/* 全局可访问性：键盘聚焦可见环（鼠标点击不显示） */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible,
.select2-selection:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 2px;
}

/* 标题避免孤行 */
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

body {
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
}

/* ---------- 侧边栏：白底细线，去掉深色渐变与阴影 ---------- */
.sidebar {
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    box-shadow: none;
}

.sidebar-logo {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border-soft);
    padding: 16px 12px 14px;
}

.sidebar-logo img {
    border: 1px solid var(--c-border-soft);
}

.sidebar-logo h4 {
    color: var(--c-text);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
}

.sidebar-logo p {
    color: var(--c-text-3);
    font-size: 11px;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.sidebar nav { padding: 10px 0; }

.sidebar a {
    color: var(--c-text-2);
    padding: 9px 12px;
    margin: 1px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
}

.sidebar a i {
    color: var(--c-text-3);
    font-size: 15px;
    margin-right: 9px;
}

.sidebar a:hover {
    background: var(--c-border-soft);
    color: var(--c-text);
}

.sidebar a:hover i { color: var(--c-text-2); }

.sidebar a.active {
    background: var(--c-brand-soft);
    color: var(--c-brand);
    font-weight: 500;
    box-shadow: inset 2px 0 0 var(--c-brand);
}

.sidebar a.active i { color: var(--c-brand); }

/* ---------- 顶部栏：压高度，去掉阴影 ---------- */
.navbar {
    box-shadow: none;
    border-bottom: 1px solid var(--c-border);
    padding: 0 24px;
    min-height: 56px;
}

.navbar-brand {
    font-size: 16px;
    font-weight: 500;
    color: var(--c-text);
}

/* ---------- 内容区留白 ---------- */
.main-content > .px-4.py-3 {
    padding: 20px 24px 28px !important;
}

/* ---------- 卡片：细边框、无阴影、不做 hover 位移 ---------- */
.card {
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    box-shadow: none;
    margin-bottom: 16px;
    transition: border-color 0.15s ease;
}

.card:hover {
    box-shadow: none;
    border-color: #d8dce2;
}

.card-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border-soft);
    padding: 13px 18px;
    border-radius: var(--c-radius) var(--c-radius) 0 0;
}

.card-header h5,
.card-header h6 {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
}

.card-body { padding: 18px; }

/* ---------- 统计卡片：去掉上浮与图标重色 ---------- */
.stat-card:hover {
    transform: none;
    box-shadow: none;
    border-color: #d8dce2;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-radius: 8px;
}

/* ---------- 表格：横向分隔、行高舒展、无悬停变色块 ---------- */
.table {
    font-size: 13px;
    --bs-table-hover-bg: transparent;
}

.table th {
    background: #fafbfc;
    color: var(--c-text-2);
    font-size: 12px;
    font-weight: 500;
    padding: 9px 12px;
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border-soft);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table-hover tbody tr:hover {
    --bs-table-accent-bg: #fafbfc;
    background: #fafbfc;
}

.table-hover tbody tr:hover > * {
    background: transparent;
}

/* ---------- 按钮：统一圆角，去掉位移和光晕 ---------- */
.btn {
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: var(--c-brand);
    border-color: var(--c-brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #0f1f5c;
    border-color: #0f1f5c;
    transform: none;
    box-shadow: none;
}

.btn-primary:active { transform: none; }

.btn-sm {
    font-size: 12.5px;
    padding: 4px 10px;
    border-radius: 6px;
}

.btn-outline-secondary {
    border-color: var(--c-border);
    color: var(--c-text-2);
}

.btn-outline-secondary:hover {
    background: var(--c-border-soft);
    border-color: var(--c-border);
    color: var(--c-text);
}

.btn-outline-danger,
.btn-outline-warning,
.btn-outline-success,
.btn-outline-info {
    background: var(--c-surface);
}

/* ---------- 表单：浅边框，聚焦时才出现环 ---------- */
.form-control,
.form-select {
    border-color: var(--c-border);
    border-radius: 6px;
    font-size: 13.5px;
    padding: 7px 10px;
    color: var(--c-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--c-brand);
    box-shadow: 0 0 0 3px rgba(20, 40, 120, 0.08);
}

.form-control::placeholder { color: var(--c-text-3); }

.form-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--c-text-2);
    margin-bottom: 5px;
}

.form-text {
    font-size: 11.5px;
    color: var(--c-text-3);
}

.form-check-label { font-size: 13px; color: var(--c-text-2); }

/* ---------- 徽章：浅底深字，降低饱和度 ---------- */
.badge {
    font-weight: 500;
    font-size: 11.5px;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}

.badge.bg-primary { background: var(--c-brand-soft) !important; color: var(--c-brand) !important; }
.badge.bg-success { background: #e8f5ec !important; color: #1a7f37 !important; }
.badge.bg-warning { background: #fdf3e2 !important; color: #9a5b00 !important; }
.badge.bg-danger { background: #fdeceb !important; color: #b42318 !important; }
.badge.bg-info { background: #e8f1fb !important; color: #1a5fa8 !important; }
.badge.bg-secondary { background: #f1f2f4 !important; color: #5b6470 !important; }

/* ---------- 提示条 ---------- */
.alert {
    border-radius: 8px;
    border: 1px solid var(--c-border);
    font-size: 13px;
    padding: 10px 14px;
}

/* 语义提示条：浅底深字，替换 Bootstrap 高饱和底色 */
.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

/* ---------- 正文链接：品牌深蓝，替换 Bootstrap 亮蓝 ---------- */
a {
    color: var(--brand-500);
    transition: color var(--dur-fast) var(--ease);
}

a:hover {
    color: var(--brand-700);
}

/* ---------- 列表组 ---------- */
.list-group-item {
    border-color: var(--c-border-soft);
    padding: 11px 14px;
    font-size: 13px;
}

/* ---------- 分页 ---------- */
.pagination .page-link {
    border-color: var(--c-border);
    color: var(--c-text-2);
    font-size: 13px;
    padding: 5px 10px;
}

.pagination .page-item.active .page-link {
    background: var(--c-brand);
    border-color: var(--c-brand);
    color: #fff;
}

/* ---------- 弹窗 ---------- */
.modal-content {
    border: 1px solid var(--c-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px -8px rgba(17, 24, 39, 0.18);
}

.modal-header { border-bottom: 1px solid var(--c-border-soft); padding: 14px 18px; }
.modal-body { padding: 18px; font-size: 13.5px; }
.modal-footer { border-top: 1px solid var(--c-border-soft); padding: 12px 18px; }
.modal-title { font-size: 15px; font-weight: 500; }

/* ---------- Select2 与工具栏布局修复 ----------
   Select2 会把 <select> 隐藏并插入一个 <span class="select2-container">，
   该容器不带 form-select 类，因此不受工具栏 flex 规则约束，宽度撑满导致整行换行。 */
.list-toolbar .select2-container {
    flex: 1 1 200px;
    min-width: 0;
}

.list-toolbar .form-control {
    max-width: 340px;
}

/* Select2 外观与原生表单对齐 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--c-border);
    border-radius: 6px;
    min-height: 36px;
    background: var(--c-surface);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    font-size: 13.5px;
    color: var(--c-text);
    padding-left: 2px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--c-brand);
    box-shadow: 0 0 0 3px rgba(20, 40, 120, 0.08);
}

.select2-dropdown {
    border: 1px solid var(--c-border);
    border-radius: 6px;
    box-shadow: 0 8px 20px -6px rgba(17, 24, 39, 0.15);
    font-size: 13.5px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--c-brand-soft);
    color: var(--c-brand);
}

/* ---------- 侧栏 logo：融入白底，减小体量 ---------- */
.sidebar-logo img {
    border: 0;
    height: 44px;
    padding: 0;
    background: transparent;
}

/* ---------- 列表操作列：由描边按钮降为文字按钮 ---------- */
.actions-cell { white-space: nowrap; }

.actions-cell .btn-sm {
    background: transparent;
    border-color: transparent;
    color: var(--c-text-2);
    padding: 3px 7px;
    box-shadow: none;
}

.actions-cell .btn-sm:hover {
    background: var(--c-border-soft);
    border-color: transparent;
    color: var(--c-text);
}

.actions-cell .btn-outline-primary { color: var(--c-brand); }
.actions-cell .btn-outline-danger { color: #b42318; }
.actions-cell .btn-outline-warning { color: #9a5b00; }
.actions-cell .btn-outline-success { color: #1a7f37; }

/* ---------- 同一行的列内卡片等高，避免参差 ---------- */
.row > [class*="col-"] > .card { height: 100%; }

/* 列表省略列：上限收紧，避免长文本把表格撑出容器 */
.table td.cell-ellipsis { max-width: 180px; }

/* 操作列按钮间距收紧，给表格留出宽度 */
.actions-cell .btn-sm { padding: 3px 5px; }

/* ---------- 流程条：浅底细线版本，降低视觉重量 ---------- */
.step-circle {
    width: 32px;
    height: 32px;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid transparent;
}

.step-circle.done {
    background: #e8f5ec;
    color: #1a7f37;
    border-color: #b7e1c1;
}

.step-circle.current {
    background: var(--c-brand-soft);
    color: var(--c-brand);
    border-color: #c7d2fe;
}

.step-circle.todo {
    background: #fafbfc;
    color: var(--c-text-3);
    border-color: var(--c-border);
}

.step-line {
    border-top-width: 1px;
    border-top-color: var(--c-border);
    margin-top: -1rem;
}

.step-line.done { border-top-color: #b7e1c1; }
.step-line.current { border-top-color: #c7d2fe; }

/* 黄色文字在白底可读性差，统一压深 */
.text-warning { color: #9a5b00 !important; }

/* ============================================================
   仪表盘（2026-11 重设计）
   ============================================================ */

/* ---- 问候区：日期行 + 问候语，信息一层展开 ---- */
.dash-date {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.dash-greeting h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0;
    letter-spacing: 0.2px;
}

/* ---- 区块标题：左标题右链接的轻量分割 ---- */
.dash-section {
    margin-bottom: var(--space-6);
}

.dash-section-title {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--space-3);
}

.dash-section-title .sub {
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--c-text-3);
}

/* ---- KPI 卡片 ---- */
.kpi-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.kpi-label {
    font-size: var(--text-sm);
    color: var(--c-text-2);
    font-weight: 500;
}

.kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    font-size: 15px;
}

.kpi-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--c-text);
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}

.kpi-foot {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-2);
    min-height: 26px;
}

.kpi-sub {
    font-size: var(--text-xs);
    color: var(--c-text-3);
}

/* 环比徽标 */
.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1;
    padding: 3px 7px;
    border-radius: var(--radius-pill);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.kpi-delta.up   { background: var(--success-bg); color: var(--success-text); }
.kpi-delta.down { background: var(--danger-bg);  color: var(--danger-text); }
.kpi-delta.flat { background: var(--gray-100);   color: var(--gray-500); }

/* KPI 迷你趋势（sparkline 容器） */
.kpi-spark {
    height: 36px;
    margin: var(--space-2) -4px 0;
}

/* KPI 迷你指标（无趋势数据时用分项数字填满同一高度，避免卡片空洞） */
.kpi-mini {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    height: 36px;
    margin-top: var(--space-2);
}

.kpi-mini .item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.kpi-mini .k {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    white-space: nowrap;
}

.kpi-mini .v {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi-mini .divider {
    width: 1px;
    height: 22px;
    background: var(--c-border-soft);
    flex: none;
}

/* KPI 卡片底部链接（弱化，悬停显色） */
.kpi-link {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease);
}

.kpi-link:hover { color: var(--c-brand); }

/* 表格内连续徽章之间留出呼吸（状态 + 超期） */
.table .badge + .badge { margin-left: 4px; }

/* ---- 旧式统计卡（统计报表等页面）与仪表盘 KPI 口径统一 ----
   原实现用 text-primary/success/info 给数字上色，同一屏内多色数字易失焦；
   统一为深色数字 + 灰色说明，语义交给区块标题与图表。 */
.stat-card .card-body > h3 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--c-text) !important;
    letter-spacing: -0.3px;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.stat-card .card-body > p {
    font-size: var(--text-sm);
    color: var(--c-text-3) !important;
}

/* ---- 提醒卡空态：垂直居中，避免拉伸后顶部一句文案、下方大片空白 ---- */
.reminder-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 96px;
    margin-bottom: 0;
    color: var(--c-text-3) !important;
    font-size: var(--text-sm);
    text-align: center;
}

.reminder-empty i {
    font-size: 20px;
    opacity: 0.6;
}

/* ---- 图表卡片 ---- */
.chart-box {
    height: 280px;
    width: 100%;
}

/* 趋势卡：图表撑满卡片剩余高度，消除与右侧环形卡等高对齐后留下的底部空白 */
.dash-chart-card {
    display: flex;
    flex-direction: column;
}

.dash-chart-card > .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dash-chart-card #trendChart {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 250px;
}

.chart-box.chart-box--donut { height: 280px; }

/* 图表加载失败/无数据的统一兜底 */
.chart-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--c-text-3);
    font-size: var(--text-sm);
    gap: var(--space-2);
}

.chart-fallback i { font-size: 22px; }

/* 状态分布图例（donut 右侧列表） */
.status-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.status-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--c-text-2);
}

.status-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex: none;
}

.status-legend .cnt {
    margin-left: auto;
    color: var(--c-text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.status-legend .pct {
    width: 44px;
    text-align: right;
    color: var(--c-text-3);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

/* 仪表盘卡片头更紧凑 */
.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.dash-card-header .title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--c-text);
}

.dash-card-header .hint {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    display: inline-flex;
    align-items: center;
}

/* 卡片头部的序列色点（替代图表内 legend，省出绘图区高度） */
.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}

/* 小屏：图表高度收紧，避免过长滚动 */
@media (max-width: 991.98px) {
    .chart-box { height: 240px; }
    .kpi-value { font-size: var(--text-2xl); }
}

/* ============================================================
   客户模块（2026-11 重设计）
   ============================================================ */

/* ---- 筛选区：两行结构（条件行 / 快捷+操作行） ---- */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* 搜索框：图标内嵌，占满剩余宽度 */
.filter-search {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
}

.filter-search > i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-3);
    font-size: 13px;
    pointer-events: none;
}

.filter-search > .form-control {
    padding-left: 30px;
}

.filter-select {
    flex: 0 1 150px;
    min-width: 118px;
}

.filter-submit { flex: none; }

/* 平板及以下：搜索框独占一行，避免「搜索」按钮被挤到下一行孤零零 */
@media (max-width: 991.98px) {
    .filter-search { flex: 1 1 100%; }
}

/* 第二行：快捷胶囊 + 操作 */
.filter-row--tools {
    padding-top: var(--space-1);
}

.filter-chips {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 5px;
    font-size: var(--text-sm);
    color: var(--c-text-2);
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    white-space: nowrap;
}

.chip:hover { background: var(--c-surface); color: var(--c-text); }

.chip.active {
    background: var(--c-surface);
    color: var(--c-brand);
    font-weight: 500;
    box-shadow: var(--shadow-xs);
}

.filter-divider {
    width: 1px;
    height: 18px;
    background: var(--c-border);
    flex: none;
}

.filter-count {
    font-size: var(--text-xs);
    color: var(--warning-text);
    background: var(--warning-bg);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    white-space: nowrap;
}

.filter-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* 文字型次级按钮 */
.btn-text-muted {
    background: transparent;
    border-color: transparent;
    color: var(--c-text-2);
}

.btn-text-muted:hover {
    background: var(--gray-100);
    border-color: transparent;
    color: var(--c-text);
}

/* 高级筛选面板 */
.advanced-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--gray-50);
    border: 1px solid var(--c-border-soft);
    border-radius: var(--radius-md);
}

.advanced-panel .form-label {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    margin-bottom: 4px;
}

/* ---- 批量操作条：默认收拢，勾选后展开 ---- */
.batch-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 var(--space-3);
    margin-bottom: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    transition: max-height var(--dur-base) var(--ease), opacity var(--dur-fast) var(--ease),
                padding var(--dur-base) var(--ease), margin var(--dur-base) var(--ease);
}

.batch-bar.is-open {
    max-height: 120px;
    opacity: 1;
    padding: 8px var(--space-3);
    margin-bottom: var(--space-3);
    border-color: var(--brand-200);
}

.batch-count {
    font-size: var(--text-sm);
    color: var(--brand-600);
    white-space: nowrap;
}

.batch-count strong {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.batch-select {
    width: auto;
    min-width: 110px;
}

/* ---- 结果元信息 ---- */
.list-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--c-text-3);
    margin-bottom: var(--space-2);
}

.list-meta strong {
    color: var(--c-text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.list-meta .dot { color: var(--gray-300); }

/* ---- 客户表格：定宽 + 两行单元格 ---- */
.customer-table {
    table-layout: fixed;
    min-width: 900px;
}

.customer-table th,
.customer-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 勾选列不做省略处理（否则窄屏会被压成「…」） */
.customer-table th.col-check,
.customer-table td.col-check {
    overflow: visible;
    text-overflow: clip;
    padding-left: 10px;
    padding-right: 4px;
}

.customer-table .col-check { width: 36px; }
.customer-table .col-name { width: 206px; }
.customer-table .col-contact { width: 136px; }
.customer-table .col-director { width: 80px; }
.customer-table .col-owner { width: 78px; }
.customer-table .col-channel { width: 130px; }
.customer-table .col-remind { width: 112px; }
.customer-table .col-date { width: 112px; }
.customer-table .actions-header,
.customer-table .actions-cell { width: 186px; }

/* 操作列三个文字按钮：收紧内距，保证一屏放得下 */
.customer-table .actions-cell .btn-sm {
    padding: 2px 5px;
    font-size: 12px;
}

/* 两行单元格：主信息 + 次级信息 */
.cell-main {
    color: var(--c-text);
    font-size: var(--text-base);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-main-link {
    display: block;
    color: var(--c-text);
    font-size: var(--text-base);
    font-weight: 500;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-main-link:hover { color: var(--c-brand); }

.cell-sub {
    color: var(--c-text-3);
    font-size: var(--text-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}

/* 排序表头 */
.th-sort {
    color: var(--c-text-2);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.th-sort:hover { color: var(--c-text); }
.th-sort i { font-size: 9px; color: var(--brand-500); }

/* 行内删除：桌面悬停该行才显现，降低整列红色噪音 */
@media (hover: hover) and (pointer: fine) {
    .customer-table .row-danger { opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
    .customer-table tr:hover .row-danger,
    .customer-table .row-danger:focus-visible { opacity: 1; }
}

/* 客户表格行高更紧凑（两行内容也控制在 52px 内） */
.customer-table > tbody > tr > td {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* 电话副行：默认隐藏，仅手机显示 */
.name-phone-mobile { display: none; }

/* 操作列吸附右侧：窄屏横向滚动时「详情/编辑/删除」始终可见 */
.customer-table .actions-header,
.customer-table .actions-cell {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--c-surface);
    box-shadow: -6px 0 8px -8px rgba(17, 24, 39, .18);
}

.customer-table thead .actions-header { background: var(--gray-50); }

.customer-table tbody tr:hover .actions-cell { background: var(--gray-50); }

/* 列集分层：按容器可用宽度逐步减列，避免「靠横向滚动 + 吸附遮挡」的体验 */
@media (max-width: 1439.98px) {
    /* 桌面窄一点：先减信息密度最低的「董事」「添加时间」→ 表宽约 962 */
    .customer-table .col-director,
    .customer-table .col-date { display: none; }
}

@media (max-width: 1359.98px) {
    /* 小笔记本：再减「业务员/商务/渠道商」→ 表宽约 676，1024 下一屏放下 */
    .customer-table .col-owner,
    .customer-table .col-channel { display: none; }
    .filter-select { flex: 1 1 128px; min-width: 108px; }
    /* 覆盖 style.css 里 .table-responsive .table 的 760px 保底，让表格按容器收缩 */
    .table-responsive .customer-table,
    .customer-table { min-width: 0; }
}

/* 移动端：只保留名称（含电话）/ 提醒 / 操作，彻底避免横向滚动 */
@media (max-width: 767.98px) {
    .customer-table,
    .table-responsive .customer-table { min-width: 0; }
    .customer-table .col-director,
    .customer-table .col-owner,
    .customer-table .col-channel,
    .customer-table .col-date,
    .customer-table .col-contact { display: none; }
    .customer-table .col-name { width: auto; }
    .customer-table .col-remind { width: 84px; }
    .customer-table .actions-header,
    .customer-table .actions-cell { width: 68px; }
    .customer-table .actions-cell .btn-sm { padding: 2px 4px; font-size: 11.5px; }
    /* 手机端不做批量分配：隐藏勾选列与批量条，把宽度让给客户名称 */
    .customer-table th.col-check,
    .customer-table td.col-check { display: none; }
    .batch-bar { display: none; }
    /* 编辑与删除在手机端收进详情页，列表只留「详情」 */
    .customer-table .actions-cell .btn-outline-warning,
    .customer-table .actions-cell .row-danger { display: none; }
    .name-phone-mobile { display: block; margin-top: 2px; }
    .name-phone-mobile a { color: var(--c-text-2); text-decoration: none; }
    .filter-select { flex: 1 1 46%; }
    .filter-actions { margin-left: 0; width: 100%; }
    .advanced-panel { grid-template-columns: 1fr; }
}

/* 手机：KPI 页脚只保留一个关键信息，避免「本月 ¥8,011」被拆成两行 */
@media (max-width: 575.98px) {
    .kpi-sub { display: none; }
    .kpi-delta { white-space: nowrap; }
    .kpi-foot { gap: var(--space-1); }
    .kpi-spark { height: 30px; }
    .kpi-mini { height: 30px; gap: var(--space-2); }
    .kpi-mini .v { font-size: var(--text-sm); }

    /* 快捷操作：三等分一行，不换行、不参差 */
    .dash-actions { width: 100%; gap: var(--space-2) !important; }
    .dash-actions .btn {
        flex: 1 1 0;
        justify-content: center;
        padding-left: 6px;
        padding-right: 6px;
        font-size: var(--text-sm);
        white-space: nowrap;
    }
}

/* 表单页区块标题：去 Bootstrap 蓝色，改为深灰 15px/600 */
.card-body > h5.text-primary {
    color: var(--c-text) !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.1px;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--c-border-soft);
}

/* ============================================================
   客户详情（2026-11 重设计）
   ============================================================ */

/* ---- 概要头：头像 + 身份 + 操作，指标另起一行 ---- */
.profile-card { margin-bottom: var(--space-4); }

.profile-head {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.profile-avatar {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    color: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 600;
    border: 1px solid var(--brand-100);
}

.profile-identity {
    flex: 1 1 auto;
    min-width: 0;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.profile-name {
    font-size: 19px;
    font-weight: 600;
    color: var(--c-text);
    margin: 0;
    letter-spacing: 0.2px;
}

/* 公司英文名：中文名下方副标题 */
.profile-name-en {
    margin-top: 2px;
    font-size: var(--text-sm);
    color: var(--c-text-3);
    letter-spacing: 0.3px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px var(--space-4);
    margin-top: 5px;
    font-size: var(--text-sm);
    color: var(--c-text-3);
}

.profile-meta i {
    font-size: 12px;
    margin-right: 4px;
    opacity: .8;
}

.profile-actions {
    flex: none;
    display: flex;
    gap: var(--space-2);
}

/* 指标行：与头像块对齐，用细上边线分隔 */
.profile-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-8);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--c-border-soft);
}

.profile-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.profile-metric .m-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.profile-metric .m-label {
    font-size: var(--text-xs);
    color: var(--c-text-3);
}

/* ---- 到期提醒条 ---- */
.due-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: 10px var(--space-4);
    margin-bottom: var(--space-4);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-md);
    color: var(--warning-text);
    font-size: var(--text-base);
}

.due-banner > i { font-size: 15px; }

.due-text {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.due-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.due-hint { font-size: var(--text-xs); opacity: .8; }

/* ---- 左栏信息：dl 两列，去表格线 ---- */
.info-group + .info-group {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--c-border-soft);
}

.info-group-title {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--c-text-3);
    letter-spacing: 0.6px;
    margin-bottom: var(--space-2);
}

.info-grid {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    row-gap: 7px;
    column-gap: var(--space-3);
    margin: 0;
}

.info-grid dt {
    font-size: var(--text-base);
    font-weight: 400;
    color: var(--c-text-3);
}

.info-grid dd {
    font-size: var(--text-base);
    color: var(--c-text);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-grid dd a { color: var(--c-text); text-decoration: none; }
.info-grid dd a:hover { color: var(--c-brand); text-decoration: underline; }

/* ---- 附件列表 ---- */
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 10px;
    border: 1px solid var(--c-border-soft);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}

.attachment-main { flex: 1 1 auto; min-width: 0; }

.attachment-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--c-text);
}

.attachment-name i { color: var(--c-text-3); }

.attachment-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-meta {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    margin-top: 2px;
}

.attachment-actions {
    flex: none;
    display: flex;
    gap: 4px;
}

/* ---- 右栏 Tab：下划线式，去 Bootstrap 卡片内 tab 的厚重感 ---- */
.detail-tabs-header {
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--c-border-soft);
}

.detail-tabs {
    display: flex;
    gap: var(--space-4);
    border-bottom: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.detail-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 12px 2px;
    font-size: var(--text-md);
    color: var(--c-text-2);
    background: transparent;
}

.detail-tabs .nav-link:hover { color: var(--c-text); }

.detail-tabs .nav-link.active {
    color: var(--c-brand);
    font-weight: 600;
    border-bottom-color: var(--c-brand);
    background: transparent;
}

.tab-count {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: var(--radius-pill);
    background: var(--gray-100);
    color: var(--c-text-2);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.detail-tabs .nav-link.active .tab-count {
    background: var(--brand-50);
    color: var(--brand-600);
}

/* ---- 跟进时间线 ---- */
.timeline {
    position: relative;
    padding-left: var(--space-4);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--c-border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-4);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: calc(-1 * var(--space-4) + 1px);
    top: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-surface);
    border: 2px solid var(--brand-300);
}

.timeline-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 4px;
}

.timeline-body {
    font-size: var(--text-base);
    color: var(--c-text);
    margin-bottom: 4px;
    line-height: var(--leading-normal);
}

.timeline-plan {
    font-size: var(--text-sm);
    color: var(--info-text);
    background: var(--info-bg);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    display: inline-block;
    margin-bottom: 4px;
}

.timeline-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease);
}

.timeline-item:hover .timeline-actions,
.timeline-actions:focus-within { opacity: 1; }

/* 触屏设备不依赖 hover，操作常显 */
@media (hover: none) {
    .timeline-actions { opacity: 1; }
}

/* ---- 详情页响应式 ---- */
@media (max-width: 991.98px) {
    .profile-metrics { gap: var(--space-6); }
    .profile-actions { width: 100%; justify-content: flex-end; }
    .profile-head { flex-wrap: wrap; }
}

@media (max-width: 767.98px) {
    .profile-metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
    }
    .profile-metric .m-value { font-size: var(--text-lg); }
    .profile-actions { justify-content: stretch; }
    .profile-actions .btn { flex: 1 1 0; }
    .due-actions { margin-left: 0; width: 100%; }
}

/* ---- 全局 tooltip ---- */
/* 客户名称 / 渠道商等长文本提示：默认 200px 会折成多行并遮挡上方内容 */
.tooltip-inner {
    max-width: 340px;
    font-size: var(--text-xs);
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-align: left;
}

/* ============================================================
   客户模块 · 导入页 / 附件解析页（2026-11 批次八）
   ============================================================ */

/* ---- 页面说明条（替代 Bootstrap alert-info 蓝块）---- */
.page-note {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    padding: 10px 14px;
    margin-bottom: var(--space-4);
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    color: var(--info-text);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}
.page-note i { margin-top: 2px; flex: none; }
.page-note strong { font-weight: 600; }

/* ---- 拖拽上传区 ---- */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--space-8) var(--space-4);
    border: 1.5px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}
.dropzone:hover { border-color: var(--brand-300); background: var(--brand-50); }
.dropzone.is-dragover {
    border-color: var(--brand-500);
    background: var(--brand-50);
    box-shadow: inset 0 0 0 3px var(--brand-100);
}
.dz-empty,
.dz-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.dz-empty[hidden],
.dz-file[hidden] { display: none; }
.dz-empty > i,
.dz-file > i { font-size: 26px; color: var(--brand-500); opacity: .85; }
.dz-file-name {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--c-text);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dz-clear {
    position: relative;
    z-index: 2;
    margin-top: 2px;
    border: 0;
    background: transparent;
    color: var(--c-text-3);
    font-size: var(--text-xs);
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 2px 4px;
}
.dz-clear:hover { color: var(--danger-text); }
/* 已选文件时用实线描边，与空态区分 */
.dropzone.has-file { border-style: solid; border-color: var(--brand-200); background: var(--brand-50); }
.dz-title { font-size: var(--text-md); font-weight: 500; color: var(--c-text); }
.dz-link { color: var(--brand-500); text-decoration: underline; text-underline-offset: 2px; }
.dz-hint { font-size: var(--text-xs); color: var(--c-text-3); }
/* 原生 file input 覆盖整个拖拽区，点击即可选文件 */
.dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

/* ---- 已选文件条 ---- */
.file-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--space-3);
    padding: 10px 12px;
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-md);
}
.file-chip > i { font-size: 16px; color: var(--brand-500); flex: none; }
.file-chip .fc-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-chip .fc-size { font-size: var(--text-xs); color: var(--c-text-3); flex: none; }
.file-chip .fc-remove {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--c-text-3);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.file-chip .fc-remove:hover { color: var(--danger-text); background: var(--danger-bg); }

/* ---- 模板字段 chips ---- */
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-3) 0; }
.field-chip {
    font-size: var(--text-xs);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--c-text-2);
}
.field-chip.is-required {
    background: var(--brand-50);
    border-color: var(--brand-200);
    color: var(--brand-500);
}

/* ---- 附件解析结果页 ---- */
.parse-head {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}
.parse-icon {
    width: 42px;
    height: 42px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: var(--radius-md);
    background: var(--success-bg);
    color: var(--success-text);
}
.parse-icon.is-error { background: var(--warning-bg); color: var(--warning-text); }
.parse-title { font-size: var(--text-lg); font-weight: 600; color: var(--c-text); }
.parse-sub { margin-top: 2px; font-size: var(--text-sm); color: var(--c-text-3); }
.parse-sub a { color: var(--brand-500); }

/* 日期变更对比块 */
.date-compare {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    padding: var(--space-5);
    margin: var(--space-4) 0;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
}
.dc-label { font-size: var(--text-xs); color: var(--c-text-3); }
.dc-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--c-text-2);
    font-variant-numeric: tabular-nums;
    letter-spacing: .3px;
}
.dc-side--new .dc-value { color: var(--brand-600); }
.dc-arrow { color: var(--gray-400); font-size: 18px; }
.dc-note {
    margin-left: var(--space-2);
    padding: 4px 10px;
    font-size: var(--text-sm);
    border-radius: var(--radius-pill);
}
.dc-note.is-later   { background: var(--warning-bg); color: var(--warning-text); }
.dc-note.is-earlier { background: var(--info-bg);    color: var(--info-text); }
.dc-note.is-same    { background: var(--gray-100);   color: var(--c-text-2); }

/* 回写选项（勾选一并写入公司编号） */
.apply-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: 12px 14px;
    margin-bottom: var(--space-4);
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}
.apply-option input { margin-top: 3px; flex: none; }
.apply-option .ao-hint { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--c-text-3); }

/* 长路径省略 */
.text-path {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-xs);
    color: var(--c-text-3);
}

@media (max-width: 767.98px) {
    .date-compare { gap: var(--space-3); padding: var(--space-4); }
    .dc-note { margin-left: 0; }
    .dc-value { font-size: var(--text-lg); }
    .dropzone { padding: var(--space-6) var(--space-3); }
}

/* 解析明细表：长文本可换行（默认 info-grid 单行省略） */
.info-grid--wrap dd { white-space: normal; line-height: var(--leading-normal); }

/* 导入填写提示 */
.import-tips {
    padding: 10px 12px;
    margin-bottom: var(--space-3);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}
.import-tips .it-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--c-text-2);
    margin-bottom: 4px;
}
.import-tips ul {
    margin: 0;
    padding-left: 16px;
    font-size: var(--text-xs);
    color: var(--c-text-2);
    line-height: 1.7;
}
.import-tips code {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--gray-100);
    padding: 1px 4px;
    border-radius: 3px;
    color: var(--c-text);
}

/* 对比块右端影响说明 */
.dc-extra {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--c-text-3);
}
@media (max-width: 767.98px) {
    .dc-extra { margin-left: 0; width: 100%; }
}

/* ============================================================
   客户模块 · 表单页骨架（批次八）
   结构：左主表单（分区卡）+ 右侧辅助栏（sticky）+ 吸底操作条
   ============================================================ */

.form-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--space-4);
    align-items: start;
}

/* ---- 分区 ---- */
.form-section + .form-section {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--c-border);
}

.form-section-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.form-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
    margin: 0;
}

.form-section-title i {
    color: var(--brand-500);
    margin-right: 6px;
    font-size: 14px;
}

.form-section-desc {
    font-size: var(--text-xs);
    color: var(--c-text-3);
}

/* ---- 字段 ---- */
.field {
    margin-bottom: var(--space-4);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-2);
}

.field-label .req {
    color: var(--danger-text);
    margin-left: 2px;
}

.field-hint {
    margin-top: 5px;
    font-size: var(--text-xs);
    color: var(--c-text-3);
    line-height: 1.55;
}

.field-error {
    margin-top: 5px;
    font-size: var(--text-xs);
    color: var(--danger-text);
}

.field-error i {
    margin-right: 4px;
}

/* 只读/自动计算字段 */
.field-static {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    font-size: 13px;
    color: var(--c-text-2);
}

.field-static .auto-tag {
    margin-left: auto;
    font-size: 11px;
    color: var(--c-text-3);
    background: var(--gray-100);
    border-radius: 10px;
    padding: 1px 8px;
}

/* ---- 右侧辅助栏 ---- */
.form-aside {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.aside-card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: #fff;
    padding: var(--space-4);
}

.aside-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--space-3);
}

.aside-card-title i { color: var(--brand-500); font-size: 13px; }

.aside-list {
    margin: 0;
    padding-left: 16px;
    font-size: var(--text-xs);
    color: var(--c-text-2);
    line-height: 1.75;
}

.aside-list li + li { margin-top: 5px; }

.aside-list strong { font-weight: 600; color: var(--c-text); }

.aside-rule {
    display: flex;
    gap: 8px;
    font-size: var(--text-xs);
    color: var(--c-text-2);
    line-height: 1.6;
}

.aside-rule + .aside-rule {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--c-border);
}

.aside-rule .ar-month {
    flex: none;
    min-width: 58px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--brand-600);
}

/* ---- 吸底操作条 ---- */
.form-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: var(--space-3) 0 var(--space-1);
    background: #fff;
    border-top: 1px solid var(--c-border);
}

.form-sticky-actions .fsa-note {
    font-size: var(--text-xs);
    color: var(--c-text-3);
}

.form-sticky-actions .fsa-buttons {
    display: flex;
    gap: var(--space-2);
    margin-left: auto;
}

/* ---- 响应式 ---- */
@media (max-width: 1199.98px) {
    .form-page { grid-template-columns: minmax(0, 1fr); }
    .form-aside { position: static; flex-direction: row; flex-wrap: wrap; }
    .form-aside .aside-card { flex: 1 1 260px; }
}

@media (max-width: 767.98px) {
    .form-aside { flex-direction: column; }
    .form-sticky-actions { flex-wrap: wrap; }
    .form-sticky-actions .fsa-buttons { width: 100%; }
    .form-sticky-actions .fsa-buttons .btn { flex: 1 1 0; }
    .form-section-desc { display: none; }
}

/* ---- 导入页：步骤引导 + 字段分组（批次八） ---- */
.import-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.import-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--c-text-2);
}

.import-step + .import-step::before {
    content: "";
    display: block;
    width: 16px;
    height: 1px;
    background: var(--c-border);
    margin-right: var(--space-2);
    order: -1;
}

.import-step .is-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 11px;
    font-weight: 600;
    flex: none;
}

.chip-group-label {
    font-size: var(--text-xs);
    color: var(--c-text-3);
    margin-bottom: 6px;
}

.chip-group + .chip-group { margin-top: var(--space-3); }

@media (max-width: 767.98px) {
    .import-step + .import-step::before { display: none; }
}

/* 导入页：拖拽区撑满卡片剩余高度 */
.dropzone-fill {
    flex: 1 1 auto;
    margin-bottom: var(--space-4);
}

/* ---- 辅助栏折叠（手机端） ---- */
.aside-fold-summary { display: none; }
.aside-fold-body { display: contents; }

@media (max-width: 767.98px) {
    .aside-fold {
        border: 1px solid var(--c-border);
        border-radius: var(--radius-md);
        background: #fff;
    }
    .aside-fold-summary {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px var(--space-4);
        font-size: 13px;
        font-weight: 600;
        color: var(--c-text);
        cursor: pointer;
        list-style: none;
    }
    .aside-fold-summary::-webkit-details-marker { display: none; }
    .aside-fold-summary > i:first-child { color: var(--brand-500); }
    .aside-fold-summary .af-count {
        margin-left: auto;
        font-size: 11px;
        font-weight: 400;
        color: var(--c-text-3);
        background: var(--gray-100);
        border-radius: 10px;
        padding: 1px 8px;
    }
    .aside-fold-summary .af-arrow {
        font-size: 11px;
        color: var(--c-text-3);
        transition: transform var(--dur-fast) var(--ease);
    }
    .aside-fold[open] .af-arrow { transform: rotate(180deg); }
    .aside-fold-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
        padding: 0 var(--space-3) var(--space-3);
    }
    .aside-fold-body .aside-card { border: 0; padding: var(--space-3) 0 0; }
}

/* ---- 移动端菜单按钮：改为随文档滚动，避免悬浮压住表单内容 ---- */
@media (max-width: 991.98px) {
    .menu-toggle {
        position: absolute;
        top: 12px;
        left: 12px;
    }
}

/* ---- Select2 在表单网格中撑满单元格（默认按初始化瞬时宽度计算，会窄一截） ---- */
.field .select2-container,
.form-section .select2-container {
    width: 100% !important;
}

/* ============================================================
   批次九 · 客户模块颠覆重设计：状态数字条 + 卡片工作台
   ============================================================ */

/* ---- 状态数字条（可点击过滤）---- */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: var(--space-4);
}
.stat-card {
    --sa: var(--brand-500);
    --sa-bg: var(--brand-50);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    text-decoration: none;
    transition: transform var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(16, 24, 40, .09);
    border-color: var(--sa);
    text-decoration: none;
}
.stat-card.is-active {
    border-color: var(--sa);
    background: var(--sa-bg);
    box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
}
.stat-num {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: .3px;
}
.stat-card.is-active .stat-num { color: var(--sa); }
.stat-label {
    font-size: 12px;
    color: var(--c-text-3);
    display: flex;
    align-items: center;
    gap: 5px;
}
.stat-card.is-active .stat-label { color: var(--sa); font-weight: 600; }
.stat-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--sa-bg);
    color: var(--sa);
}
.stat-card.is-active .stat-icon { background: #fff; }
.stat-total   { --sa: var(--brand-500);  --sa-bg: var(--brand-50); }
.stat-insp    { --sa: #d97706;           --sa-bg: #fffbeb; }
.stat-review  { --sa: #2563eb;           --sa-bg: #eff6ff; }
