/* 基础样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            display: flex;
            min-height: 100vh;
            background-color: #f5f7fa;
            color: #333;
            overflow-x: hidden;
            flex-direction: column; /* 讓 sidebar 和 main-content 水平排列 */
        }

        /* 应用容器 - 包含侧边栏和主内容 */
        .app-container {
            display: flex;
            flex: 1;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 260px;
            background: linear-gradient(135deg, #2c3e50, #1a2530);
            color: white;
            padding: 20px 0;
            display: flex;
            flex-direction: column;
            transition: all 0.3s ease;
            box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
            position: relative;
            z-index: 100;
        }

        .sidebar.collapsed {
            width: 70px;
        }

        .logo {
            display: flex;
            align-items: center;
            padding: 0 20px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 20px;
        }

        .logo h2 {
            font-size: 1.6rem;
            font-weight: 600;
            margin-left: 12px;
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .logo h2 {
            opacity: 0;
            width: 0;
            overflow: hidden;
        }

        .logo-icon {
            font-size: 1.8rem;
            background: #309ce3;
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .toggle-btn {
            position: absolute;
            top: 25px;
            right: -12px;
            background: #3498db;
            color: white;
            border: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
        }

        .sidebar.collapsed .toggle-btn {
            transform: rotate(180deg);
        }

        .menu {
            list-style: none;
            padding: 0 15px;
        }

        .menu li {
            margin-bottom: 5px;
        }

        .menu a {
            display: flex;
            align-items: center;
            color: #ecf0f1;
            text-decoration: none;
            padding: 14px 15px;
            border-radius: 8px;
            transition: all 0.3s ease;
            white-space: nowrap;
            overflow: hidden;
        }

        .menu a:hover, .menu a.active {
            background: rgba(52, 152, 219, 0.2);
            color: #fff;
        }

        .menu a i {
            font-size: 1.2rem;
            margin-right: 15px;
            width: 24px;
            text-align: center;
            transition: margin 0.3s ease;
        }

        .sidebar.collapsed .menu a i {
            margin-right: 0;
        }

        .menu-text {
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .menu-text {
            opacity: 0;
            width: 0;
            overflow: hidden;
        }

        .menu a:hover .menu-text, .menu a.active .menu-text {
            transform: translateX(2px);
        }

        /* 主内容区域 */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            padding: 30px;
            transition: all 0.3s ease;
        }

        .sidebar.collapsed + .main-content {
           /* margin-left: 0;*/
            margin-left: 70px;
            width: calc(100% - 70px);
        }

        /* 头部样式 */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #e0e6ed;
            flex-wrap: wrap; /* 添加换行支持 */
            gap: 15px; /* 添加间距 */
        }

        .header h1 {
            color: #2c3e50;
            font-size: 2rem;
            margin: 0; /* 移除默认边距 */
            flex: 1; /* 让标题占据可用空间 */
            min-width: 200px; /* 最小宽度避免挤压 */
        }

        .search-buttons {
            display: flex;
            align-items: center;
            margin-bottom: 24px;
            flex-wrap: wrap;
            gap: 15px;
        }

        #search-form {
            display: flex;
            flex: 1;
            max-width: 500px;
            min-width: 250px;
            margin-right: 24px;
        }

        #search-form input {
            flex: 1;
            padding: 12px 18px;
            font-size: 1rem;
            border: 1px solid #ddd;
            border-radius: 8px 0 0 8px;
            outline: none;
            transition: border 0.3s ease;
        }

        #search-form input:focus {
            border-color: #3498db;
            box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
        }

        #search-form button {
            padding: 12px 20px;
            font-size: 1rem;
            cursor: pointer;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 0 8px 8px 0;
            transition: background 0.3s ease;
        }

        #search-form button:hover {
            background: #2980b9;
        }

        .nav-buttons {
            display: flex;
            gap: 12px;
        }

        .nav-buttons button {
            padding: 10px 20px;
            font-size: 1rem;
            cursor: pointer;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 8px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
        }

        .nav-buttons button i {
            margin-right: 8px;
        }

        .nav-buttons button:hover {
            background: #2980b9;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

       /* 头部控制区域样式 - 修改为并排靠右 */
/* 头部控制区域样式 */
.header-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap; /* 不换行 */
}

/* 日期显示样式 */
.date-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    color: #2563eb;
    font-weight: 500;
    background: #eef2f6;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    white-space: nowrap; /* 防止换行 */
}


.date-display i {
    margin-right: 8px;
    color: #3498db;
}

/* 用户信息按钮样式 */
.user-profile .btn {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.user-profile .btn:hover {
    background: rgba(52, 152, 219, 0.3);
}
/* 修改 user-date-row 为一行布局 */
.user-date-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap; /* 确保不换行 */
}

