/* ==================== CSS变量定义 ==================== */
:root {
    /* 主题色 */
    --primary-color: #1890ff;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #f5222d;
    --info-color: #13c2c2;

    /* 中性色 */
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-tertiary: #8c8c8c;
    --border-color: #d9d9d9;
    --bg-white: #ffffff;
    --bg-light: #fafafa;
    --bg-gray: #f5f5f5;

    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* 布局 */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-light);
}

html, body {
    height: 100%;
    overflow: hidden;
}

/* ==================== 页面容器 ==================== */
.page {
    display: none;
    width: 100%;
    height: 100%;
}

.page.active {
    display: block;
}

/* ==================== 登录页面 ==================== */
#login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
}

#login-page.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

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

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

.login-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.login-form {
    margin-bottom: 24px;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.login-footer {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ==================== 主应用页面 ==================== */
#app-page {
    display: none;
}

#app-page.active {
    display: flex;
    height: 100vh;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    overflow: hidden;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    flex-shrink: 0;
    position: sticky;
    top: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: #fff;
    transition: all 0.3s;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md) 0;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 4px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px var(--spacing-lg);
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-menu a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-menu a.active {
    color: #fff;
    background: var(--primary-color);
}

.nav-menu a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-menu a span {
    margin-left: var(--spacing-md);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-menu a span {
    display: none;
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-bottom: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

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

.sidebar.collapsed .user-info {
    display: none;
}

.btn-logout {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar.collapsed .btn-logout {
    padding: 8px 0;
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== 顶部栏 ==================== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.page-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ==================== 内容区域 ==================== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    scrollbar-width: none; /* Firefox */
}
.content-area::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* 侧边栏导航也隐藏滚动条 */
.sidebar-nav {
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
    display: none;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #40a9ff;
    border-color: #40a9ff;
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #73d13d;
    border-color: #73d13d;
}

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

.btn-warning:hover:not(:disabled) {
    background: #ffc53d;
    border-color: #ffc53d;
}

.btn-danger {
    background: var(--error-color);
    border-color: var(--error-color);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #ff4d4f;
    border-color: #ff4d4f;
}

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

.btn-default:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--primary-color);
    background: rgba(24, 144, 255, 0.1);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==================== 卡片样式 ==================== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}

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

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.card-body {
    padding: var(--spacing-lg);
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

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

.stat-icon.primary {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.stat-icon.warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.stat-icon.error {
    background: rgba(245, 34, 45, 0.1);
    color: var(--error-color);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 12px;
    font-weight: 500;
}

.stat-trend.up {
    color: var(--success-color);
}

.stat-trend.down {
    color: var(--error-color);
}

/* ==================== 表格样式 ==================== */
.table-container {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

table thead {
    background: var(--bg-light);
}

table th {
    padding: 12px var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 12px var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: rgba(24, 144, 255, 0.02);
}

/* ==================== 标签样式 ==================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.tag-primary {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary-color);
}

.tag-success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.tag-warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.tag-error {
    background: rgba(245, 34, 45, 0.1);
    color: var(--error-color);
}

.tag-info {
    background: rgba(19, 194, 194, 0.1);
    color: var(--info-color);
}

.tag-default {
    background: rgba(140, 140, 140, 0.1);
    color: var(--text-tertiary);
}

/* ==================== 表单样式 ==================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.form-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

/* ==================== 徽章 ==================== */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--error-color);
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== Toast提示 ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1000;
}

.toast {
    min-width: 280px;
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

.empty-state-text {
    font-size: 14px;
    margin-bottom: var(--spacing-md);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
    }

    .sidebar.mobile-open {
        left: 0;
    }

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

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

    .table-container {
        overflow-x: auto;
    }

    .topbar-left .btn-icon {
        display: flex;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 聊天界面样式 ==================== */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 8px;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.chat-bubble-ai {
    background: var(--bg-gray);
    color: var(--text-primary);
}

.chat-bubble-user {
    background: var(--primary-color);
    color: var(--bg-white);
    margin-left: auto;
}

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

.input-group input {
    flex: 1;
}

/* ==================== 文本颜色辅助类 ==================== */
.text-error {
    color: var(--error-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

/* ==================== 表单控件增强 ==================== */
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

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

/* ==================== 进度条样式 ==================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* ==================== 循环加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 下拉选择增强 ==================== */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9l4 4-1.5-1.5L6 6l2.5 2.5L12 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

/* ==================== 标签增强 ==================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.tag-primary {
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary-color);
}

.tag-success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.tag-warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.tag-error {
    background: rgba(245, 34, 45, 0.1);
    color: var(--error-color);
}

.tag-info {
    background: rgba(19, 194, 194, 0.1);
    color: var(--info-color);
}

.tag-default {
    background: rgba(140, 140, 140, 0.1);
    color: var(--text-tertiary);
}

/* ==================== 详情折叠面板 ==================== */
details {
    background: var(--bg-light);
    border-radius: 6px;
    transition: all 0.3s;
}

details[open] {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

details summary {
    cursor: pointer;
    padding: 12px;
    font-weight: 500;
    list-style: none;
    user-select: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: '+';
    float: right;
    font-size: 18px;
    line-height: 1;
}

details[open] summary::after {
    content: '-';
}

/* ==================== 数据可视化占位 ==================== */
.chart-placeholder {
    width: 100%;
    height: 200px;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

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

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

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

.timeline-item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-white);
}

/* ==================== 徽徽样式 ==================== */
.badge-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.badge-dot-success {
    background: var(--success-color);
}

.badge-dot-warning {
    background: var(--warning-color);
}

.badge-dot-error {
    background: var(--error-color);
}

/* ==================== 搜索框样式 ==================== */
.search-box {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.search-box::after {
    content: '🔍';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* ==================== 过滤器样式 ==================== */
.filter-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.filter-item label {
    white-space: nowrap;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 分页器样式 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) 0;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 6px;
    cursor: pointer;
}

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

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

.pagination .page-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 步骤条样式 ==================== */
.steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    text-align: center;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-sm);
    font-weight: 500;
}

.step.active .step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-white);
}

.step.completed .step-circle {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--bg-white);
}

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

/* ==================== 文件上传组件 ==================== */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.05);
}

