/* ==========================================================================
   售后派工系统 - UI改造版本
   设计语言：参考 Ant Design / Element UI 风格
   主色调：蓝色系 #165DFF
   改造说明：仅修改CSS样式，未改动任何功能逻辑
   ========================================================================== */

/* ==========================================================================
   一、CSS变量定义
   ========================================================================== */
:root {
    /* 主色调 */
    --primary: #165DFF;
    --primary-light: #40a9ff;
    --primary-dark: #0D47A1;
    
    /* 背景色 */
    --bg-gray: #f5f7fa;
    --card-bg: #ffffff;
    --table-header-bg: #fafafa;
    
    /* 文字色 */
    --text-primary: #1f2937;
    --text-secondary: #666666;
    --text-placeholder: #9ca3af;
    
    /* 状态色 */
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    
    /* 边框与阴影 */
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    
    /* 布局尺寸 - PC端 */
    --sidebar-width: 240px;
    --header-height: 60px;
    --content-padding: 24px;
    --card-radius: 8px;
    --card-margin: 20px;
    
    /* 按钮尺寸 - PC端 */
    --btn-height: 36px;
    --btn-font-size: 14px;
    --btn-radius: 6px;
    
    /* 输入框尺寸 - PC端 */
    --input-height: 36px;
    --input-font-size: 14px;
}

/* APP端变量覆盖 */
@media (max-width: 768px) {
    :root {
        --header-height: 48px;
        --tab-bar-height: 50px;
        --content-padding: 12px;
        --card-radius: 12px;
        --card-margin: 16px;
        --btn-height: 44px;
        --btn-font-size: 15px;
        --input-height: 44px;
        --input-font-size: 16px;
    }
}

/* ==========================================================================
   二、重置与基础样式
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gray);
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
}

/* ==========================================================================
   三、布局容器
   ========================================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--content-padding);
    min-height: calc(100vh - var(--header-height));
}

/* APP端为底部Tab留空间 */
@media (max-width: 768px) {
    .container {
        padding-bottom: calc(var(--tab-bar-height) + 20px);
    }
}

/* ==========================================================================
   四、顶部导航栏
   ========================================================================== */
