/* ===== 导购外拓客资管理系统 - 全局样式 ===== */
:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --info: #13c2c2;
    --text: #262626;
    --text-secondary: #595959;
    --text-muted: #8c8c8c;
    --border: #d9d9d9;
    --bg: #f5f5f5;
    --bg-white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 220px;
    --header-height: 56px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f5ff 100%);
    position: relative;
}

.login-box {
    width: 400px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 24px;
    color: var(--text);
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 13px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover { background: #389e0d; }

.btn-warning {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

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

.btn-secondary {
    background: white;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; width: 100%; }

.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 管理员登录入口 */
.admin-entry {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.admin-entry a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s;
}

.admin-entry a:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-lg);
}

/* ===== 布局框架 ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #001529;
    color: rgba(255,255,255,0.65);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: all 0.3s;
}

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

.sidebar-header .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.sidebar-header .logo-text {
    color: white;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.sidebar-header .logo-text small {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-weight: normal;
}

.nav-menu { padding: 8px 0; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255,255,255,0.65);
    transition: all 0.2s;
    cursor: pointer;
    gap: 10px;
    font-size: 14px;
}

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

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

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

.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-header .breadcrumb {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bell-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.bell-btn:hover { background: var(--bg); }

.bell-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.user-dropdown:hover { background: var(--bg); }

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

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

/* ===== 卡片组件 ===== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

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

.card-body { padding: 20px; }

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

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

.stat-icon.blue { background: #e6f7ff; color: var(--primary); }
.stat-icon.green { background: #f6ffed; color: var(--success); }
.stat-icon.orange { background: #fff7e6; color: var(--warning); }
.stat-icon.red { background: #fff1f0; color: var(--danger); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 6px;
}

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

/* ===== 表格 ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.data-table tbody tr:hover { background: #fafafa; }

.data-table .actions { white-space: nowrap; }

/* ===== 标签徽章 ===== */
.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 2px;
}

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

.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== 时间轴 ===== */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-sm);
}

/* ===== 任务卡片 ===== */
.task-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
}

.task-card.completed { border-left-color: var(--success); opacity: 0.7; }
.task-card.overdue { border-left-color: var(--danger); }

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.task-title { font-weight: 600; font-size: 15px; }

.task-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.task-progress-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.task-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

.task-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

/* ===== 提醒列表 ===== */
.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.reminder-item .reminder-icon {
    width: 36px;
    height: 36px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reminder-item .reminder-info { flex: 1; }
.reminder-item .reminder-info h4 { font-size: 14px; margin-bottom: 2px; }
.reminder-item .reminder-info p { font-size: 12px; color: var(--text-muted); }

/* ===== 图表容器 ===== */
.chart-container {
    width: 100%;
    height: 300px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.modal-box {
    background: var(--bg-white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 { font-size: 16px; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== 通知下拉 ===== */
.notif-dropdown {
    position: absolute;
    top: 48px;
    right: -10px;
    width: 360px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    z-index: 200;
}

.notif-dropdown.active { display: block; }

.notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-list { max-height: 360px; overflow-y: auto; }

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover { background: #fafafa; }
.notif-item.unread { background: #e6f7ff; }
.notif-item .notif-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.notif-item .notif-time { font-size: 11px; color: var(--text-muted); }

/* ===== 排行列表 ===== */
.rank-list { list-style: none; }
.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.rank-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.rank-num.top3 { background: var(--primary); color: white; }
.rank-num.normal { background: var(--bg); color: var(--text-muted); }

.rank-info { flex: 1; }
.rank-info h4 { font-size: 14px; font-weight: 500; }
.rank-info p { font-size: 12px; color: var(--text-muted); }

.rank-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

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

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-control { width: 100%; }
    .login-box { width: 90%; padding: 24px; }
}

/* ===== 辅助类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }

.mr-1 { margin-right: 8px; }
.ml-1 { margin-left: 8px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 16px; }

.w-100 { width: 100%; }

.hidden { display: none !important; }

/* 表单行 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

/* 标签选择器 */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-option {
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    user-select: none;
}

.tag-option:hover { border-color: var(--primary); }
.tag-option.selected {
    border-color: var(--primary);
    background: #e6f7ff;
    color: var(--primary);
}

/* 快捷时间选择 */
.quick-time {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.quick-time span {
    padding: 3px 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
}

.quick-time span:hover { background: #e6f7ff; color: var(--primary); }
