/* ========================================== */
        /* 🎨 全局设计令牌 (Design Tokens) */
        /* ========================================== */
        :root {
            /* 主题色系 */
            --color-primary: #3498db;      /* 主蓝 */
            --color-primary-hover: #2980b9;
            --color-success: #27ae60;      /* 成功绿 */
            --color-warning: #f39c12;      /* 警告橙 */
            --color-danger: #e74c3c;       /* 危险红 */
            --color-purple: #8e44ad;       /* 高管紫 */

            /* 文字与中性色 */
            --text-main: #2c3e50;          /* 标题深灰 */
            --text-regular: #34495e;       /* 正文常规 */
            --text-muted: #7f8c8d;         /* 辅助浅灰 */
            --text-faint: #95a5a6;         /* 极浅灰（禁用态/回收态） */

            /* 背景与边框 */
            --bg-page: #f4f7f6;
            --bg-card: #ffffff;
            --bg-soft: #fdfefe;
            --bg-light: #f8f9fa;
            --border-light: #ecf0f1;       /* 浅色分割线 */
            --border-normal: #ccd1d9;      /* 输入框边框 */
            --border-soft: #e0e0e0;

            /* 通用间距 */
            --spacing-sm: 8px;
            --spacing-md: 12px;
            --spacing-lg: 15px;
        }

        /* ========================================== */
        /* 🛠️ 通用辅助类 (Utility Classes) */
        /* ========================================== */
        /* 字体颜色类 */
        .text-primary { color: var(--color-primary) !important; }
        .text-success { color: var(--color-success) !important; }
        .text-warning { color: var(--color-warning) !important; }
        .text-danger  { color: var(--color-danger) !important; }
        .text-purple  { color: var(--color-purple) !important; }
        .text-muted   { color: var(--text-muted) !important; }

        /* 侧边栏按钮专属组件样式 */
        .sidebar-menu-btn {
            background: transparent;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            padding: var(--spacing-md) var(--spacing-lg);
            border-radius: 8px;
            font-size: 15px;
            border-bottom: 1px solid var(--border-light);
            color: var(--text-regular);
            box-shadow: none;
            width: 100%;
            transition: background 0.2s;
        }
        .sidebar-menu-btn:hover { background-color: #f8f9fa; }

        /* 客户跟进漏斗：彩色状态 Tab 按钮 */
        .status-tab-btn {
            background-color: var(--color-primary);
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            opacity: 0.55;
            transition: opacity 0.2s, transform 0.1s;
        }
        .status-tab-btn:hover { opacity: 0.8; }
        .status-tab-btn.active { opacity: 1; transform: scale(1.03); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
        .status-tab-danger   { background-color: var(--color-danger); }
        .status-tab-main     { background-color: var(--text-main); }
        .status-tab-muted    { background-color: var(--text-faint); }
        .status-tab-warning  { background-color: var(--color-warning); }
        .status-tab-purple   { background-color: var(--color-purple); }
        .status-tab-primary  { background-color: var(--color-primary); }
        .status-tab-success  { background-color: var(--color-success); }

        /* === 全局与基础样式 === */
        body { font-family: 'Segoe UI', "Microsoft YaHei", sans-serif; background-color: var(--bg-page); margin: 0; padding: 15px; color: #333; transition: padding 0.3s; }
        * { box-sizing: border-box; }
        .container { max-width: 1200px; margin: 0 auto; background: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); transition: padding 0.3s; }
        h1, h2, h3 { color: #2c3e50; }

        /* === 登录界面 === */
        .login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
        .login-card { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 100%; max-width: 380px; text-align: center; }
        .login-card input { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; outline: none; transition: border-color 0.2s;}
        .login-card input:focus { border-color: #3498db; }
        .switch-auth { margin-top: 20px; font-size: 14px; color: #7f8c8d; }
        .switch-auth span { color: #3498db; cursor: pointer; text-decoration: underline; font-weight: bold; }
        .btn-full { width: 100%; padding: 12px; font-size: 16px; font-weight: bold; }

        /* === 按钮 === */
        button { background-color: #3498db; color: white; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
        button:hover { background-color: #2980b9; }
        .btn-success { background-color: #2ecc71; font-size: 16px; padding: 12px 20px; width: 100%; font-weight: bold; }
        .btn-success:hover { background-color: #27ae60; }
        .btn-add { background-color: #f39c12; margin-top: 10px; width: 100%;}
        .btn-add:hover { background-color: #e67e22; }
        .btn-back { background-color: #95a5a6; }
        .btn-back:hover { background-color: #7f8c8d; }
        .btn-small-danger { background-color: transparent; color: #e74c3c; padding: 8px; font-size: 14px; margin-left: 10px; border: 1px solid #e74c3c;}
        .btn-small-danger:hover { background-color: #ffeaa7; color: #c0392b; border-radius: 4px;}
        .btn-export { background-color: #27ae60; }
        .btn-export:hover { background-color: #219653; }
        .btn-logout { background-color: #e74c3c; }
        .btn-logout:hover { background-color: #c0392b; }
        .btn-delete-customer { background-color: #e74c3c; color: white; }
        .btn-delete-customer:hover { background-color: #c0392b; }

        /* === 首页布局与表格 === */
        .top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; transition: all 0.3s;}
        .top-nav-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
        .top-nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        .search-input { padding: 10px 15px; border: 1px solid #ccd1d9; border-radius: 6px; font-size: 14px; min-width: 200px; outline: none; transition: all 0.2s; flex-grow: 1; }
        .search-input:focus { border-color: #3498db; box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }

        .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 6px; border: 1px solid #e0e0e0; }
        .home-table { width: 100%; border-collapse: collapse; background-color: #fff; min-width: 800px; }
        .home-table th, .home-table td { border-bottom: 1px solid #e0e0e0; padding: 12px 15px; text-align: left; }
        .home-table th { background-color: #f8f9fa; color: #2c3e50; font-weight: 600; white-space: nowrap; text-align: center; }
        .home-table td:first-child { text-align: left; }
        .home-table td { color: #555; white-space: nowrap; }
        .clickable-name { color: #3498db; text-decoration: underline; cursor: pointer; font-weight: bold; display: inline-block; }

        .badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: bold; cursor: pointer; user-select: none; }
        .badge-success { background-color: #eafaf1; color: #27ae60; border: 1px solid #2ecc71; }
        .badge-warning { background-color: #fdfae1; color: #e67e22; border: 1px solid #f1c40f; }
        .list-summary { text-align: right; margin-top: 15px; color: #7f8c8d; font-size: 14px; }
        .vip-select { padding: 4px 8px; border-radius: 4px; border: 1px solid #ccd1d9; font-size: 13px; font-weight: bold; outline: none; cursor: pointer; background-color: #fff; color: #2c3e50; transition: border-color 0.2s;}

        optgroup { font-weight: bold; color: #2980b9; background-color: #f8f9fa; }

        /* === 客情分析看板样式 === */
        .analysis-section { margin-bottom: 30px; }
        .analysis-section h3 { margin-bottom: 15px; border-left: 4px solid #1abc9c; padding-left: 10px; color: #2c3e50; }
        .analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }
        .analysis-card { background: #fdfefe; border: 1px solid #ecf0f1; padding: 15px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.03); }
        .analysis-card h4 { margin: 0 0 10px 0; color: #34495e; font-size: 15px; border-bottom: 1px dashed #bdc3c7; padding-bottom: 8px;}
        .clickable-badge { margin: 4px 4px 4px 0; transition: transform 0.1s; display: inline-block; }
        .clickable-badge:hover { transform: scale(1.05); }

        /* === 详情页 === */
        .tabs-container { margin-top: 10px; }
        .tabs-header { display: flex; border-bottom: 2px solid #ecf0f1; margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
        .tab-btn { background-color: transparent; color: #7f8c8d; border: none; padding: 12px 15px; font-size: 15px; font-weight: bold; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; flex: 1; text-align: center; }
        .tab-btn.active { color: #3498db; border-bottom: 3px solid #3498db; }
        .tab-pane { display: none; animation: fadeIn 0.3s; }
        .tab-pane.active { display: block; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

        textarea.main-textarea { width: 100%; height: 180px; padding: 15px; border: 2px dashed #ccd1d9; border-radius: 6px; font-family: inherit; resize: vertical; font-size: 14px; line-height: 1.5; background-color: #fafbfc; transition: height 0.3s; }
        .info-card { background: #fdfefe; border-left: 5px solid #3498db; padding: 15px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); border: 1px solid #f1f2f6; border-left-width: 5px; }
        .info-card p { margin: 12px 0; font-size: 15px; line-height: 1.5; word-break: break-all;}

        .accordion-item { margin-bottom: 15px; border: 1px solid #dcdde1; border-radius: 6px; overflow: hidden; }
        .accordion-header { background-color: #f1f2f6; padding: 15px; cursor: pointer; font-weight: bold; display: flex; justify-content: space-between; align-items: center; color: #2f3640; }
        .accordion-content { display: none; background-color: #fff; border-top: 1px solid #dcdde1; overflow-x: auto;}

        .vertical-table { width: 100%; border-collapse: collapse; min-width: 300px;}
        .vertical-table th, .vertical-table td { border-bottom: 1px solid #f1f2f6; padding: 12px 15px; text-align: left; }
        .vertical-table th { width: 35%; background-color: #f8f9fa; color: #576574; font-weight: 600; border-right: 1px solid #f1f2f6; }
        .vertical-table td { width: 65%; color: #2f3640; }
        .editable-cell { cursor: text; display: inline-block; width: auto; min-width: 100px; min-height: 20px;}
        .editable-cell:focus { background-color: #fff9c4; outline: none; border-bottom: 1px dashed #f39c12 !important; }

        .top-row th { background-color: #eaf2f8; color: #2980b9; }
        .edit-tip { font-size: 13px; color: #e67e22; margin: 0 0 15px 0; background-color: #fdfae1; padding: 10px; border-radius: 4px; border-left: 3px solid #f39c12; }

        .record-input-area { display: flex; gap: 10px; margin-bottom: 20px; align-items: flex-start; }
        .record-date-input { padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-family: inherit; }
        .record-text-input { flex-grow: 1; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-family: inherit; resize: vertical; min-height: 42px; }

        .record-card { background: #fff; border-left: 4px solid #2ecc71; padding: 15px; margin-bottom: 15px; border-radius: 0 6px 6px 0; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #f1f2f6; border-left-width: 4px; display: flex; justify-content: space-between; align-items: flex-start;}
        .record-date { font-size: 13px; color: #7f8c8d; font-weight: bold; margin-bottom: 5px; }
        .editable-record { font-size: 14px; color: #2c3e50; line-height: 1.6; white-space: pre-wrap; cursor: text; border-bottom: 1px dashed #bdc3c7; padding-bottom: 2px; min-height: 22px; display: block; outline: none; }
        .editable-record:focus { background-color: #fffde7; }

        .action-bar { display: flex; gap: 15px; margin-top: 25px; flex-wrap: wrap;}
        .hidden { display: none !important; }
        #loading-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(255,255,255,0.9); z-index: 9999; display: flex; justify-content: center; align-items: center; font-size: 18px; color: #3498db; font-weight: bold; flex-direction: column; gap: 10px;}

        /* 💡 自动保存 Toast 动画样式 */
        #auto-save-toast { position: fixed; top: 20px; left: 50%; transform: translate(-50%, -20px); background: rgba(46, 204, 113, 0.95); color: white; padding: 10px 24px; border-radius: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 10001; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); font-weight: bold; font-size: 14px; display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none;}
        #auto-save-toast.toast-enter { opacity: 1; transform: translate(-50%, 0); }

        /* === 日志特有样式 === */
        .log-item { padding: 12px; border-bottom: 1px dashed #ecf0f1; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
        .log-time { color: #95a5a6; font-size: 12px; min-width: 70px; text-align: right; margin-top: 2px;}
        .log-badge-record { color: #3498db; font-weight: bold; margin-right: 8px; font-size: 13px; background: #eaf2f8; padding: 2px 6px; border-radius: 4px;}

        /* ================= 📱 手机横竖屏自适应 ================= */
        @media (max-width: 900px) {
            body { padding: 10px; }
            .container { padding: 15px; }
            .tab-btn { padding: 10px 5px; font-size: 14px; white-space: nowrap; }
            h1 { font-size: 22px; }
        }
        @media (max-width: 900px) and (orientation: portrait) {
            .top-nav { flex-direction: column; align-items: stretch; }
            .top-nav-left { flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: 10px; }
            
            /* 🚀 核心优化：将右侧功能区改为 Grid 2列网格布局 */
            .top-nav-right {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 8px;
                width: 100%;
            }
            
            /* 性别和年龄筛选：各占一半 (1列) */
            #filter-gender, #filter-age {
                grid-column: span 1;
                width: 100%;
            }
            
            /* 区域筛选、员工筛选、搜索框：占满整行 (2列) */
            #filter-region, #filter-agent, #searchInput {
                grid-column: span 2;
                width: 100%;
            }
            
            /* 按钮全局设定：缩小内边距，取消底部外边距，适应网格 */
            .top-nav-right button {
                width: 100%;
                margin-bottom: 0;
                padding: 8px 4px;
                font-size: 13px;
            }
            
            /* “+新增” 是高频操作：特别放大并占满整行 */
            .top-nav-right button[onclick="openAddView()"] {
                grid-column: span 2;
                padding: 12px;
                font-size: 15px;
            }

            /* 全量节点如果显示，也占满整行 */
            .top-nav-right button[onclick="openSysNodeView()"] {
                grid-column: span 2;
            }

            /* 其他底部操作栏保持不变 */
            .record-input-area { flex-direction: column; align-items: stretch; }
            .record-date-input, .record-text-input { width: 100%; }
            .record-input-area button { width: 100%; margin-top: 5px; padding: 12px; }
            .action-bar { flex-direction: column; }
            .action-bar button { width: 100%; padding: 12px; }
        }

/* ========================================== */
/* 🌿 护眼模式 (Eye-Care Theme) 覆盖样式 */
/* ========================================== */

/* 1. 外层大背景：经典护眼豆沙绿 */
body {
    background-color: #C7EDCC !important;
}

/* 2. 主面板、卡片：极浅的柔和绿，替代刺眼的纯白 */
.container,
.login-card,
.analysis-card,
.info-card,
.record-card,
.accordion-content {
    background-color: #F0F8F1 !important;
}

/* 3. 表格整体底色 */
.home-table {
    background-color: #F0F8F1 !important;
}

/* 4. 表头底色：稍微加深一点以区分层次 */
.home-table th {
    background-color: #E2EFE1 !important;
}

/* 5. 底部分页条及其他白底元素的微调 */
#customer-count-summary > div {
    background-color: #F0F8F1 !important;
}

/* 6. 表格行的 hover 效果（鼠标悬浮时更清晰） */
.home-table tbody tr:hover {
    background-color: #E6F2E7 !important;
}

/* ========================================== */
/* 🗂️ 四象限工作台 (高级时间流排版 & 交互) */
/* ========================================== */
.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    min-height: 75vh;
}
.matrix-card {
    background: #fff; border-radius: 10px; border: 1px solid #e2e8f0;
    display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.03); overflow: hidden;
}
.q1 { border-top: 5px solid #ef4444; } /* 重要紧急-红 */
.q2 { border-top: 5px solid #f59e0b; } /* 重要不紧急-黄 */
.q3 { border-top: 5px solid #3b82f6; } /* 不重要紧急-蓝 */
.q4 { border-top: 5px solid #10b981; } /* 不重要不紧急-绿 */

.matrix-header {
    padding: 14px 18px; background: #fff; border-bottom: 1px solid #edf2f7;
    font-weight: bold; color: #2d3748; display: flex; justify-content: space-between; align-items: center;
    font-size: 15px;
}
.matrix-list-content {
    padding: 12px; flex-grow: 1; overflow-y: auto; background: #f8fafc; display: flex; flex-direction: column; gap: 12px;
}

/* ⏳ 时间分组标题样式 */
.matrix-time-group-title {
    font-size: 12px; font-weight: bold; color: #718096; margin: 5px 0; display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
}

/* 🎯 任务单条条目 */
.task-row-container {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.01); transition: all 0.2s;
}
.task-row-main {
    display: flex; align-items: center; padding: 12px; gap: 10px; cursor: pointer;
}
.task-row-main:hover { background: #f8fafc; }

/* ⭕ 经典圆形打勾器 */
.task-circle-checkbox {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd5e0; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all 0.2s; background: #fff;
}
.task-circle-checkbox:hover { border-color: #4a5568; background: #edf2f7; }
.task-row-container.completed .task-circle-checkbox {
    background: #cbd5e0; border-color: #cbd5e0; color: white; font-size: 11px; font-weight: bold;
}

/* 📝 标题文字 */
.task-title-text {
    font-size: 14px; color: #2d3748; flex-grow: 1; font-weight: 500; line-height: 1.4; transition: color 0.2s;
}
.task-row-container.completed .task-title-text {
    text-decoration: line-through; color: #a0aec0; /* 完成后打线变灰 */
}

/* 🏷️ 时间戳角标 */
.task-time-badge {
    font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #edf2f7; color: #4a5568; white-space: nowrap; font-weight: normal;
}
.task-row-container.completed .task-time-badge { background: #f7fafc; color: #cbd5e0; }

/* 📖 向下展开的事件描述区 */
.task-desc-panel {
    background: #fafbfc; border-top: 1px dashed #edf2f7; padding: 12px 12px 12px 38px; font-size: 13px; color: #4a5568; line-height: 1.6; white-space: pre-wrap; word-break: break-all; animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    /* 已有：四象限网格单列 */
    .matrix-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
    .matrix-card { min-height: 300px; }

    /* 新增：全局间距 */
    body { padding: 10px; }
    .container { padding: 15px; }
    .tab-btn { padding: 10px 5px; font-size: 14px; white-space: nowrap; }
    h1 { font-size: 22px; }

    /* ========================================== */
    /* 🚀 手机端：表格变身信息流卡片魔法 */
    /* ========================================== */

    /* 1. 隐藏传统的横向表头 */
    .home-table thead { display: none; }

    /* 2. 把表格本体变成透明的容器块 */
    .home-table, .home-table tbody {
        display: block; width: 100%; background: transparent !important;
    }

    /* 3. 把原本的 <tr> (行) 变成一张张圆角阴影卡片 */
    .home-table tbody tr {
        display: block;
        background-color: var(--bg-card, #ffffff) !important;
        margin-bottom: 15px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        border: 1px solid var(--border-light, #edf2f7);
        padding: 5px 15px 15px 15px;
    }

    /* 4. 把原本横向排列的 <td> 变成垂直排列的一行行小数据 */
    .home-table tbody td {
        display: flex;
        justify-content: space-between; /* 名字在左，数值在右 */
        align-items: center;
        border-bottom: 1px dashed var(--border-light, #f1f2f6);
        padding: 10px 0;
        text-align: right;
    }
    .home-table tbody td:last-child { border-bottom: none; }

    /* 5. 读取 ui.js 里写的 data-label，自动生成手机端的左侧说明文字 */
    .home-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--text-muted, #7f8c8d);
        font-size: 13px;
        text-align: left;
        flex-shrink: 0;
        margin-right: 15px;
    }

    /* 6. 特殊处理第一个单元格 (姓名操作区)，让它充当整张卡片的耀眼大标题 */
    .home-table tbody td:first-child {
        border-bottom: 1px solid var(--border-light, #ecf0f1);
        padding-bottom: 12px;
        margin-bottom: 5px;
        justify-content: flex-start; /* 靠左对齐 */
    }
    .home-table tbody td:first-child::before {
        display: none; /* 姓名行不需要显示"客户信息"四个字前缀 */
    }

    /* 修正输入框和下拉框在手机端的排版 */
    .home-table td input, .home-table td select {
        text-align: right;
        background: transparent;
        max-width: 150px;
    }
}

/* ========================================== */
/* ⏳ 强化四象限时间选择器图标 */
/* ========================================== */

/* 将原生隐藏在右侧的灰色小日历图标，强行改造成醒目的蓝色按钮形状 */
#task-input-time::-webkit-calendar-picker-indicator {
    background-color: #eaf2f8;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid #3498db;
    opacity: 1; /* 防止某些浏览器下默认变淡隐藏 */
    transition: all 0.2s ease;
}

/* 鼠标悬停时的反馈 */
#task-input-time::-webkit-calendar-picker-indicator:hover {
    background-color: #d6eaf8;
    transform: scale(1.05);
}