.header {
    background: linear-gradient(135deg, #165DFF 0%, #0D47A1 100%);
    height: var(--header-height);
    padding: 0 var(--content-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    font-size: 14px;
}

.header .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.header .btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 新版顶部导航栏布局 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.role-switcher {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    min-width: 110px;
}

.role-switcher option {
    background: #165DFF;
    color: #fff;
}

.header .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* APP端顶部导航 */
@media (max-width: 768px) {
    .header {
        height: 56px;
        padding: 0 12px;
    }
    
    .header h1 {
        font-size: 15px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .current-user-name {
        display: block;
        font-size: 12px;
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .role-switcher,
    .header #roleSwitcher {
        max-width: 100px;
        font-size: 12px;
        padding: 5px 8px;
        height: 32px;
        min-width: auto;
    }
    
    .header .btn-small {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }
}

/* ==========================================================================
   五、卡片组件
   ========================================================================== */
.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: var(--content-padding);
    margin-bottom: var(--card-margin);
    border: none;
}

.card-title {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   六、按钮规范
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--btn-height);
    padding: 0 16px;
    border-radius: var(--btn-radius);
    border: 1px solid transparent;
    font-size: var(--btn-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
    background: #e6f7ff;
}

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

.btn-success:hover {
    background: #389e0d;
    border-color: #389e0d;
}

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

.btn-danger:hover {
    background: #cf1322;
    border-color: #cf1322;
}

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

.btn-warning:hover {
    background: #d48806;
    border-color: #d48806;
}

.btn-small {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-large {
    height: 44px;
    padding: 0 24px;
    font-size: 16px;
}

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

/* ==========================================================================
   七、表单输入框
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    height: var(--input-height);
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: var(--input-font-size);
    color: var(--text-primary);
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
}

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

.form-control::placeholder {
    color: var(--text-placeholder);
}

select.form-control {
    cursor: pointer;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 下拉框选项样式 */
select.form-control option {
    padding: 8px 12px;
    font-size: 14px;
    white-space: normal;
    line-height: 1.4;
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
    line-height: 1.5;
    resize: vertical;
}

/* ==========================================================================
   八、表格样式
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
}

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

table th {
    background: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

table td {
    color: var(--text-secondary);
    font-size: 14px;
}

table tr:hover {
    background: #f8fafc;
}

/* APP端表格横向滚动 */
@media (max-width: 768px) {
    .table-container,
    .card > table,
    .card > div > table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    table {
        min-width: 600px;
    }
    
    table th,
    table td {
        padding: 8px 10px;
        white-space: nowrap;
        font-size: 13px;
    }
    
    /* 工单列表在APP端改为卡片式布局 */
    .pending-workorders-table,
    #workorderTable,
    #completedTable,
    #employeeTable,
    #logTable,
    .data-table {
        display: table;
        min-width: 100%;
    }
    
    .pending-workorders-table thead,
    #workorderTable thead,
    #completedTable thead,
    #employeeTable thead,
    #logTable thead,
    .data-table thead {
        display: none;
    }
    
    .pending-workorders-table tbody,
    .pending-workorders-table tr,
    #workorderTable tbody,
    #workorderTable tr,
    #completedTable tbody,
    #completedTable tr,
    #employeeTable tbody,
    #employeeTable tr,
    #logTable tbody,
    #logTable tr,
    .data-table tbody,
    .data-table tr {
        display: block;
        width: 100%;
    }
    
    .pending-workorders-table tr,
    #workorderTable tr,
    #completedTable tr,
    #employeeTable tr,
    #logTable tr,
    .data-table tr {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .pending-workorders-table td,
    #workorderTable td,
    #completedTable td,
    #employeeTable td,
    #logTable td,
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
        white-space: normal;
    }
    
    .pending-workorders-table td:last-child,
    #workorderTable td:last-child,
    #completedTable td:last-child,
    #employeeTable td:last-child,
    #logTable td:last-child,
    .data-table td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .pending-workorders-table td::before,
    #workorderTable td::before,
    #completedTable td::before,
    #employeeTable td::before,
    #logTable td::before,
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-primary);
        margin-right: 8px;
        flex-shrink: 0;
    }
}

/* ==========================================================================
   九、状态标签
   ========================================================================== */
.status-badge,
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

/* 待处理/待核查 - 橙色 */
.status-pending,
.tag-orange {
    background: #fff7e6;
    color: var(--warning);
    border-color: #ffd591;
}

/* 处理中/拆表换表中 - 蓝色 */
.status-processing,
.tag-blue {
    background: #e6f7ff;
    color: var(--primary);
    border-color: #91d5ff;
}

/* 已完成 - 绿色 */
.status-completed,
.tag-green {
    background: #f6ffed;
    color: var(--success);
    border-color: #b7eb8f;
}

/* 异常/停用/拒绝 - 红色 */
.status-rejected,
.tag-red {
    background: #fff2f0;
    color: var(--danger);
    border-color: #ffccc7;
}

/* 启用 - 绿色 */
.status-active {
    background: #f6ffed;
    color: var(--success);
    border-color: #b7eb8f;
}

/* 停用 - 红色 */
.status-inactive {
    background: #fff2f0;
    color: var(--danger);
    border-color: #ffccc7;
}

/* ==========================================================================
   十、导航菜单（Tab切换）
   ========================================================================== */
.nav-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--card-margin);
    border-bottom: 1px solid var(--border);
    background: #fff;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    overflow: hidden;
}

.nav-tab {
    padding: 12px 24px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
}

.nav-tab:hover {
    color: var(--primary);
    background: #f5f7fa;
}