/* 調整響應式佈局 */
@media (max-width: 768px) {
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
}

        /* Site Diary 页面特定样式 */
        .site-diary-page {
            background: white;
            border-radius: 12px;
            width: 100%;
            padding: 30px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            margin-bottom: 30px;
        }

        .site-diary-page h2 {
            color: #2c3e50;
            margin-bottom: 25px;
            font-size: 1.8rem;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .site-diary-page h2 i {
            color: #083350;
        }

        /* 统计卡片样式 - 修改为更显眼 */
        .diary-stats {
        display: flex;
        gap: 15px;
        margin-bottom: 30px;
        flex-wrap: wrap;
    }

    .diary-controls-row {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 24px;
    }
    
    .diary-stats {
        min-width: 160px;
    }
    
    .filters-section {
        display: flex;
        gap: 24px;
    }
    
    .filter-group {
        min-width: 140px;
    }

    .stat-card {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
        padding: 12px 10px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
        min-width: 120px;
        width: 140px;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 15px rgba(52, 152, 219, 0.35);
    }

    .stat-card .label {
        font-size: 0.9rem;
        opacity: 0.9;
        margin-right: 10px;
    }

    .stat-card .value {
        font-size: 1.8rem;
        font-weight: 700;
    }

        /* 筛选器区域 */
        .filters-section {
            padding: 5px 20px;
            background: #f8f9fa;
            border-radius: 12px;
            margin-bottom: 10px;
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
        }
        
        .filter-group {
            position: relative;
        }
        
        .filter-toggle {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            background: white;
            border: 1px solid #dce1e6;
            border-radius: 8px;
            cursor: pointer;
            min-width: 140px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            font-weight: 500;
            transition: all 0.3s ease;
        }
        
        .filter-toggle:hover {
            border-color: #a0b4c0;
        }
        
        .filter-toggle i {
            margin-left: auto;
            transition: transform 0.3s ease;
        }
        
        .filter-options {
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            background: white;
            border: 1px solid #dce1e6;
            border-radius: 8px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            margin-top: 5px;
            z-index: 10;
            display: none;
            max-height: 300px;
            overflow-y: auto;
        }

        .filter-options.open {
            display: block;
        }
        
        .filter-option {
            padding: 12px 20px;
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .filter-option:hover {
            background: #f0f7ff;
        }
        
        .filter-option.active {
            background: #e6f2ff;
            color: #0066cc;
            font-weight: 500;
        }
        
        /* 表格区域 */
        .content-section {
            background: rgb(255, 255, 255);
            border-radius: 12px;
            padding: 40px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            max-width: 1200px;      /* 讓內容區域更寬 */
            margin: 0 auto;         /* 水平居中 */
        }
        
        .table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eaeaea;
        }
        
        .table-title {
            font-size: 1.5rem;
            color: #2c3e50;
            font-weight: 600;
        }
        
        .table-container {
            overflow-x: auto;
            border-radius: 8px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
        }

        /* 表格样式 */
        .diary-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            background: white;
        }

        .diary-table th {
            background: #f8f9fa;
            padding: 16px 20px;
            text-align: left;
            font-weight: 600;
            color: #2c3e50;
            border-bottom: 2px solid #eaeaea;
        }

        .diary-table td {
            padding: 18px 20px;
            border-bottom: 1px solid #eaeaea;
            color: #555;
            transition: background 0.2s ease;
        }

        .diary-table tr:hover td {
            background: #f9fbfd;
        }

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

        /* 状态标签样式 */
        .status-badge {
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
            display: inline-block;
            text-align: center;
            min-width: 120px;
        }

        .status-draft {
            background: rgba(149, 165, 166, 0.2);
            color: #848f90;
        }

        .status-submitted-wsg {
            background: rgba(52, 152, 219, 0.2);
            color: #2980b9;
        }

        .status-submitted-ig {
            background: rgba(155, 89, 182, 0.2);
            color: #8e44ad;
        }

        .status-closed {
            background: rgba(46, 204, 113, 0.2);
            color: #27ae60;
        }

        .status-reopen {
            background: rgba(243, 156, 18, 0.2);
            color: #d35400;
        }

        .status-cancelled {
            background: rgba(231, 76, 60, 0.2);
            color: #c0392b;
        }

        /* 操作按钮样式 - 更大更美观 */
        .action-buttons {
            display: flex;
            gap: 10px;
        }

        .action-btn {
            padding: 10px 16px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            min-width: 44px;
            min-height: 44px;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
        }

        .view-btn {
            background: linear-gradient(135deg, #3498db, #2980b9);
            color: white;
        }

        .view-btn:hover {
            background: linear-gradient(135deg, #2980b9, #2471a3);
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(52, 152, 219, 0.3);
        }

        .edit-btn {
            background: linear-gradient(135deg, #2ecc71, #27ae60);
            color: white;
        }

        .edit-btn:hover {
            background: linear-gradient(135deg, #27ae60, #219653);
            transform: translateY(-2px);
            box-shadow: 0 5px 12px rgba(46, 204, 113, 0.3);
        }

        .action-btn i {
            margin-right: 6px;
            font-size: 1.1rem;
        }

        /* 无结果消息 */
        .no-results {
            text-align: center;
            padding: 40px;
            color: #7f8c8d;
            font-style: italic;
            background: #f9f9f9;
            border-radius: 8px;
            margin: 20px 0;
        }

        /* 页脚样式 */
        footer {
            text-align: center;
            padding: 30px 0 20px;
            color: #7f8c8d;
            margin-top: 40px;
            border-top: 1px solid #e0e6ed;
        }

        /* 响应式设计 */
        @media (max-width: 900px) {
            .sidebar {
                width: 260px;
            }
            
            .sidebar:not(.collapsed) {
                width: 260px;
                position: absolute;
                height: 100%;
                z-index: 1000;
            }
            
            .logo h2, .menu-text {
                opacity: 0;
                width: 0;
                overflow: hidden;
            }
            
            .sidebar:not(.collapsed) .logo h2,
            .sidebar:not(.collapsed) .menu-text {
                opacity: 1;
                width: auto;
            }

            .diary-stats {
                flex-direction: column;
            }

            .stat-card {
                width: 100%;
            }
        }

        @media (max-width: 768px) {
            .header {
                flex-direction: column;
                align-items: flex-end;
                gap: 20px;
            }

            .search-buttons {
                flex-direction: column;
                align-items: stretch;
            }
            
            #search-form {
                margin-right: 0;
                margin-bottom: 15px;
            }
            
            .nav-buttons {
                width: 100%;
                justify-content: center;
            }
            
            .nav-buttons button {
                padding: 8px 12px;
                font-size: 0.9rem;
            }

            .filters-section {
                flex-direction: column;
            }

            .filter-group {
                width: 100%;
            }

            .filter-toggle {
                width: 100%;
            }

            .action-buttons {
                flex-direction: column;
            }

            .action-btn {
                width: 100%;
                margin-bottom: 5px;
            }
        }

        @media (max-width: 600px) {
            .main-content {
                padding: 15px;
            }

            .site-diary-page {
                padding: 20px;
            }

            .diary-table {
                font-size: 0.9rem;
            }

            .diary-table th,
            .diary-table td {
                padding: 12px 15px;
            }
        }

/* indexdocument.css 特定样式 */
/* 主内容区域 */
        .main-content {
        flex: 1;
        max-width: 1500px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        padding: 30px;
        transition: all 0.3s ease;
        }

        .sidebar.collapsed + .main-content {
            margin-left: 0;
        }

        /* 头部样式 */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid #e0e6ed;
        }

        .header h1 {
            color: #2c3e50;
            font-size: 2rem;
        }

        .search-buttons {
            display: flex;
            align-items: center;
            margin-bottom: 24px;
            flex-wrap: wrap;
            gap: 15px;
        }

        #search-form {
            display: flex;
            flex: 1;
            max-width: 500px;
            min-width: 250px;
            margin-right: 24px;
        }

        #search-form input {
            flex: 1;
            padding: 12px 18px;
            font-size: 1rem;
            border: 1px solid #ddd;
            border-radius: 8px 0 0 8px;
            outline: none;
            transition: border 0.3s ease;
        }

        #search-form input:focus {
            border-color: #3498db;
            box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
        }

        #search-form button {
            padding: 12px 20px;
            font-size: 1rem;
            cursor: pointer;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 0 8px 8px 0;
            transition: background 0.3s ease;
        }

        #search-form button:hover {
            background: #2980b9;
        }

        .header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 24px;
}