.file-upload.dragover {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.1);
}

.file-upload-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.file-upload-text {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.file-upload-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ==================== 开关切换 ==================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider::before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ==================== 徽信度选择 ==================== */
.rating {
    display: inline-flex;
    gap: 4px;
}

.rating-star {
    font-size: 20px;
    cursor: pointer;
    color: var(--border-color);
    transition: color 0.2s;
}

.rating-star:hover,
.rating-star.active {
    color: var(--warning-color);
}

/* ==================== 徽据表格（复杂） ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(to bottom, var(--bg-light), var(--bg-white));
}

.data-table th {
    padding: 12px var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: rgba(24, 144, 255, 0.02);
}

/* ==================== 徽单行表格 ==================== */
.table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.table-row:last-child {
    border-bottom: none;
}

.table-row-label {
    font-weight: 500;
    color: var(--text-primary);
}

.table-row-value {
    color: var(--text-secondary);
}

/* ==================== 徽据卡片列表 ==================== */
.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.item-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-md);
    transition: all 0.3s;
}

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

.item-card-title {
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.item-card-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.item-card-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* ==================== 徽度盘 ==================== */
.spinbox {
    display: inline-flex;
    align-items: center;
}

.spinbox-button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.spinbox-button:hover {
    background: var(--bg-gray);
}

.spinbox-input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    padding: 6px;
}

.spinyin-input:focus {
    outline: none;
}

/* ==================== 徽态加载 ==================== */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(24, 144, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 徽骨架屏 ==================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-light) 25%,
        var(--bg-gray) 50%,
        var(--bg-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ==================== 时间标签 ==================== */
.time-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(24, 144, 255, 0.1);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 12px;
}

/* ==================== 徽态徽章 ==================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.status-badge.success::before {
    background: var(--success-color);
}

.status-badge.warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.status-badge.warning::before {
    background: var(--warning-color);
}

.status-badge.error {
    background: rgba(245, 34, 45, 0.1);
    color: var(--error-color);
}

.status-badge.error::before {
    background: var(--error-color);
}

/* ==================== 操作按钮组 ==================== */
.action-group {
    display: flex;
    gap: 4px;
}

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

.btn-xs {
    padding: 2px 8px;
    font-size: 12px;
}

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .action-group {
        display: none !important;
    }

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

    .card {
        page-break-inside: avoid;
    }
}

/* ==================== 模态框样式 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s;
}

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

.modal-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ==================== 二级页面通用样式 ==================== */
.form-page,
.detail-page,
.followup-page,
.recommend-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section,
.detail-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-section h3,
.detail-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.required {
    color: var(--error-color);
}

/* ==================== 详情页面样式 ==================== */
.detail-header {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.detail-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.detail-content {
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ==================== 数据网格 ==================== */
.data-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.data-item {
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    text-align: center;
}

.data-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.data-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== 时间轴增强 ==================== */
.timeline-content {
    padding-bottom: 8px;
}

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

.timeline-text {
    color: var(--text-primary);
    line-height: 1.6;
}

.timeline-result {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 4px;
}

/* ==================== 奖励信息 ==================== */
.reward-info {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-md);
    color: white;
    margin-bottom: 24px;
}

.reward-info h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.reward-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.reward-label {
    font-size: 14px;
}

.reward-value {
    font-size: 16px;
    font-weight: 600;
}

/* ==================== 移动端模态框优化 ==================== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

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

    .detail-header {
        flex-direction: column;
        gap: 12px;
    }
}
/* ==================== 移动端底部导航栏 ==================== */
.mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    z-index: 999;
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #999;
    cursor: pointer;
    flex: 1;
}

