/* ==================== CSS 变量 ==================== */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #3B82F6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #6366F1;
    --bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==================== 重置样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ==================== 登录页面 ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

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

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-logo i {
    font-size: 32px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

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

.login-form label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.login-form label i {
    color: var(--primary);
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

.captcha-wrapper {
    display: flex;
    gap: 12px;
}

.captcha-wrapper input {
    flex: 1;
}

.captcha-display {
    display: inline-block;
    width: 90px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #667eea;
    font-family: Arial, sans-serif;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 6px;
    user-select: none;
}

.captcha-display:hover {
    opacity: 0.9;
}

.remember-me {
    display: flex;
    align-items: center;
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

.btn-block {
    width: 100%;
    height: 44px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* 客户详情地图 */
.detail-map {
    width: 100%;
    height: 250px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 10px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.active {
    background: var(--primary);
    color: white;
}

.login-error {
    color: var(--danger);
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ==================== 主应用布局 ==================== */
.main-app {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: #1E293B;
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.logo i {
    color: var(--primary-light);
}

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

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #94A3B8;
    transition: all 0.2s;
}

.sidebar-nav ul li a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.sidebar-nav ul li.active a {
    background: var(--primary);
    color: white;
}

.sidebar-nav ul li a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 13px;
}

.user-role {
    font-size: 11px;
    color: #94A3B8;
}

.btn-logout {
    color: #94A3B8;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 101;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-size: 20px;
}

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

/* 顶部导航 */
.top-header {
    height: var(--header-height);
    background: var(--card-bg);
    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;
}

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

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

.header-notice {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.header-notice:hover {
    background: var(--bg);
}

.header-notice i {
    font-size: 18px;
    color: var(--text-secondary);
}

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

/* 内容区域 */
.content-area {
    padding: 24px;
}

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

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

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

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* 仪表盘网格 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.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;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* 回访提醒 */
.visit-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.visit-tab {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.visit-tab:hover {
    background: var(--bg);
}

.visit-tab.active {
    background: var(--primary);
    color: white;
}

.visit-list {
    max-height: 320px;
    overflow-y: auto;
}

.visit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.2s;
}

.visit-item:hover {
    background: #EEF2FF;
}

.visit-item.overdue {
    background: #FEF2F2;
    border-left: 3px solid var(--danger);
}

.visit-item.today {
    border-left: 3px solid var(--warning);
}

.visit-item.tomorrow {
    border-left: 3px solid var(--success);
}

.visit-item-info {
    flex: 1;
}

.visit-item-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.visit-item-phone {
    font-size: 12px;
    color: var(--text-secondary);
}

.visit-item-date {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.visit-item-days {
    font-weight: 500;
    margin-left: 12px;
}

/* 客户等级分布 */
.level-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px 0;
}

.level-stat {
    text-align: center;
}

.level-stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 24px;
}

.level-stat-icon.A { background: #FEE2E2; color: #EF4444; }
.level-stat-icon.B { background: #FEF3C7; color: #F59E0B; }
.level-stat-icon.C { background: #DBEAFE; color: #3B82F6; }
.level-stat-icon.D { background: #F1F5F9; color: #64748B; }

.level-stat-value {
    font-size: 24px;
    font-weight: 700;
}

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

/* 页面工具栏 */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.search-box input {
    border: none;
    padding: 8px 12px;
    width: 200px;
    background: transparent;
}

.search-box input:focus {
    outline: none;
}

.search-box .btn-icon {
    border-left: 1px solid var(--border);
}

select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
}

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #F8FAFC;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

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

.data-table .actions {
    display: flex;
    gap: 8px;
}

.data-table .btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.data-table .btn-action:hover {
    background: var(--primary);
    color: white;
}

.data-table .btn-action.delete:hover {
    background: var(--danger);
}

/* 客户等级标签 */
.level-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 12px;
}

.level-tag.A { background: #FEE2E2; color: #EF4444; }
.level-tag.B { background: #FEF3C7; color: #F59E0B; }
.level-tag.C { background: #DBEAFE; color: #3B82F6; }
.level-tag.D { background: #F1F5F9; color: #64748B; }

.region-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--bg);
}

.status-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.status-tag.active {
    background: #D1FAE5;
    color: #059669;
}

.status-tag.inactive {
    background: #FEE2E2;
    color: #DC2626;
}

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

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 分类设置 */
.classify-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.level-settings .level-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.level-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-item-days {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-item-days input {
    width: 80px;
}

.region-settings .region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.product-grid.list-view {
    grid-template-columns: 1fr;
}

.product-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-image i {
    font-size: 48px;
    color: var(--border);
}

.product-card-body {
    padding: 16px;
}

.product-card-category {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.product-card-name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
}

.product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 8px;
}

.product-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.product-card-stock {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.product-card-stock.in-stock {
    background: #D1FAE5;
    color: #059669;
}

.product-card-stock.out-of-stock {
    background: #FEE2E2;
    color: #DC2626;
}

.product-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* 设置页面 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.settings-item.danger {
    border-color: var(--danger);
    background: #FEF2F2;
}

.settings-info h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

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

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

.modal.active {
    display: flex;
}

.modal-dialog {
    background: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(85vh - 130px);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: var(--card-bg);
    position: sticky;
    bottom: 0;
    z-index: 1;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

/* 地理位置样式 */
.location-input {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.location-input input {
    flex: 1;
}

.location-map {
    width: 100%;
    height: 200px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.form-group label .required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* 归属用户选择 */
.owner-users-group {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    max-height: 120px;
    overflow-y: auto;
}

.owner-user-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.owner-user-label:hover {
    border-color: var(--primary);
}

.owner-user-label input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* 照片上传 */
.photo-upload {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview .photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.photo-add {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.photo-add:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.photo-add i {
    font-size: 24px;
    margin-bottom: 4px;
}

.photo-add span {
    font-size: 12px;
}

/* 回访记录 */
.visit-customer-info {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.visit-customer-info .info-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.visit-customer-info .info-row .label {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
}

.visit-form {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.visit-form h4 {
    margin-bottom: 16px;
    font-size: 15px;
}

.visit-history h4 {
    margin-bottom: 16px;
    font-size: 15px;
}

.visit-history-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.visit-history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.visit-history-stage {
    font-weight: 500;
    color: var(--primary);
}

.visit-history-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.visit-history-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.visit-history-result {
    font-size: 13px;
    color: var(--text-primary);
}

/* 客户详情 */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-photos img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
}

.detail-item {
    margin-bottom: 12px;
}

.detail-item .label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-right: 8px;
}

/* 通知面板 */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 200;
    transition: right 0.3s;
    display: flex;
    flex-direction: column;
}

.notification-panel.active {
    right: 0;
}

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

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

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.notification-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-item:hover {
    background: #EEF2FF;
}

.notification-item.unread {
    border-left: 3px solid var(--primary);
}

.notification-item-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.notification-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.notification-item-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1199px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .classify-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .search-box input {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-dialog {
        margin: 12px;
        max-height: calc(100vh - 24px);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .notification-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
}

/* ==================== 深色主题 ==================== */
body.dark-theme {
    --bg: #0F172A;
    --card-bg: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.5);
}

body.dark-theme .sidebar {
    background: #1E293B;
    border-right-color: #334155;
}

body.dark-theme .sidebar-menu li a {
    color: #94A3B8;
}
body.dark-theme .sidebar-menu li a:hover,
body.dark-theme .sidebar-menu li.active a {
    background: rgba(99,102,241,0.2);
    color: #A5B4FC;
}

body.dark-theme .app-header {
    background: #1E293B;
    border-bottom-color: #334155;
}

body.dark-theme .card {
    background: #1E293B;
    border-color: #334155;
}

body.dark-theme .card-header {
    background: #263348;
    border-bottom-color: #334155;
}

body.dark-theme .data-table th {
    background: #263348;
    color: #94A3B8;
    border-bottom-color: #334155;
}

body.dark-theme .data-table td {
    border-bottom-color: #334155;
    color: #E2E8F0;
}

body.dark-theme .data-table tr:hover td {
    background: rgba(99,102,241,0.1);
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: #263348;
    border-color: #475569;
    color: #F1F5F9;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #64748B;
}

body.dark-theme .modal-content {
    background: #1E293B;
    border: 1px solid #334155;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    background: #263348;
    border-color: #334155;
}

body.dark-theme .stat-card {
    background: #1E293B;
    border-color: #334155;
}

body.dark-theme .sidebar-brand {
    border-bottom-color: #334155;
    color: #F1F5F9;
}

body.dark-theme .sidebar-user {
    border-top-color: #334155;
    background: #263348;
}

body.dark-theme .notification-panel {
    background: #1E293B;
    border-left-color: #334155;
}

body.dark-theme .notification-item {
    border-bottom-color: #334155;
}
body.dark-theme .notification-item:hover {
    background: #263348;
}

body.dark-theme .form-group label {
    color: #94A3B8;
}

body.dark-theme .settings-item {
    border-bottom-color: #334155;
}

body.dark-theme .search-box input {
    background: #263348;
    border-color: #475569;
    color: #F1F5F9;
}

body.dark-theme .btn-secondary {
    background: #334155;
    color: #E2E8F0;
    border-color: #475569;
}
body.dark-theme .btn-secondary:hover {
    background: #475569;
}

body.dark-theme .visit-history-filter input,
body.dark-theme .visit-history-filter select {
    background: #263348;
    border-color: #475569;
    color: #F1F5F9;
}

/* 深色主题下开关样式 */
body.dark-theme #themeToggleTrack {
    background: #4F46E5 !important;
}
body.dark-theme #themeToggleThumb {
    transform: translateX(22px) !important;
}
body.dark-theme #themeToggleText { color: #6B7280; }
body.dark-theme #themeToggleTextRight { color: #A5B4FC; font-weight: 600; }


/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

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

.empty-state p {
    margin-bottom: 16px;
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1E293B;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 满意度评分 */
.satisfaction-rating {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rating-star {
    font-size: 24px;
    color: #E2E8F0;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-star:hover,
.rating-star.active {
    color: #F59E0B;
}

.rating-star:hover {
    transform: scale(1.1);
}

/* 客户标签样式 */
.customer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.tag-intent {
    background: #FEE2E2;
    color: #DC2626;
}

.tag-price {
    background: #FEF3C7;
    color: #D97706;
}

.tag-decision {
    background: #DBEAFE;
    color: #2563EB;
}

.tag-cooperation {
    background: #D1FAE5;
    color: #059669;
}

.tag-followup {
    background: #FCE7F3;
    color: #DB2777;
}

.tag-quoted {
    background: #E0E7FF;
    color: #4F46E5;
}

/* ==================== 数据统计页面 ==================== */
#pageStatistics .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    #pageStatistics .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== 批量操作工具栏 ==================== */
#batchToolbar {
    border-radius: 10px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 密码强度条 ==================== */
#passwordStrengthBar {
    transition: all 0.3s ease;
}

/* ==================== 通知状态栏 ==================== */
#notifyStatusBar {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== 数据统计卡片增强 ==================== */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* ==================== 逾期行样式 ==================== */
tr[style*="background: #FFF5F5"] td {
    border-bottom-color: #FECACA;
}

/* ==================== 选中复选框样式 ==================== */
.customer-select-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

#selectAllCustomers {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ==================== 确认对话框动画 ==================== */
#confirmDialog {
    animation: fadeIn 0.2s ease;
}

#confirmDialog > div {
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== 系统设置增强 ==================== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-item.danger {
    border: 1px solid #FECACA;
    border-radius: 8px;
    padding: 12px;
    background: #FFF5F5;
}

/* ==================== 回访提醒逾期高亮 ==================== */
.visit-item.overdue {
    border-left: 3px solid var(--danger);
    background: #FFF5F5;
}

.visit-item.today {
    border-left: 3px solid var(--warning);
    background: #FFFBEB;
}

.visit-item.tomorrow {
    border-left: 3px solid var(--info);
    background: #EEF2FF;
}