.header-controls {
    margin-top: 8px;
    width: 100%;
}

.user-date-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap; /* 防止换行 */
    min-width: 140px; /* 最小宽度 */
}
.user-btn:hover {
    background: #1746a2;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    color: #2563eb;
    font-weight: 500;
}

        /* 内容区域 */
        /* Center dashboard content */
   /* 确保dashboard居中 */
.dashboard {
    max-width: 1500px;
    margin: 0 auto 30px auto; /* 这会使dashboard水平居中 */
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

        .dashboard h2 {
            color: #2c3e50;
            margin-bottom: 20px;
            font-size: 1.8rem;
        }

        .dashboard p {
            line-height: 1.8;
            color: #555;
            margin-bottom: 25px;
            font-size: 1.1rem;
        }

        /* 主要修改：并排卡片布局 */
        .feature-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
            gap: 30px;
            margin-top: 30px;
        }

        .feature-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            padding: 25px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }

        .feature-card .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eee;
            background: none;
            color: #2c3e50;
            padding: 0 0 15px 0;
        }

        .feature-card .card-title {
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .feature-card .card-icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            background: rgba(52, 152, 219, 0.1);
            color: #3498db;
        }

        .feature-card .card-badge {
            background: rgba(231, 76, 60, 0.1);
            color: #e74c3c;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 500;
        }

        .feature-card.site-diary .card-icon {
            background: rgba(46, 204, 113, 0.1);
            color: #27ae60;
        }

        .feature-card.safety-inspection .card-icon {
            background: rgba(231, 76, 60, 0.1);
            color: #e74c3c;
        }

        .feature-card.labour-wage .card-icon {
            background: rgba(155, 89, 182, 0.1);
            color: #9b59b6;
        }

        .kpi-data-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        .kpi-row {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px solid #f8f9fa;
        }

        .kpi-label {
            font-weight: 500;
            color: #7f8c8d;
            font-size: 0.95rem;
        }

        .kpi-value {
            font-weight: 600;
            color: #2c3e50;
            font-size: 1rem;
        }

        .progress-section {
            margin: 15px 0;
            padding: 0 20px;
        }

        .progress-container {
            height: 10px;
            background: #f0f0f0;
            border-radius: 5px;
            overflow: hidden;
            margin-bottom: 5px;
        }

        .progress-bar {
            height: 100%;
            border-radius: 10px;
            transition: width 0.5s ease;
        }

        .site-diary .progress-bar {
            background: linear-gradient(90deg, #3498db, #2ecc71);
        }
        
        .safety-inspection .progress-bar {
            background: linear-gradient(90deg, #e74c3c, #f39c12);
        }
        
        .labour-wage .progress-bar {
            background: linear-gradient(90deg, #9b59b6, #8e44ad);
        }

        .progress-labels {
            display: flex;
            justify-content: space-between;
            margin-top: 8px;
            font-size: 0.85rem;
            color: #7f8c8d;
        }

        /* 趨勢圖容器樣式 */
        .trend-charts {
            display: grid;
            grid-template-columns: 1fr;
            gap: 30px;
            margin-top: 40px;
        }

        .trend-card {
            background: white;
            border-radius: 12px;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
        }

        .trend-card canvas {
            max-height: 300px;
            min-height: 250px;
            width: 100% !important;
        }
        
        .chart-header {
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eee;
        }

        .chart-header h3 {
            font-size: 1.3rem;
            color: #2c3e50;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .chart-header i {
            color: #3498db;
        }

        /* 页脚样式 */
        footer {
            text-align: center;
            padding: 30px 0 20px;
            color: #7f8c8d;
            margin-top: 40px;
            border-top: 1px solid #e0e6ed;
        }

        /* 响应式设计 */
        @media (min-width: 1200px) {
            .trend-charts {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (max-width: 900px) {
            .sidebar {
                width: 260px;
            }
            
            .sidebar:not(.collapsed) {
                width: 260px;
                position: absolute;
                height: 100%;
                z-index: 1000;
            }
            
            .logo h2, .menu-text {
                opacity: 0;
                width: 0;
                overflow: hidden;
            }
            
            .sidebar:not(.collapsed) .logo h2,
            .sidebar:not(.collapsed) .menu-text {
                opacity: 1;
                width: auto;
            }
            
            .feature-cards {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            .header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }

            .search-buttons {
                flex-direction: column;
                align-items: stretch;
            }
            
            #search-form {
                margin-right: 0;
                margin-bottom: 15px;
            }
            
            .user-profile {
                flex-direction: column;
                align-items: flex-end;
                gap: 10px;
            }
            
            .date-display {
                padding: 6px 12px;
                font-size: 14px;
            }
        }

        @media (max-width: 600px) {
            .main-content {
                padding: 15px;
            }
            
            .dashboard {
                padding: 20px;
            }
            
            .feature-card {
                padding: 20px;
            }
            
            .kpi-data-grid {
                grid-template-columns: 1fr;
            }
        }

/* sitediarydocument.css 特定样式 */ 
.document-actions {
    margin-top: 24px; /* 你可以調整這個數值，讓按鈕區域更下方 */
    display: flex;
    align-items: center;
    gap: 16px;
}
.document-actions .btn i {
    margin-right: 6px;
    font-size: 1.1rem;
}
.document-meta {
    background: #eec3c3;
    border-radius: 12px;
    padding: 24px 32px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(52,152,219,0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
}

.meta-item {
    min-width: 180px;
    margin-bottom: 8px;
}

.meta-label {
    font-weight: 600;
    color: #5280e4;
    margin-right: 8px;
    font-size: 1rem;
}

.meta-value {
    color: #333;
    font-size: 1.05rem;
    font-weight: 500;
    background: #f5ec8b;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(52,152,219,0.05);
}
/* 美化文檔操作按鈕 */
.document-actions .btn {
    background: linear-gradient(90deg, #698ddc 60%, #014f7e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: 600;
    margin-right: 16px;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.document-actions .btn:last-child {
    margin-right: 0;
}
.document-actions .btn:hover {
    background: linear-gradient(90deg, #1746a2 60%, #2563eb 100%);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 4px 16px rgba(37,99,235,0.15);
}

/* bottom */
.main-content {
    flex: 1;
}

footer {
    text-align: center;
    padding: 30px 0 20px;
    color: #7f8c8d;
    margin-top: 40px;
    border-top: 1px solid #e0e6ed;
    width: 100%;
    background: transparent;
}

/* add new diary */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px 24px;
    min-width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-content h3 { margin-bottom: 18px; }
.modal-content label { display:block; margin-top:12px; font-weight:500;}
.modal-content input, .modal-content select {
    width: 100%; margin-top:4px; padding:8px; border-radius:6px; border:1px solid #e0e6ed;
}
.modal-actions { margin-top:18px; display:flex; gap:12px; justify-content:flex-end;}

/* delete button */
.delete-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
}
.delete-btn:hover {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(231,76,60,0.3);
}

/* sitelocation */
 /* 站点地图页面特定样式 */
        .site-locations-page {
            background: white;
            border-radius: 12px;
            width: 100%;
            padding: 30px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            margin-bottom: 30px;
        }
        
        .site-locations-page h2 {
            color: #2c3e50;
            margin-bottom: 25px;
            font-size: 1.8rem;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .map-container {
            margin-bottom: 30px;
        }
        
        #site-map {
            height: 500px;
            width: 100%;
            border-radius: 12px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        }
        
        .site-list-container {
            background: #f8f9fa;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
        }
        
        .site-list-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .site-list-header h2 {
            margin: 0;
            font-size: 1.5rem;
            color: #2c3e50;
        }
        
        .search-box {
            display: flex;
            align-items: center;
            background: white;
            border-radius: 8px;
            padding: 8px 15px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }
        
        .search-box input {
            border: none;
            outline: none;
            padding: 5px;
            font-size: 1rem;
            width: 200px;
        }
        
        .search-box button {
            background: none;
            border: none;
            cursor: pointer;
            color: #3498db;
        }
        
        .site-list {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .site-item {
            display: flex;
            align-items: center;
            background: white;
            padding: 15px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }
        
        .site-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .site-item.active {
            background: #e6f2ff;
            border-left: 4px solid #3498db;
        }
        
        .site-icon {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            background: rgba(52, 152, 219, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
            color: #3498db;
            font-size: 1.2rem;
        }
        
        .site-info h3 {
            margin: 0 0 5px 0;
            color: #2c3e50;
            font-size: 1.1rem;
        }
        
        .site-info p {
            margin: 0;
            color: #7f8c8d;
            font-size: 0.9rem;
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .site-list-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }
            
            .search-box {
                width: 100%;
            }
            
            .search-box input {
                width: 100%;
            }
        }

/* 改进深色主题的文字颜色 */
body.dark-theme {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* 深色主题增强样式 */
body.dark-theme {
    background-color: #121212 !important;
    color: #ffffff !important;
}

/* 卡片和内容区域 */
body.dark-theme .dashboard,
body.dark-theme .feature-card,
body.dark-theme .trend-card,
body.dark-theme .site-diary-page,
body.dark-theme .site-locations-page,
body.dark-theme .content-section {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
}

/* 表格样式 */
body.dark-theme .diary-table,
body.dark-theme .diary-table th,
body.dark-theme .diary-table td {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
    border-color: #333 !important;
}

body.dark-theme .diary-table th {
    background-color: #2d2d2d !important;
}

body.dark-theme .diary-table tr:hover td {
    background-color: #2d2d2d !important;
}

/* 筛选器和表单 */
body.dark-theme .filters-section,
body.dark-theme .filter-toggle,
body.dark-theme .filter-options {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

body.dark-theme .filter-option:hover {
    background-color: #3d3d3d !important;
}

body.dark-theme .filter-option.active {
    background-color: #3498db !important;
    color: white !important;
}

/* 搜索框和输入框 */
body.dark-theme #search-form input,
body.dark-theme .form-control,
body.dark-theme .search-box input {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

body.dark-theme #search-form input::placeholder {
    color: #888 !important;
}

/* 模态框 */
body.dark-theme .modal-content {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
}

body.dark-theme .modal-content input,
body.dark-theme .modal-content select {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

/* 统计卡片 */
body.dark-theme .stat-card {
    background: linear-gradient(135deg, #2c3e50, #34495e) !important;
    color: white !important;
}

/* 文件列表和上传区域 */
body.dark-theme .file-list,
body.dark-theme .upload-area {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
    color: #ffffff !important;
}

body.dark-theme .file-item {
    border-bottom-color: #444 !important;
}

/* 按钮样式 */
body.dark-theme .btn-secondary {
    background: #555 !important;
    color: white !important;
}

body.dark-theme .btn-outline {
    background: transparent !important;
    border-color: #3498db !important;
    color: #3498db !important;
}

body.dark-theme .btn-outline:hover {
    background: #3498db !important;
    color: white !important;
}

/* 设置页面特定样式 */
body.dark-theme .settings-form .form-group label {
    color: #ffffff !important;
}

body.dark-theme .checkbox-group label,
body.dark-theme .radio-group label {
    color: #ffffff !important;
}

/* 进度条 */
body.dark-theme .progress-container {
    background-color: #2d2d2d !important;
}

/* 页脚 */
body.dark-theme footer {
    border-top-color: #333 !important;
    color: #aaa !important;
}

/* 文档元数据 */
body.dark-theme .document-meta {
    background-color: #2d2d2d !important;
}

body.dark-theme .meta-value {
    background-color: #3d3d3d !important;
    color: #ffffff !important;
}

/* 站点列表 */
body.dark-theme .site-list-container {
    background-color: #1e1e1e !important;
}

body.dark-theme .site-item {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
}

body.dark-theme .site-item.active {
    background-color: #3498db !important;
    color: white !important;
}

body.dark-theme .site-info p {
    color: #bbb !important;
}

/* 无结果消息 */
body.dark-theme .no-results {
    background-color: #2d2d2d !important;
    color: #aaa !important;
}

/* 状态标签在深色主题下的调整 */
body.dark-theme .status-badge {
    color: white !important;
}

body.dark-theme .status-draft {
    background: rgba(149, 165, 166, 0.4) !important;
}

body.dark-theme .status-submitted-wsg {
    background: rgba(52, 152, 219, 0.4) !important;
}

body.dark-theme .status-submitted-ig {
    background: rgba(155, 89, 182, 0.4) !important;
}

body.dark-theme .status-closed {
    background: rgba(46, 204, 113, 0.4) !important;
}

body.dark-theme .status-reopen {
    background: rgba(243, 156, 18, 0.4) !important;
}

body.dark-theme .status-cancelled {
    background: rgba(231, 76, 60, 0.4) !important;
}

body.dark-theme .dashboard h2,
body.dark-theme .feature-card .card-title,
body.dark-theme .diary-table th,
body.dark-theme .diary-table td {
    color: #ffffff !important;
}

body.dark-theme .status-badge {
    color: #ffffff !important;
    font-weight: 600; /* 增加字重 */
}

body.dark-theme #search-form input,
body.dark-theme .search-box input {
    color: #ffffff !important;
    background-color: #2d2d2d !important;
}

body.dark-theme .kpi-label,
body.dark-theme .meta-label {
    color: #ffffff !important; /* 次重要文字用淺灰色 */
}

/* 基礎文字顏色強化 */
body.dark-theme {
    color: #ffffff !important;
}

/* 主標題和內容文字 */
body.dark-theme .header h1,
body.dark-theme .dashboard h2,
body.dark-theme .site-diary-page h2,
body.dark-theme .site-locations-page h2,
body.dark-theme .table-title,
body.dark-theme .chart-header h3,
body.dark-theme .card-title,
body.dark-theme .dashboard p {
    color: #ffffff !important;
}

/* KPI數據和標籤 */
body.dark-theme .kpi-label,
body.dark-theme .kpi-value,
body.dark-theme .stat-card .label,
body.dark-theme .stat-card .value,
body.dark-theme .progress-labels {
    color: #ffffff !important;
}

/* 表格相關文字 */
body.dark-theme .diary-table th,
body.dark-theme .diary-table td,
body.dark-theme .filter-toggle,
body.dark-theme .filter-option {
    color: #ffffff !important;
}

/* 元數據文字 */
body.dark-theme .meta-label,
body.dark-theme .meta-value,
body.dark-theme .document-meta {
    color: #ffffff !important;
}

/* 狀態標籤增強對比度 */
body.dark-theme .status-badge {
    color: #ffffff !important;
    font-weight: 600;
}

/* 站點列表文字 */
body.dark-theme .site-info h3,
body.dark-theme .site-info p {
    color: #ffffff !important;
}

/* 無結果提示 */
body.dark-theme .no-results {
    color: #ffffff !important;
    background-color: #2d2d2d !important;
}

/* 日期顯示 */
body.dark-theme .date-display {
    color: #ffffff !important;
    background-color: #2d2d2d !important;
}

/* 用戶按鈕 */
body.dark-theme .user-profile .btn,
body.dark-theme .user-btn {
    color: #ffffff !important;
}

/* 頁腳文字 */
body.dark-theme footer {
    color: #bbbbbb !important;
}

/* 進度條標籤 */
body.dark-theme .progress-labels {
    color: #bbbbbb !important;
}

/* 次要文字 (降低重要性) */
body.dark-theme .kpi-label,
body.dark-theme .meta-label,
body.dark-theme .progress-labels {
    color: #bbbbbb !important;
}

/* 下拉選項懸停狀態 */
body.dark-theme .filter-option:hover {
    background-color: #3d3d3d !important;
    color: #ffffff !important;
}

/* 暗黑主题下的 #docTitle */
body.dark-theme #docTitle,
.dark-theme #docTitle {
    color: #ffffff !important;
}

/* 或者更具体的选择器 */
body.dark-theme .document-header h2 #docTitle {
    color: #ffffff;
}

/* 添加到 main.css 末尾 */

/* 用户管理页面特定样式 */
.user-management-page {
    background: white;
    border-radius: 12px;
    width: 100%;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.user-management-page h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-management-page h2 i {
    color: #3498db;
}

/* 用户统计卡片 */
.user-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.user-stats .stat-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
    min-width: 180px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-stats .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.35);
}

.user-stats .stat-card .label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.user-stats .stat-card .value {
    font-size: 2.2rem;
    font-weight: 700;
}

/* 用户信息样式 */
.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.user-department {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* 角色标签样式 */
.role-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    min-width: 90px;
}

.role-admin {
    background: rgba(155, 89, 182, 0.2);
    color: #8e44ad;
}

.role-officer {
    background: rgba(52, 152, 219, 0.2);
    color: #2980b9;
}

.role-aei {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.role-inspector {
    background: rgba(243, 156, 18, 0.2);
    color: #d35400;
}

.role-contractor {
    background: rgba(149, 165, 166, 0.2);
    color: #7f8c8d;
}

/* 用户状态标签样式 */
.status-active {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.status-inactive {
    background: rgba(149, 165, 166, 0.2);
    color: #7f8c8d;
}

.status-pending {
    background: rgba(243, 156, 18, 0.2);
    color: #d35400;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.pagination-info {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

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

.page-numbers {
    display: flex;
    gap: 8px;
}

.page-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-number:hover:not(.active) {
    background: #f0f7ff;
    color: #3498db;
}

.page-number.active {
    background: #3498db;
    color: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 暗黑主题下的用户管理样式 */
body.dark-theme .user-management-page {
    background-color: #1e1e1e !important;
    color: #ffffff !important;
}

body.dark-theme .user-name {
    color: #ffffff !important;
}

body.dark-theme .user-department {
    color: #bbbbbb !important;
}

body.dark-theme .role-badge,
body.dark-theme .status-badge {
    color: #ffffff !important;
    font-weight: 600;
}

body.dark-theme .pagination {
    border-top-color: #333 !important;
}

body.dark-theme .pagination-info {
    color: #bbbbbb !important;
}

body.dark-theme .pagination-btn {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
    color: #ffffff !important;
}

body.dark-theme .page-number {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
}

body.dark-theme .page-number.active {
    background-color: #3498db !important;
    color: white !important;
}

body.dark-theme .form-group label {
    color: #ffffff !important;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
    color: #ffffff !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-stats {
        flex-direction: column;
    }
    
    .user-stats .stat-card {
        width: 100%;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .user-management-page {
        padding: 20px;
    }
}

/* 修复筛选器问题 */
.filter-options {
    display: none;
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.filter-options.open,
.filter-options.show {
    display: block !important;
}

.filter-group {
    position: relative;
}

.filter-toggle {
    cursor: pointer;
}

/* 新状态样式 */
.status-online {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-offline {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== 需要添加的样式 ===== */

/* 修复筛选器显示问题 */
.filter-options.open,
.filter-options.show {
    display: block !important;
}

/* 新的状态标签样式 */
.status-online {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-offline {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 修复footer布局 - 将footer移到main-content外部 */
body {
    display: flex;
    flex-direction: column; /* 改为垂直布局 */
    min-height: 100vh;
}

.main-content {
    flex: 1; /* 让主内容区域占据剩余空间 */
    margin-left: 260px; /* 为侧边栏留出空间 */
    padding: 30px;
}

.sidebar.collapsed + .main-content {
    margin-left: 70px; /* 侧边栏收起时的宽度 */
}

/* 确保footer在页面底部 */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    background: transparent;
    width: 100%;
    margin-top: auto; /* 确保在底部 */
}

/* 緊急修復 - 添加在 main.css 末尾 */
body {
    display: flex !important;
}

.sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh !important;
}

.main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
    margin-right: 0 !important;
}

.sidebar.collapsed + .main-content {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

@media (max-width: 900px) {
    .sidebar:not(.collapsed) {
        width: 260px !important;
        position: fixed !important;
        z-index: 1000 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* 在 main.css 末尾添加，用於覆蓋通用樣式 */
.user-management-page .content-section {
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

/* 在 main.css 末尾添加 */
.user-management-page .table-container {
    overflow-x: auto;
    width: 100%;
}

.user-management-page .diary-table {
    min-width: 1000px; /* 確保表格足夠寬 */
}

/* 修正表頭寬度 */
.user-management-page .diary-table th:nth-child(1) { width: 5%; }
.user-management-page .diary-table th:nth-child(2) { width: 30%; }
.user-management-page .diary-table th:nth-child(3) { width: 25%; }
.user-management-page .diary-table th:nth-child(4) { width: 15%; }
.user-management-page .diary-table th:nth-child(5) { width: 15%; }
.user-management-page .diary-table th:nth-child(6) { width: 10%; }

/* 添加到你的main.css文件中 */

/* 侧边栏子菜单样式 */
.menu-item-with-submenu {
    position: relative;
}

.menu-item-with-submenu > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.menu-item-with-submenu.active .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 1.5rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.menu-item-with-submenu.active .submenu {
    max-height: 500px;
}

.submenu li {
    margin: 0.3rem 0;
}

.submenu a {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: #666;
}

.submenu a:hover {
    background-color: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.submenu a.active {
    background-color: rgba(52, 152, 219, 0.15);
    color: #3498db;
    font-weight: 600;
}

/* 侧边栏折叠时的子菜单样式 */
.sidebar.collapsed .menu-item-with-submenu > a .submenu-arrow {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none;
}
/* 修复操作按钮样式 */
.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    margin-right: 5px;
}

.edit-user-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.delete-user-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.edit-user-btn:hover {
    background: linear-gradient(135deg, #2980b9, #2471a3);
}

.delete-user-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

/* 模态框按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn[type="submit"] {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.btn[type="submit"]:hover {
    background: linear-gradient(135deg, #27ae60, #219653);
}

/* 方案1：为这两个页面添加特定类选择器 */
body.site-inspection .main-content,
body.site-diary .main-content,
.site-inspection-page .main-content,
.site-diary-page .main-content {
    transition: margin-left 0.3s ease, width 0.3s ease !important;
}

body.site-inspection .sidebar.collapsed ~ .main-content,
body.site-inspection .sidebar.collapsed + .main-content,
body.site-diary .sidebar.collapsed ~ .main-content,
body.site-diary .sidebar.collapsed + .main-content,
.site-inspection-page .sidebar.collapsed ~ .main-content,
.site-inspection-page .sidebar.collapsed + .main-content,
.site-diary-page .sidebar.collapsed ~ .main-content,
.site-diary-page .sidebar.collapsed + .main-content {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

body.site-inspection .sidebar:not(.collapsed) ~ .main-content,
body.site-inspection .sidebar:not(.collapsed) + .main-content,
body.site-diary .sidebar:not(.collapsed) ~ .main-content,
body.site-diary .sidebar:not(.collapsed) + .main-content,
.site-inspection-page .sidebar:not(.collapsed) ~ .main-content,
.site-inspection-page .sidebar:not(.collapsed) + .main-content,
.site-diary-page .sidebar:not(.collapsed) ~ .main-content,
.site-diary-page .sidebar:not(.collapsed) + .main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
}

/* ===== 紧急修复：侧边栏和主内容布局问题 ===== */

/* 确保body使用正确的flex布局 */
body {
    display: flex;
    flex-direction: row; /* 改为水平布局 */
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 侧边栏固定定位 */
.sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh !important;
    z-index: 1000;
}

/* 主内容区域 - 关键修复 */
.main-content {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
    padding: 30px;
    min-height: 100vh;
    background-color: #f5f7fa;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

/* 侧边栏折叠时 */
.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

/* 确保内容区域足够宽 */
.site-diary-page,
.safety-inspect-page,
.labour-wage-page,
.site-locations-page {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}

/* 表格容器宽度修复 */
.table-container {
    width: 100% !important;
    overflow-x: auto;
}

/* 确保表格也占满宽度 */
.diary-table,
.safety-table,
.wage-table,
.location-table {
    width: 100% !important;
    min-width: 1000px; /* 确保表格有最小宽度 */
}

/* ===== 针对Site Diary和Site Location的特殊修复 ===== */

/* 为这两个页面添加特定的修复 */
.site-diary-page,
.site-locations-page {
    background: white;
    border-radius: 12px;
    width: 100% !important;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    box-sizing: border-box;
}

/* 确保页面内的表格容器也占满宽度 */
.site-diary-page .table-container,
.site-locations-page .table-container {
    width: 100% !important;
    box-sizing: border-box;
}

/* ===== 响应式设计修复 ===== */

@media (max-width: 900px) {
    .sidebar:not(.collapsed) {
        width: 260px !important;
        position: fixed !important;
        z-index: 1000 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 20px !important;
    }
    
    .sidebar.collapsed ~ .main-content,
    .sidebar.collapsed + .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px !important;
    }
    
    .site-diary-page,
    .site-locations-page {
        padding: 20px !important;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== 添加footer固定位置修复 ===== */

footer {
    margin-top: auto !important;
    position: relative;
    bottom: 0;
    width: 100%;
    background: transparent;
}

/* ===== 确保所有页面内容都可以扩展 ===== */

/* 移除所有可能限制宽度的最大宽度设置 */
.content-section {
    max-width: none !important;
    width: 100% !important;
}

/* 移除dashboard的最大宽度限制 */
.dashboard {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}

/* 确保卡片布局适应新宽度 */
.feature-cards {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
}

/* ===== 修复暗黑主题下的布局问题 ===== */

body.dark-theme .main-content {
    background-color: #121212 !important;
}

body.dark-theme .site-diary-page,
body.dark-theme .site-locations-page,
body.dark-theme .content-section {
    background-color: #1e1e1e !important;
}

/* ===== JavaScript辅助类 ===== */

/* 用于动态添加的类 */
.main-content-expanded {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
}

.main-content-collapsed {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

/* === 侧边栏按钮旋转修复 === */

/* 确保按钮旋转生效 */
.toggle-btn {
    transition: transform 0.3s ease !important;
}

/* 确保旋转效果不被覆盖 */
.sidebar.collapsed .toggle-btn,
.sidebar.collapsed .toggle-btn i {
    transform: rotate(180deg) !important;
}

/* 或者直接旋转图标而不是按钮 */
.sidebar:not(.collapsed) .toggle-btn i {
    transform: rotate(0deg) !important;
}

.sidebar.collapsed .toggle-btn i {
    transform: rotate(180deg) !important;
}

.filter-options {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-top: 6px;
  min-width: 200px;
  z-index: 999;
}

.filter-options.open {
  display: block;
}

.filter-group {
  position: relative;
}

/* === FORCE NO CONTENT SHIFT WHEN SIDEBAR TOGGLES === */
.main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

.sidebar.collapsed + .main-content,
.sidebar + .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* ===== FIX: Sidebar overlay content issue ===== */

/* Sidebar sizes */
.sidebar {
    width: 260px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 70px;
}

/* Main content always full width, but padded */
.main-content {
    margin-left: 0 !important;
    padding-left: 260px;   /* 預留 sidebar 空間 */
    width: 100% !important;
    transition: padding-left 0.3s ease;
    box-sizing: border-box;
}

/* Sidebar collapsed → reduce padding */
.sidebar.collapsed ~ .main-content {
    padding-left: 70px;
}

/* Mobile */
@media (max-width: 768px) {
    .main-content {
        padding-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

/* === BUGFIX #1: Prevent sitediary page shift === */

/* main-content 永遠不被 sidebar 推移 */
.main-content {
    margin-left: 0 !important;
    transform: none !important;
}

/* 明確禁止 sidebar 影響 main-content 位移 */
.sidebar + .main-content,
.sidebar ~ .main-content,
.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content {
    margin-left: 0 !important;
    transform: none !important;
}

/* 侧边栏底部退出按钮样式 */
.sidebar-footer {
    margin-top: auto;
    padding: 20px 15px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(231, 76, 60, 0.2);
    color: #ecf0f1;
    border: none;
    border-radius: 8px;
    padding: 14px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    gap: 12px;
}

.logout-btn i {
    width: 24px;
    text-align: center;
    font-size: 1.2rem;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.4);
    color: #fff;
}

.sidebar.collapsed .logout-btn .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .logout-btn {
    justify-content: center;
    padding: 14px 0;
}

.sidebar.collapsed .logout-btn i {
    margin-right: 0;
}