.tabbar-item i {
    font-size: 22px;
}

.tabbar-item span {
    font-size: 11px;
}

.tabbar-item.active {
    color: var(--primary-color);
}

.tabbar-item.active span {
    font-weight: bold;
}

/* ==================== 移动端页面容器适配 ==================== */
.mobile-page-container {
    padding-bottom: 56px; /* 为底部导航栏留出空间 */
    background: #f8f9fa;
    min-height: 100vh;
}

/* ==================== 佣金页面专用样式 ==================== */
.commission-header-bg {
    background: #f8f9fa; /* 淡淡的浅灰色背景，不再是白色 */
    padding: 16px;
}

.commission-summary-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.commission-summary-card {
    flex: 1;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.summary-label {
    font-size: 12px;
    color: #8c8c8c;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 20px;
    font-weight: bold;
    color: #111;
}

.commission-list-container {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.list-header {
    background: #fff;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #999;
    font-size: 12px;
}

.commission-item {
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.commission-item:active {
    background: #f5f5f5;
}

.item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-no {
    font-size: 14px;
    color: #111;
    font-weight: 500;
}

.order-amount {
    font-size: 12px;
    color: #999;
}

.item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

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

.comm-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-pending {
    background: #fff7e6;
    color: #faad14;
}


.status-issued {
    background: #f6ffed;
    color: #52c41a;
}

/* 推荐新人页面样式 */
.recommend-page {
    background-color: #f8f9fa;
}

.recommend-action-section {
    padding: 16px;
    background: #fff;
    margin: 16px;
    border-radius: 12px;
}

.recommend-full-btn {
    width: 100%;
    height: 48px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.recommend-records-container {
    padding: 0 16px 80px 16px;
}

.recommend-records-container .section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #333;
}

.recommend-table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.recommend-table .table-header {
    display: flex;
    padding: 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    color: #999;
    font-size: 12px;
}

.recommend-row {
    display: flex;
    padding: 14px 12px;
    border-bottom: 1px solid #f5f5f5;
    align-items: center;
    font-size: 13px;
    color: #333;
}

.recommend-row:last-child {
    border-bottom: none;
}

.col-name, .rec-name { width: 60px; }
.col-phone, .rec-phone { width: 100px; }
.col-date, .rec-date { width: 90px; color: #666; font-size: 12px; }
.col-status, .rec-status { flex: 1; text-align: right; }

.rec-status.status-success { color: #52c41a; }
.rec-status.status-primary { color: var(--primary-color); }
.rec-status.status-error { color: #ff4d4f; }

/* ==================== 代理人移动端专属样式 ==================== */
.m-page {
    background: #f4f6f8;
    min-height: 100vh;
    padding-bottom: 70px;
    font-size: 14px;
}

/* 顶部 Header */
.m-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #fff;
}
.m-header-left { display: flex; align-items: center; gap: 10px; }
.m-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 18px; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
}
.m-greeting { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.m-greeting-sub { font-size: 12px; color: #999; margin-top: 2px; }
.m-notif-btn { position: relative; cursor: pointer; color: #555; }
.m-notif-btn .material-icons { font-size: 26px; }
.m-notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: #ff4d4f; color: #fff;
    font-size: 10px; min-width: 16px; height: 16px;
    border-radius: 8px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
}

/* 统计卡片网格 */
.m-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 16px 0;
}
.m-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-stat-card.m-stat-warn { border: 1.5px solid #fff3cd; background: #fffbf0; }
.m-stat-val { font-size: 20px; font-weight: 700; color: #1a1a1a; }
.m-stat-warn .m-stat-val { color: #faad14; }
.m-stat-lbl { font-size: 11px; color: #888; margin-top: 4px; }

/* 预警横幅 */
.m-banner {
    margin: 0 16px 4px;
    background: #fff7e6;
    border-left: 3px solid #faad14;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #d46b08;
}

/* 分区块 */
.m-section {
    background: #fff;
    border-radius: 12px;
    margin: 10px 16px 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.m-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px 8px;
}
.m-section-title { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.m-section-more { font-size: 12px; color: var(--primary-color); cursor: pointer; }

/* 订单行（首页） */
.m-order-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    cursor: pointer;
}
.m-order-row:active { background: #f9f9f9; }
.m-order-name { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.m-order-meta { font-size: 12px; color: #999; margin-top: 2px; }

/* 列表行（订单页） */
.m-list-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px;
    border-top: 1px solid #f0f0f0;
    cursor: pointer;
}
.m-list-row:active { background: #f9f9f9; }
.m-list-name { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.m-list-meta { font-size: 12px; color: #999; margin-top: 2px; }
.m-list-right { text-align: right; }
.m-list-days { font-size: 11px; color: #888; margin-top: 4px; }

/* 常用工具 */
.m-tools-row {
    display: flex;
    padding: 8px 14px 14px;
    gap: 12px;
}
.m-tool-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 6px; cursor: pointer;
    background: #f4f6f8; border-radius: 10px; padding: 12px 6px;
}
.m-tool-item .material-icons { font-size: 22px; color: var(--primary-color); }
.m-tool-item span { font-size: 11px; color: #555; }

/* 页面标题 */
.m-page-title {
    font-size: 18px; font-weight: 700; color: #1a1a1a;
    padding: 16px 16px 8px;
    background: #fff;
}

/* 待办 task 行 */
.m-task-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
}
.m-task-title { font-size: 13px; color: #333; }
.m-task-meta { font-size: 12px; color: #999; margin-top: 2px; }
.m-task-meta.m-task-warn { color: #ff4d4f; }
.m-task-urgent { background: #fff7e6; }
.m-task-done { background: #f6ffed; }
.m-check-badge {
    background: #52c41a; color: #fff;
    font-size: 12px; padding: 3px 8px; border-radius: 12px;
    cursor: pointer;
}

/* 我的页面 */
.m-profile-header {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 16px 16px;
    background: #fff;
    margin-bottom: 10px;
}
.m-profile-avatar {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--primary-color); color: #fff;
    font-size: 24px; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
}
.m-profile-name { font-size: 18px; font-weight: 700; color: #1a1a1a; }
.m-profile-role { font-size: 12px; color: #888; margin-top: 4px; }

.m-profile-stats-row {
    display: flex;
    background: #fff;
    border-radius: 12px;
    margin: 10px 16px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden;
}
.m-profile-stat {
    flex: 1; text-align: center; padding: 16px 0;
    border-right: 1px solid #f0f0f0;
}
.m-profile-stat:last-child { border-right: none; }
.m-profile-stat-val { font-size: 20px; font-weight: 700; color: var(--primary-color); }
.m-profile-stat-lbl { font-size: 11px; color: #888; margin-top: 4px; }

.m-menu-list {
    background: #fff;
    border-radius: 12px;
    margin: 10px 16px 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.m-menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
}
.m-menu-item:last-child { border-bottom: none; }
.m-menu-item:active { background: #f9f9f9; }
.m-menu-icon { font-size: 20px; color: var(--primary-color); }
.m-menu-label { flex: 1; font-size: 14px; color: #1a1a1a; }
.m-menu-arrow { font-size: 18px; color: #ccc; }

.m-logout-btn {
    margin: 10px 16px 0;
    padding: 14px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    color: #ff4d4f;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* 通用 */
.m-loading { padding: 20px; text-align: center; color: #999; font-size: 13px; }
.m-empty { padding: 20px; text-align: center; color: #bbb; font-size: 13px; }
.m-empty-error { color: #ff4d4f; }

/* 移动端 SVG 图标尺寸修正 */
.m-tab-icon svg { width: 22px; height: 22px; display: block; }
.m-tool-svg svg { width: 24px; height: 24px; display: block; }
.m-menu-icon svg { width: 20px; height: 20px; display: block; }
.m-menu-arrow svg { width: 16px; height: 16px; display: block; color: #ccc; }
.m-notif-btn .m-tab-icon svg { width: 26px; height: 26px; display: block; }
.tabbar-item .m-tab-icon { display: flex; align-items: center; justify-content: center; }

/* ==================== 我的 - 二级页面样式 ==================== */

/* 子页面顶部返回栏 */
.m-sub-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px;
    background: #fff;
    font-size: 17px; font-weight: 600; color: #1a1a1a;
    border-bottom: 1px solid #f0f0f0;
    position: sticky; top: 0; z-index: 10;
}
.m-back-btn { display: flex; align-items: center; cursor: pointer; color: #555; background: none; border: none; padding: 8px; margin: -8px; }
.m-back-btn svg { width: 20px; height: 20px; }
.m-sub-title { flex: 1; text-align: center; margin-right: 28px; }

/* 我的佣金 */
.mc-summary-bar {
    display: flex; align-items: center; justify-content: space-around;
    background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05);
    padding: 20px 16px; margin: 10px 16px 0;
}
.mc-sum-item { text-align: center; }
.mc-sum-lbl { font-size: 12px; color: #888; margin-bottom: 6px; }
.mc-sum-val { font-size: 22px; font-weight: 700; color: #1a1a1a; }
.mc-sum-divider { width: 1px; height: 40px; background: #f0f0f0; }
.mc-list-header { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 12px; color: #aaa; border-top: 1px solid #f5f5f5; }
.mc-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid #f5f5f5; cursor: pointer; }
.mc-row:active { background: #f9f9f9; }
.mc-order-no { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.mc-order-amt { font-size: 12px; color: #999; margin-top: 2px; }
.mc-comm-amt { font-size: 15px; font-weight: 700; color: #ff6b00; text-align: right; }
.mc-status { font-size: 12px; margin-top: 3px; text-align: right; }
.mc-status-paid { color: #52c41a; }
.mc-status-pending { color: #faad14; }
.mc-status-review { color: var(--primary-color); }

/* 职级评定 */
.rank-current { font-size: 16px; color: #333; margin-bottom: 12px; }
.rank-name { color: var(--primary-color); font-weight: 700; }
.rank-progress-wrap { margin-bottom: 16px; }
.rank-progress-bar { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.rank-progress-fill { height: 100%; background: var(--primary-color); border-radius: 4px; transition: width .6s; }
.rank-period { font-size: 12px; color: #999; margin-bottom: 6px; }
.rank-amount { font-size: 20px; font-weight: 700; color: var(--primary-color); margin-bottom: 4px; }
.rank-count { font-size: 13px; color: #888; text-align: right; margin-bottom: 12px; }
.rank-tip { font-size: 13px; color: #aaa; background: #f8f9fa; padding: 10px 12px; border-radius: 8px; }

/* 推荐新人 */
.rec-main-btn {
    width: 100%; padding: 14px; background: var(--primary-color); color: #fff;
    border: none; border-radius: 24px; font-size: 16px; font-weight: 600; cursor: pointer; margin-bottom: 10px;
}
.rec-outline-btn {
    width: 100%; padding: 13px; background: #fff; color: var(--primary-color);
    border: 1.5px solid var(--primary-color); border-radius: 24px; font-size: 16px; cursor: pointer;
}
.rec-list-header { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 12px; color: #aaa; border-top: 1px solid #f5f5f5; }
.rec-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-top: 1px solid #f5f5f5; font-size: 13px; }
.rec-name { width: 50px; font-weight: 500; }
.rec-phone { flex: 1; color: #555; padding: 0 6px; }
.rec-date { color: #999; font-size: 12px; padding: 0 6px; }
/* 推荐表单 */
.rec-form-group { margin-bottom: 16px; }
.rec-form-label { display: block; font-size: 14px; color: #333; margin-bottom: 6px; font-weight: 500; }
.rec-required { color: #ff4d4f; }
.rec-form-input { width: 100%; padding: 12px; border: 1px solid #e8e8e8; border-radius: 8px; font-size: 14px; box-sizing: border-box; background: #fff; }
.rec-form-input:focus { outline: none; border-color: var(--primary-color); }
.rec-form-textarea { height: 90px; resize: none; }
.rec-form-btns { display: flex; gap: 12px; margin-top: 8px; }
.rec-btn-cancel { flex: 1; padding: 13px; background: #fff; border: 1px solid #ddd; border-radius: 24px; font-size: 15px; cursor: pointer; }
.rec-btn-submit { flex: 2; padding: 13px; background: var(--primary-color); color: #fff; border: none; border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; }
/* 推荐结果页 */
.rec-result-wrap { display: flex; flex-direction: column; align-items: center; padding: 48px 24px 24px; gap: 12px; }
.rec-result-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.rec-result-icon svg { width: 36px; height: 36px; }
.rec-result-ok { background: #52c41a; }
.rec-result-fail { background: #ff4d4f; }
.rec-result-title { font-size: 22px; font-weight: 700; color: #1a1a1a; }
.rec-result-desc { font-size: 14px; color: #888; text-align: center; margin-bottom: 12px; }

/* 消息设置 Toggle */
.m-toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.m-toggle input { display: none; }
.m-toggle-slider {
    position: absolute; inset: 0; background: #ccc; border-radius: 13px; cursor: pointer; transition: .3s;
}
.m-toggle-slider:before {
    content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: .3s;
}
.m-toggle input:checked + .m-toggle-slider { background: var(--primary-color); }
.m-toggle input:checked + .m-toggle-slider:before { transform: translateX(20px); }

/* ===== 消息中心（移动端）===== */
.mn-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #fff;
    border-bottom: 1px solid #f0f0f0; position: sticky; top: 0; z-index: 10;
}
.mn-header-title { font-size: 17px; font-weight: 700; color: #1a1a1a; }
.mn-read-all-btn { font-size: 14px; color: #1677ff; cursor: pointer; padding: 4px 0; }
.mn-tabs {
    display: flex; background: #fff;
    border-bottom: 1px solid #f0f0f0; position: sticky; top: 49px; z-index: 9;
}
.mn-tab {
    flex: 1; text-align: center; padding: 12px 0; font-size: 14px;
    color: #888; cursor: pointer; border-bottom: 2px solid transparent; transition: all .2s;
}
.mn-tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 600; }
.mn-list { flex: 1; overflow-y: auto; background: #f5f6fa; }
.mn-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 16px; background: #fff; border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.mn-item:active { background: #f9f9f9; }
.notif-page-row:hover { background: #f5f5f5 !important; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.notif-page-row[data-read="false"]:hover { background: #bae7ff !important; }
.mn-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
    background: transparent;
}
.mn-dot-unread { background: #ff4d4f; }
.mn-body { flex: 1; min-width: 0; }
.mn-title-row {
    display: flex; align-items: center; gap: 4px; margin-bottom: 4px; flex-wrap: nowrap;
}
.mn-type-tag { font-size: 13px; font-weight: 600; flex-shrink: 0; }
.mn-title { font-size: 14px; color: #1a1a1a; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-title-bold { font-weight: 600; }
.mn-time { font-size: 11px; color: #bbb; flex-shrink: 0; margin-left: auto; }
.mn-preview { font-size: 13px; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 10px; flex-shrink: 0; font-weight: 500;
}
.mn-badge-official { background: #f0f5ff; color: #1677ff; }
.mn-badge-sys { background: #f6f6f6; color: #999; }

/* 通知详情页 */
.mnd-wrap { padding: 16px; flex: 1; overflow-y: auto; background: #fff; }
.mnd-breadcrumb { font-size: 12px; color: #bbb; margin-bottom: 16px; }
.mnd-title { font-size: 20px; font-weight: 700; color: #1a1a1a; line-height: 1.4; margin: 0 0 14px; }
.mnd-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.mnd-tag { font-size: 12px; padding: 2px 10px; border-radius: 12px; font-weight: 500; }
.mnd-tag-sys { background: #f0f5ff; color: #1677ff; }
.mnd-tag-biz { background: #fff7e6; color: #fa8c16; }
.mnd-date { font-size: 12px; color: #bbb; }
.mnd-body { font-size: 15px; color: #333; line-height: 1.9; }

/* ==================== 移动端订单/客户列表页 ==================== */
.m-orders-tab-page {
    position: fixed;
    inset: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f4f6f8;
    font-size: 14px;
}
.m-orders-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 66px;
}
.m-tab-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.m-tab-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid #f5f5f5;
}
.m-tab-section-title { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.m-tab-section-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.m-tab-section-footer {
    border-top: 1px solid #f5f5f5;
    text-align: center;
    padding: 8px;
    flex-shrink: 0;
}
.m-more-btn {
    display: inline-block;
    font-size: 13px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 2px 12px;
    background: #f0f7ff;
    border-radius: 20px;
    font-weight: 500;
}
.m-more-btn:active { background: #ddeeff; }

/* 全屏列表页（订单列表 / 客户列表） */
.m-list-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f4f6f8;
    font-size: 14px;
}
.m-list-page-header {
    display: flex; align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.m-list-page-back {
    display: flex; align-items: center; cursor: pointer; color: #555;
    margin-right: 8px;
}
.m-list-page-back svg { width: 20px; height: 20px; }
.m-list-page-title {
    flex: 1; text-align: center; font-size: 17px; font-weight: 600; color: #1a1a1a;
    margin-right: 28px;
}

/* 状态筛选栏 */
.m-filter-bar {
    display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
    background: #fff; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
    scrollbar-width: none;
}
.m-filter-bar::-webkit-scrollbar { display: none; }
.m-filter-chip {
    display: inline-flex; align-items: center; white-space: nowrap;
    padding: 5px 14px; border-radius: 20px;
    font-size: 13px; cursor: pointer;
    background: #f5f5f5; color: #555;
    border: 1.5px solid transparent; flex-shrink: 0;
    transition: all 0.15s;
}
.m-filter-chip.active {
    background: #e6f4ff; color: var(--primary-color);
    border-color: var(--primary-color); font-weight: 600;
}

/* 列表滚动区域 */
.m-list-scroll {
    flex: 1; overflow-y: auto; padding: 10px 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.m-list-scroll::-webkit-scrollbar { width: 0; }

/* 订单卡片 */
.m-order-card {
    background: #fff; border-radius: 12px;
    padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-order-card-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.m-order-card-no { font-size: 12px; color: #999; }
.m-order-card-date { font-size: 12px; color: #bbb; }
.m-order-card-mid {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.m-order-card-name { font-size: 16px; font-weight: 700; color: #1a1a1a; }
.m-order-card-product { font-size: 12px; color: #888; margin-top: 2px; }
.m-order-card-bottom {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 10px; border-top: 1px solid #f5f5f5;
}
.m-order-card-amount { font-size: 18px; font-weight: 700; color: #1677ff; }
.m-order-card-amount span { font-size: 13px; }

/* 客户卡片 */
.m-customer-card {
    background: #fff; border-radius: 12px;
    padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.m-customer-card-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.m-customer-card-name { font-size: 16px; font-weight: 700; color: #1a1a1a; }
.m-customer-card-phone { font-size: 13px; color: #888; }
.m-customer-card-bottom {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 10px; border-top: 1px solid #f5f5f5;
}
.m-customer-card-protect {
    font-size: 13px; color: #555;
}
.m-customer-card-protect span { color: #fa8c16; font-weight: 600; }
.m-customer-card-cert { font-size: 12px; color: #888; }
.m-customer-card-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    padding-top: 10px; margin-top: 8px; border-top: 1px solid #f5f5f5;
}
.m-customer-card-actions .btn { font-size: 13px; padding: 5px 14px; }


/* ==================== 移动端日报提交页 ==================== */
.mdr-breadcrumb {
    font-size: 12px; color: #bbb;
    padding: 8px 16px 0;
}
.mdr-row {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; padding: 14px 16px;
    border-bottom: 1px solid #f5f5f5;
    margin-bottom: 8px; border-radius: 12px;
}
.mdr-label { font-size: 14px; color: #333; }
.mdr-date-input {
    border: none; outline: none;
    font-size: 14px; font-weight: 600; color: #1677ff;
    text-align: left; background: transparent;
}
.mdr-section-title {
    font-size: 13px; font-weight: 600; color: #1a1a1a;
    padding: 10px 4px 6px;
}
.mdr-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden; margin-bottom: 8px;
}
/* 日报详情页卡片（无 overflow:hidden，避免内容截断）*/
.mdrd-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    margin-bottom: 8px;
}
.mdrd-card-title {
    padding: 14px 16px; font-weight: 700; font-size: 15px;
    border-bottom: 1px solid #f5f5f5; color: #1a1a1a;
}
.mdr-field-row {
    display: flex; align-items: center; justify-content: flex-start; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid #f5f5f5;
}
.mdr-field-row:last-child { border-bottom: none; }
.mdr-field-label { font-size: 14px; color: #333; }
.mdr-number-input {
    width: 80px; text-align: center;
    border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 6px 8px; font-size: 15px; color: #1a1a1a;
    outline: none;
}
.mdr-number-input:focus { border-color: #1677ff; }
.mdr-upload-box {
    background: #f8faff; border: 1.5px dashed #c0d4f5;
    border-radius: 12px; padding: 28px 16px;
    text-align: center; cursor: pointer;
    margin-bottom: 8px; min-height: 100px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.mdr-upload-box:active { background: #eef4ff; }
.mdr-submit-bar {
    padding: 16px 16px 8px;
    display: flex; justify-content: center;
}
.mdr-submit-btn {
    width: 50%; padding: 14px;
    background: #1677ff; color: #fff;
    border: none; border-radius: 24px;
    font-size: 16px; font-weight: 600;
    cursor: pointer; letter-spacing: 1px;
}
.mdr-submit-btn:active { background: #0958d9; }
.mdr-submit-btn:disabled { background: #aaa; cursor: not-allowed; }

/* 日报已提交按钮 */
.m-dr-done-btn {
    background: #f0faf0; color: #52c41a; border: 1px solid #b7eb8f;
    border-radius: 20px; padding: 4px 14px; font-size: 13px;
    cursor: default; white-space: nowrap;
}

/* ==================== 移动端响应式适配 (Direction B) ==================== */
@media (max-width: 768px) {
    /* iOS 输入框防缩放 */
    input, select, textarea { font-size: 16px !important; }

    /* 按钮触摸目标 44px+ */
    .btn { min-height: 40px; padding: 10px 16px; font-size: 14px; }
    .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
    .btn-primary, .btn-default, .btn-danger, .btn-warning, .btn-success { min-height: 40px; }

    /* 主内容区减少内边距 */
    .main-content { padding: 12px 10px; }

    /* 侧边栏默认隐藏（通过 JS 控制，这里做防护） */
    .sidebar { z-index: 200; }

    /* 卡片头部换行 */
    .card-header { flex-wrap: wrap; gap: 8px; }
    .card-header .header-actions { flex-wrap: wrap; gap: 6px; }
    .card-body { padding: 12px; }

    /* 表格横向滚动 */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
    table { min-width: max-content; }

    /* 表单布局 */
    .form-grid { grid-template-columns: 1fr !important; gap: 12px; }
    .form-group { margin-bottom: 12px; }
    .form-actions { flex-wrap: wrap; gap: 8px; }
    .form-actions .btn { flex: 1 1 auto; min-width: 100px; }

    /* 模态框全宽 */
    .modal-container { width: 95vw !important; max-width: 95vw !important; padding: 20px 16px; margin: 0 auto; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-container.bottom-sheet { border-radius: 16px 16px 0 0; width: 100vw !important; max-width: 100vw !important; margin: 0; }

    /* 订单表单-期限选项：竖向排列，label block 布局防溢出 */
    #co-price-radios { flex-direction: column !important; }
    #co-price-radios label { width: 100% !important; }

    /* 订单详情：订单信息+客户信息两列改单列 */
    .order-detail-grid { grid-template-columns: 1fr !important; }

    /* 统计卡片网格：手机 2 列 */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 22px; }

    /* 筛选栏换行 */
    .filter-bar { flex-wrap: wrap; gap: 8px; }
    .filter-item { min-width: 0; flex: 1 1 140px; }

    /* OCR 结果网格单列 */
    #dr-ocr-fields, .dr-ocr-fields-grid { grid-template-columns: 1fr !important; }

    /* 详情页两栏变单栏 */
    .detail-grid { grid-template-columns: 1fr !important; }

    /* 日报历史表格：允许横向滚动，取消最小宽度限制 */
    .dr-history-table { min-width: 580px; }

    /* 养老金计算器 iframe 高度自适应 */
    .pension-iframe { height: min(720px, 80vh) !important; }

    /* 状态标签缩小 */
    .status-badge, .tag { font-size: 11px; padding: 2px 6px; }

    /* 顶部导航 */
    .topbar { padding: 0 12px; }
    .topbar-title { font-size: 15px; }

    /* 搜索框全宽 */
    .search-bar input { width: 100%; }
}

@media (max-width: 480px) {
    /* 更小屏幕：统计卡片仍 2 列但更紧凑 */
    .stats-grid { gap: 8px; }
    .stat-card { padding: 10px 8px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 11px; }

    /* 卡片内边距更小 */
    .card-body { padding: 10px 8px; }
    .main-content { padding: 8px 6px; }

    /* 按钮全宽 */
    .form-actions .btn { width: 100%; }

    /* 字体缩小 */
    .card-title { font-size: 14px; }
    table th, table td { font-size: 12px; padding: 8px 6px; }
}

/* ==================== 社保问答聊天页面 ==================== */
#social-chat-page {
    display: flex;
    flex-direction: column;
    /* 减去 tab 栏高度（56px），使输入框不被遮挡 */
    height: calc(100dvh - 56px);
    height: calc(100vh - 56px);
    background: #f5f5f7;
    overflow: hidden;
}

/* 页头右侧"新对话"按钮 */
.chat-clear-btn {
    font-size: 12px;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    line-height: 1.4;
    white-space: nowrap;
}

/* 消息滚动区 */
.chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
}

/* 欢迎行（机器人第一条） */
.chat-welcome {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* 每条消息行 */
.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.chat-row-user {
    flex-direction: row-reverse;
}

/* 机器人头像 */
.chat-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 机器人气泡 */
.chat-bubble-bot {
    background: #fff;
    color: #222;
    border-radius: 0 12px 12px 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    max-width: calc(100% - 52px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    word-break: break-word;
}

/* 用户气泡 */
.chat-bubble-user {
    background: var(--primary, #4F6AFF);
    color: #fff;
    border-radius: 12px 0 12px 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    max-width: 78%;
    word-break: break-word;
    box-shadow: 0 1px 4px rgba(79,106,255,0.25);
}

/* 流式光标闪烁 */
.chat-cursor {
    display: inline-block;
    color: var(--primary, #4F6AFF);
    animation: chat-blink 0.8s step-end infinite;
    margin-left: 2px;
}
@keyframes chat-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 底部输入栏 */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: #f7f7f7;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color 0.2s;
}
.chat-input:focus {
    border-color: var(--primary, #4F6AFF);
    background: #fff;
}

.chat-send-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary, #4F6AFF);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    padding: 0;
}
.chat-send-btn:active { transform: scale(0.93); }
.chat-send-btn:disabled { background: #bbb; cursor: not-allowed; }