.nav-tab.active {
    color: var(--primary);
    background: #e6f7ff;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* APP端Tab样式 */
@media (max-width: 768px) {
    .nav-tabs {
        border-radius: var(--card-radius);
        flex-wrap: wrap;
    }
    
    .nav-tab {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ==========================================================================
   十一、搜索框
   ========================================================================== */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box input,
.search-box select {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

/* APP端搜索框 */
@media (max-width: 768px) {
    .search-box {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .search-box input {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
        order: -1;
    }
    
    .search-box select {
        flex: 1 1 calc(50% - 4px);
        max-width: calc(50% - 4px);
        min-width: auto;
        width: auto;
    }
    
    .search-box .btn {
        flex: 1 1 calc(50% - 4px);
        max-width: calc(50% - 4px);
        height: 36px;
        padding: 0 12px;
        font-size: 13px;
    }
    
    .search-box .btn-success {
        background: #52c41a;
        border-color: #52c41a;
    }
}

/* ==========================================================================
   十二、模态框
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: var(--card-radius);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

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

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

.modal-body {
    padding: 24px;
}

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

.modal-footer .btn {
    min-width: 80px;
}

/* APP端模态框 */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal {
        width: 100%;
        max-width: none;
        margin: 0;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    
    .modal-overlay.active .modal {
        transform: translateY(0);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
        min-width: auto;
    }
    
    /* APP端表单优化 */
    .modal-body .form-group {
        margin-bottom: 12px;
    }
    
    .modal-body .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .modal-body .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ==========================================================================
   十三、提示消息
   ========================================================================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

/* ==========================================================================
   十四、统计卡片
   ========================================================================== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.stat-card h3,
.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-card p,
.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 彩色统计卡片 */
.stat-card.orange h3,
.stat-card.orange .stat-value { color: var(--warning); }
.stat-card.green h3,
.stat-card.green .stat-value { color: var(--success); }
.stat-card.red h3,
.stat-card.red .stat-value { color: var(--danger); }

/* APP端统计卡片 */
@media (max-width: 768px) {
    .stat-card h3,
    .stat-value {
        font-size: 24px;
    }
}

/* ==========================================================================
   十五、网格布局
   ========================================================================== */
.grid {
    display: grid;
    gap: var(--card-margin);
}

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

/* APP端网格适配 */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   十六、底部Tab导航（APP端专属）
   ========================================================================== */
.tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.tab-bar-nav {
    display: flex;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.tab-bar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 10px;
    transition: all 0.3s ease;
    padding: 4px 0;
}

.tab-bar .tab-item svg {
    width: 22px;
    height: 22px;
}

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

.tab-bar .tab-item:hover {
    color: var(--primary);
}

/* APP端显示底部Tab */
@media (max-width: 768px) {
    .tab-bar {
        display: block;
    }
}

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

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

.empty-state-text {
    font-size: 14px;
}

/* ==========================================================================
   十八、加载状态
   ========================================================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-placeholder);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* ==========================================================================
   十九、步骤条
   ========================================================================== */
.steps {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.step-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.step-item.active .step-dot {
    background: var(--primary);
    color: #fff;
}

.step-item.completed .step-dot {
    background: var(--success);
    color: #fff;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
}

/* ==========================================================================
   二十、辅助类
   ========================================================================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-danger { background: var(--danger) !important; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ==========================================================================
   二十一、响应式适配规则
   ========================================================================== */

/* 平板端适配 */
@media (max-width: 1024px) {
    .container {
        padding: 16px;
    }
}

/* APP端适配 */
@media (max-width: 768px) {
    /* 1. 隐藏侧边栏 */
    .sidebar {
        display: none !important;
    }
    
    /* 2. 主内容区全屏 */
    .main-content {
        margin-left: 0;
        padding: 12px;
        padding-bottom: 70px;
    }
    
    /* 3. 卡片圆角增大 */
    .card {
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .card-title {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    /* 4. 按钮放大 */
    .btn {
        height: 44px;
        font-size: 15px;
    }
    
    .btn-small {
        height: 36px;
        font-size: 13px;
    }
    
    /* 5. 输入框放大 */
    .form-control {
        height: 44px;
        font-size: 16px;
    }
    
    /* 6. 表格横向滚动 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 7. 头部简化 */
    .header {
        height: 48px;
        padding: 0 12px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    /* 8. 统计卡片2列 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 14px;
        border-radius: 12px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .btn {
        height: 44px;
        font-size: 15px;
        padding: 0 14px;
    }
    
    .form-control {
        height: 44px;
        font-size: 16px;
    }
    
    .stat-card h3,
    .stat-value {
        font-size: 22px;
    }
    
    /* 单列布局 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   二十三、APP端卡片列表样式
   ========================================================================== */
@media (max-width: 768px) {
    /* 工单卡片列表样式 */
    .workorder-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .workorder-card {
        background: #fff;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        border: 1px solid var(--border);
    }
    
    .workorder-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .workorder-card-id {
        font-weight: 600;
        color: var(--primary);
        font-size: 14px;
    }
    
    .workorder-card-body {
        display: grid;
        gap: 10px;
    }
    
    .workorder-card-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .workorder-card-label {
        color: var(--text-secondary);
        font-size: 13px;
        flex-shrink: 0;
    }
    
    .workorder-card-value {
        color: var(--text-primary);
        font-size: 14px;
        text-align: right;
        word-break: break-all;
    }
    
    .workorder-card-footer {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
    
    /* 表格在APP端的卡片化显示 */
    .pending-workorders-table td,
    #workorderTable td,
    #completedTable td,
    #employeeTableBody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f5f5f5;
    }
    
    .pending-workorders-table td:last-child,
    #workorderTable td:last-child,
    #completedTable td:last-child,
    #employeeTableBody td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .pending-workorders-table td::before,
    #workorderTable td::before,
    #completedTable td::before,
    #employeeTableBody td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-secondary);
        font-size: 13px;
    }
}

/* ==========================================================================
   二十二、打印样式
   ========================================================================== */
@media print {
    .header,
    .tab-bar,
    .nav-tabs,
    .btn {
        display: none !important;
    }
    
    .container {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border);
    }
}
