* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:Arial, sans-serif; }
.top-nav { background:#007bff; color:white; padding:10px 20px; position:fixed; top:0; left:0; right:0; z-index:1000; }
.top-nav h2 { display:inline-block; margin:0; }
.top-nav .user-info { float:right; }
.top-nav a { color:white; text-decoration:none; margin-left:15px; }
.side-nav { position:fixed; top:60px; left:0; bottom:0; width:200px; background:#f8f9fa; padding:15px; border-right:1px solid #dee2e6; }
.side-nav h4 { margin-bottom:15px; }
.side-nav ul { list-style:none; padding:0; }
.side-nav li { margin:8px 0; }
.side-nav a { text-decoration:none; color:#495057; padding:5px 8px; display:block; border-radius:4px; }
.side-nav a:hover { background:#e9ecef; color:#007bff; }
.main-content { margin-top:60px; margin-left:200px; padding:20px; min-height:calc(100vh - 60px); }
table { width:100%; border-collapse:collapse; margin:10px 0; }
table th, table td { border:1px solid #dee2e6; padding:8px 12px; text-align:left; }
table th { background:#f8f9fa; }
.btn { padding:8px 16px; border:none; border-radius:4px; cursor:pointer; text-decoration:none; display:inline-block; font-family:inherit; font-size:14px; line-height:1.4; box-sizing:border-box; vertical-align:middle; }
.btn-primary { background:#007bff; color:white; }
.btn-success { background:#28a745; color:white; }
.btn-danger { background:#dc3545; color:white; }
.btn-secondary { background:#6c757d; color:white; }
.btn-sm { padding:5px 10px; font-size:0.875em; }
.form-group { margin:10px 0; }
.form-control { width:100%; padding:8px; border:1px solid #ced4da; border-radius:4px; }
.card { border:1px solid #dee2e6; border-radius:5px; padding:15px; margin:10px 0; }
/* 通用弹窗
   ★ z-index 必须高于顶部导航：本文件末尾把 .global-top-nav 钉到 z-index:9999!important，
     弹窗原来只有 1001，会被导航条压住（/task_file「单价」弹窗顶部标题+关闭按钮被遮）。
   ★ top 用 calc 把导航高度的一半补回来：否则垂直居中时弹窗顶边贴到 y≈0，
     正好落在 58px 高的导航条底下。 */
.modal { display:none; position:fixed; top:calc(50% + var(--nav-h, 58px) / 2); left:50%; transform:translate(-50%,-50%); background:white; padding:20px; border-radius:5px; box-shadow:0 0 15px rgba(0,0,0,0.2); z-index:10000; width:90%; max-width:800px; }
@media print {
    .top-nav, .side-nav { display:none; }
    .main-content { margin:0; padding:20px; }
    button, .print-hide { display:none; }
    a { text-decoration:none; color:#000; }
}
/* ==================== 全局顶部导航栏样式 ==================== */
.global-top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 0 20px;
    position: fixed; /* 改为固定定位，始终在顶部 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #eaeaea;
    height: 60px;
    box-sizing: border-box;
}

.nav-brand h2 {
    margin: 0;
    color: #007bff;
    font-size: 1.4rem;
    white-space: nowrap;
}

/* 导航菜单容器 */
.nav-menu-container {
    display: flex;
    flex: 1; /* 占据中间空间 */
    justify-content: center;
    margin: 0 20px;
}

/* 导航菜单列表 */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px; /* 菜单项之间的间距 */
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.95rem;
}

.nav-menu a:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

/* 当前活动页面高亮 (可结合后端逻辑添加 .active 类) */
.nav-menu a.active {
    color: #ffffff;
    background-color: #007bff;
    font-weight: 600;
}

/* 用户信息区域 */
.nav-user {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.nav-user a {
    color: #007bff;
    text-decoration: none;
    margin-left: 15px;
}

.nav-user a:hover {
    text-decoration: underline;
}

/* 汉堡菜单按钮 (默认隐藏) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #495057;
    padding: 5px 10px;
}

/* 主内容区 (为固定导航栏留出顶部空间) */
.global-main-content {
    margin-top: 60px; /* 必须与 .global-top-nav 的高度相同 */
    padding: 20px;
    min-height: calc(100vh - 60px);
    box-sizing: border-box;
}

/* ==================== 移动端响应式样式 ==================== */
@media (max-width: 768px) {
    .global-top-nav {
        padding: 0 15px;
        flex-wrap: wrap; /* 允许换行 */
        height: auto;
        min-height: 60px;
    }
    
    .nav-brand h2 {
        font-size: 1.2rem;
    }
    
    .nav-toggle {
        display: block; /* 在移动端显示汉堡按钮 */
    }
    
    .nav-menu-container {
        order: 3; /* 菜单换到第三行 */
        display: none; /* 默认隐藏 */
        width: 100%;
        margin: 0;
        background-color: #ffffff;
        border-top: 1px solid #eaeaea;
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    }
    
    /* 汉堡按钮被点击后，显示菜单 */
    .nav-menu-container.active {
        display: block;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-menu a {
        padding: 12px 20px;
        border-radius: 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-menu a:hover {
        background-color: #f8f9fa;
    }
    
    .nav-user {
        font-size: 0.85rem;
        margin-left: auto; /* 将用户信息推到右侧 */
        padding-right: 10px;
    }
}
/* 确保导航栏在所有元素之上 */
.global-top-nav {
    z-index: 9999 !important; /* 使用非常高的值 */
    background-color: white !important; /* 确保背景不透明 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important; /* 增强视觉层级 */
}

/* 确保主内容区域在导航栏之下 */
.global-main-content {
    z-index: 1; /* 正常层级 */
    position: relative; /* 确保z-index生效 */
}
/* ==================== 工单列表表格专用修复 ==================== */
/* 确保表格容器可以横向滚动，防止内容挤爆 */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* 移动端滚动更流畅 */
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

/* 基础表格样式重置与增强 */
table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    background-color: transparent;
    border-collapse: collapse;
}

/* 表头样式 */
thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem;
    vertical-align: bottom;
    text-align: left;
    white-space: nowrap; /* 防止表头文字换行 */
}

/* 表格单元格样式 */
tbody td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    word-break: break-word; /* 允许长单词或数字换行 */
}

/* 隔行变色，提高可读性 */
tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}
tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05); /* 悬停高亮 */
}

/* 移动端特定适配 */
@media (max-width: 768px) {
    .table-container {
        border: none;
        border-radius: 0;
    }
    
    /* 可选：将表格转为块级元素堆叠，适用于列数非常多的情况 */
    /* 
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        border: 1px solid #ccc;
        margin-bottom: 0.5rem;
    }
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
    }
    td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: bold;
    }
    */
}   /* ← 闭合第 253 行的 @media (max-width: 768px)，此前缺失导致后续所有规则被吞 */

/* ========== 工单列表移动端适配 ========== */
/* 桌面端表格容器 */
.wo-table-desktop {
    display: block;
}

/* 移动端卡片容器 */
.wo-table-mobile {
    display: none;
    padding: 10px;
}

/* 移动端工单卡片 */
.wo-mobile-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.wo-mobile-card-header {
    background: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wo-mobile-card-body {
    padding: 15px;
}

.wo-mobile-field {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f8f9fa;
}

.wo-mobile-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wo-mobile-label {
    flex: 0 0 100px;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.9em;
}

.wo-mobile-value {
    flex: 1;
    color: #212529;
    word-break: break-word;
}

.wo-mobile-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f8f9fa;
}

/* 移动端进度条 */
.wo-mobile-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wo-mobile-progress-bar {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.wo-mobile-progress-fill {
    height: 100%;
    background: #28a745;
    border-radius: 3px;
}

/* 响应式媒体查询 */
@media (max-width: 768px) {
    .wo-table-desktop {
        display: none !important;  /* 在移动端隐藏表格 */
    }
    
    .wo-table-mobile {
        display: block !important; /* 在移动端显示卡片 */
    }
}

@media (min-width: 769px) {
    .wo-table-desktop {
        display: block !important;  /* 在桌面端显示表格 */
    }
    
    .wo-table-mobile {
        display: none !important;  /* 在桌面端隐藏卡片 */
    }
}

/* ========== 报工查询页：桌面/移动双版本容器的响应式显隐 ========== */
/* 注意：标题<h4>与搜索表单位于 .card 外层，必须在「外层卡片」上做响应式显隐，
   否则两层卡片的标题会同时出现（重复标题）。
   统一使用 .view-desktop / .view-mobile 两个类，适用于「本日汇总」「按员工查看」等所有视图。 */
.view-desktop,
.daily-card-desktop {
    display: block;
}

.view-mobile,
.daily-card-mobile {
    display: none;
}

/* 仅卡片容器需要收窄内边距，表单等其他元素保持原样 */
.card.view-mobile,
.card.daily-card-mobile {
    padding: 10px;
}

@media (max-width: 768px) {
    .view-desktop,
    .daily-card-desktop {
        display: none !important;  /* 移动端隐藏桌面卡片（含其标题） */
    }
    .view-mobile,
    .daily-card-mobile {
        display: block !important; /* 移动端显示移动卡片（含其标题） */
    }
}

@media (min-width: 769px) {
    .view-desktop,
    .daily-card-desktop {
        display: block !important; /* 桌面端显示桌面卡片 */
    }
    .view-mobile,
    .daily-card-mobile {
        display: none !important;  /* 桌面端隐藏移动卡片 */
    }
}