/**
 * 员工记工系统 - 完全移动端优化样式
 * 版本: 3.0 - 移动优先,完全适配手机端
 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gray-light: #f5f5f5;
    --gray-medium: #e9ecef;
    --gray-dark: #6c757d;
    --text-dark: #212529;
    --text-light: #6c757d;
    --white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
}

/* ==================== 容器 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
}

/* ==================== 导航栏样式 ==================== */
.main-header {
    background: #667eea;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

.mobile-menu-btn.active .hamburger {
    background: transparent;
}

.mobile-menu-btn.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-btn.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

.logo {
    color: white;
    text-decoration: none;
    flex: 1;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    display: block;
}

.logo h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    line-height: 1.3;
}

.logo p {
    font-size: 12px;
    margin: 3px 0 0 0;
    opacity: 0.9;
}

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

.user-info span {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-info a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    transition: all 0.3s;
}

.user-info a:hover {
    background: rgba(255,255,255,0.3);
}

/* 桌面端导航菜单 */
.desktop-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.desktop-nav a {
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
}

/* 移动端导航菜单 */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: #667eea;
    padding: 80px 20px 20px;
    transition: left 0.3s ease;
    z-index: 999;
    box-shadow: 5px 0 20px rgba(0,0,0,0.2);
    overflow-y: auto;
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 16px 20px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    background: rgba(255,255,255,0.3);
    transform: translateX(5px);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

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

/* ==================== 头部样式（兼容旧版） ==================== */
.header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.header p {
    font-size: 14px;
    opacity: 0.95;
    margin: 0;
}

/* ==================== 导航栏 ==================== */
.nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 14px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    display: block;
    min-height: 48px;
    line-height: 20px;
    align-items: center;
    justify-content: center;
}

.nav a:hover,
.nav a.active {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ==================== 卡片样式 ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    width: 100%;
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.card h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* ==================== 仪表板 ==================== */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.dashboard-card {
    background: var(--white);
    padding: 20px 15px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.3s ease;
}

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

.dashboard-card h3 {
    color: var(--primary-color);
    font-size: 32px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.dashboard-card p {
    color: var(--text-light);
    font-size: 13px;
    margin: 0;
    font-weight: 500;
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: var(--primary-color);
    color: white;
    padding: 24px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stat-card h3 {
    font-size: 36px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.stat-card .label {
    font-size: 14px;
    opacity: 0.95;
    margin: 0;
}

/* ==================== 汇总卡片 ==================== */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
}

.summary-item h3 {
    font-size: 28px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.summary-item p {
    font-size: 13px;
    margin: 0;
    opacity: 0.9;
}

/* ==================== 消息样式 ==================== */
.message {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    width: 100%;
    font-size: 14px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    min-height: 50px;
    min-width: 100px;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

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

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-medium);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: var(--white);
    min-height: 52px;
}

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

.form-group select {
    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 9L1 4l1-1 4 5 5 5-5 1 1-5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

/* ==================== 表格样式 ==================== */
.table-container {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    font-size: 14px;
}

thead {
    background: var(--gray-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background: var(--gray-medium);
    color: var(--text-dark);
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--gray-medium);
    vertical-align: middle;
}

tbody tr:hover {
    background-color: var(--gray-light);
}

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

/* ==================== 手机端表格优化 ==================== */
@media (max-width: 768px) {
    .table-container {
        overflow-x: visible;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
    }

    table {
        width: 100%;
        min-width: auto;
        max-width: 100%;
        font-size: 12px;
        table-layout: fixed;
    }

    /* 确保表格不会超出容器 */
    .card {
        overflow: visible;
    }

    thead {
        display: none;
    }

    tbody {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    tbody tr {
        display: block;
        margin-bottom: 15px;
        background: white;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    tbody tr:hover {
        background: white;
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    td {
        display: block;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
        vertical-align: middle;
        width: 100%;
        text-align: left;
        box-sizing: border-box;
    }

    td:last-child {
        border-bottom: none;
    }

    td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: var(--primary-color);
        font-size: 11px;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* 确保操作列的 td 能够正确容纳按钮 */
    td[data-label="操作"] {
        width: 100%;
        box-sizing: border-box;
        padding-right: 0;
        padding-left: 0;
    }

    td[data-label="操作"] .actions {
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }

    td[data-label="操作"] .btn-sm {
        width: 100% !important;
        box-sizing: border-box;
        max-width: 100%;
    }

    /* 隐藏表格中不重要的列 */
    .hide-mobile {
        display: none;
    }

    /* 操作按钮优化 */
    .actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
        width: 100% !important;
        max-width: 100% !important;
    }

    .actions .btn-sm,
    .actions .btn-sm a,
    .actions .btn-sm button {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        text-align: center;
        padding: 12px 20px !important;
        font-size: 14px;
        min-height: 46px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        letter-spacing: 0.5px;
        box-sizing: border-box;
        white-space: nowrap;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        text-decoration: none;
    }

    .actions .btn-sm:hover,
    .actions .btn-sm a:hover,
    .actions .btn-sm button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* 图标按钮样式 */
    .icon-btn {
        font-size: 20px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* 桌面端显示文字和图标 */
    @media (min-width: 769px) {
        .icon-btn {
            margin-right: 8px;
        }
        .actions .btn-sm {
            justify-content: flex-start;
        }
    }

    /* 手机端只显示图标 - 全新设计 */
    @media (max-width: 768px) {
        /* 表格中的操作按钮 */
        td[data-label="操作"] {
            padding-top: 12px !important;
            padding-bottom: 12px !important;
        }

        td[data-label="操作"]::before {
            display: none !important;
        }

        td[data-label="操作"] .actions {
            flex-direction: row !important;
            gap: 8px !important;
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        td[data-label="操作"] .actions .btn-sm {
            width: auto !important;
            min-width: 75px !important;
            max-width: 150px !important;
            padding: 10px 14px !important;
            min-height: 40px;
            flex: 0 1 auto;
            font-size: 13px;
            border-radius: 6px !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        td[data-label="操作"] .actions .btn-sm:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
        }

        /* 页面头部或其他位置的操作按钮（如 materials.php） */
        .card .actions {
            flex-direction: row !important;
            gap: 8px !important;
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        .card .actions .btn-sm,
        .actions.header-actions .btn-sm {
            width: auto !important;
            min-width: 75px !important;
            max-width: 150px !important;
            padding: 10px 14px !important;
            min-height: 40px;
            flex: 0 1 auto;
            font-size: 13px;
            border-radius: 6px !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .card .actions .btn-sm:hover,
        .actions.header-actions .btn-sm:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
        }

        /* 手机端添加按钮（页面顶部的"添加XXX"按钮） */
        .card > div[style*="flex"] > .btn-add {
            padding: 10px 16px;
            font-size: 13px;
            min-height: 40px;
            font-weight: 600;
            border-radius: 6px;
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
            transition: all 0.3s ease;
            background: #667eea;
            color: white;
        }

        .card > div[style*="flex"] > .btn-add:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .card > div[style*="flex"] > .btn-add:active {
            transform: translateY(0);
            box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
        }

        /* 添加按钮图标 */
        .card > div[style*="flex"] > .btn-add::before {
            content: '+';
            display: inline-block;
            margin-right: 6px;
            font-weight: 700;
            font-size: 16px;
            line-height: 1;
        }
    }

    .actions .btn-primary {
        background: #667eea;
    }

    .actions .btn-success {
        background: #28a745;
    }

    .actions .btn-warning {
        background: #ffc107;
        color: #212529;
    }

    .actions .btn-danger {
        background: #dc3545;
    }

    .actions .btn-info {
        background: #17a2b8;
    }

    /* 状态徽章优化 */
    .status-badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    /* 金额样式优化 */
    .amount,
    .salary-amount {
        font-size: 16px;
        display: block;
        margin-top: 5px;
    }

    .work-days,
    .work-time {
        font-size: 14px;
        display: block;
        margin-top: 5px;
    }
}

/* ==================== 信息网格 ==================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: var(--gray-light);
    padding: 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.info-label {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 600;
}

.info-value {
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 600;
}

/* ==================== 图片画廊 ==================== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.image-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.image-item:hover {
    transform: scale(1.05);
}

.image-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

/* ==================== 状态徽章 ==================== */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-active,
.status-paid,
.status-received {
    background: #d4edda;
    color: #155724;
}

.status-inactive,
.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ==================== 标签页 ==================== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 12px 20px;
    background: var(--gray-medium);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 44px;
}

.tab:hover {
    background: #dee2e6;
}

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

/* ==================== 日期过滤器 ==================== */
.date-filter,
.month-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--gray-light);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.date-filter input,
.month-filter input {
    padding: 10px 14px;
}

/* ==================== 金额样式 ==================== */
.amount,
.salary-amount {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 18px;
}

.work-days,
.work-time {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
}

/* ==================== 响应式设计 - 平板 ==================== */
@media (max-width: 1024px) {
    .container {
        padding: 12px;
    }

    .main-header {
        padding: 12px 15px;
    }

    .header-content {
        padding: 0 5px;
    }

    .logo h1 {
        font-size: 17px;
    }

    .logo p {
        font-size: 11px;
    }

    .desktop-nav a {
        padding: 8px 12px;
        font-size: 13px;
    }

    .user-info a {
        padding: 6px 12px;
        font-size: 13px;
    }

    .header {
        padding: 18px;
        border-radius: var(--radius-md);
    }

    .header h1 {
        font-size: 20px;
    }

    .nav {
        grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
        gap: 8px;
    }

    .nav a {
        padding: 12px 10px;
        font-size: 12px;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .card h2 {
        font-size: 16px;
    }

    .card h3 {
        font-size: 15px;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

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

    .dashboard-card h3 {
        font-size: 28px;
    }

    table {
        min-width: 700px;
        font-size: 13px;
    }

    th, td {
        padding: 12px 10px;
    }

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

    .summary-item h3 {
        font-size: 24px;
    }
}

/* ==================== 响应式设计 - 手机 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }

    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* 手机端卡片保持原始样式，不额外添加内边距 */
    /* 卡片添加内边距 */
    .card {
        padding: 8px;
    }

    .main-header {
        padding: 12px 15px;
    }

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

    .logo {
        flex: 1;
    }

    .logo-text {
        font-size: 16px;
    }

    .logo h1 {
        font-size: 16px;
    }

    .logo p {
        font-size: 11px;
    }

    .desktop-nav {
        display: none;
    }

    .user-info span {
        display: none;
    }

    .header {
        padding: 15px;
        border-radius: var(--radius-sm);
        display: none;
    }

    .nav {
        display: none;
    }

    .header h1 {
        font-size: 18px;
    }

    .header p {
        font-size: 13px;
    }

    .nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .nav a {
        padding: 14px 10px;
        font-size: 13px;
        min-height: 52px;
    }

    .card {
        padding: 15px;
        border-radius: var(--radius-sm);
    }

    .card h2 {
        font-size: 15px;
    }

    .card h3 {
        font-size: 14px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 14px;
        min-height: 52px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        margin-bottom: 10px;
        min-height: 52px;
    }

    .btn-sm {
        width: 100%;
        padding: 11px 16px;
        font-size: 13px;
        min-height: 46px;
    }

    /* 手机端操作按钮在后面的媒体查询中定义，这里留空 */

    .table-container {
        border-radius: var(--radius-sm);
    }

    table {
        min-width: 600px;
        font-size: 12px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }

    th {
        font-size: 11px;
        padding: 8px 6px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .info-item {
        padding: 14px;
    }

    .info-value {
        font-size: 15px;
    }

    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .image-item img {
        height: 100px;
    }

    .stat-card h3 {
        font-size: 28px;
    }

    .stat-card .label {
        font-size: 12px;
    }

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

    .dashboard-card {
        padding: 16px;
    }

    .dashboard-card h3 {
        font-size: 32px;
    }

    .summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-item {
        padding: 18px;
    }

    .summary-item h3 {
        font-size: 24px;
    }

    .status-badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    .message {
        font-size: 13px;
        padding: 12px 16px;
    }

    .date-filter,
    .month-filter {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .date-filter input,
    .month-filter input {
        width: 100%;
    }

    .tabs {
        gap: 6px;
    }

    .tab {
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* ==================== 响应式设计 - 超小屏幕 ==================== */
@media (max-width: 480px) {
    .container {
        padding: 5px;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }

    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* 手机端添加按钮样式 */
    .card > div[style*="flex"] > .btn-add {
        padding: 10px 16px;
        font-size: 13px;
        min-height: 40px;
        font-weight: 600;
        border-radius: 6px;
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
        transition: all 0.3s ease;
        background: #667eea;
        color: white;
    }

    .card > div[style*="flex"] > .btn-add:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }

    .card > div[style*="flex"] > .btn-add:active {
        transform: translateY(0);
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
    }

    /* 添加按钮图标 */
    .card > div[style*="flex"] > .btn-add::before {
        content: '+';
        display: inline-block;
        margin-right: 6px;
        font-weight: 700;
        font-size: 16px;
        line-height: 1;
    }

    /* 超小屏幕操作按钮优化 */
    td[data-label="操作"]::before {

    /* 超小屏幕添加按钮样式 */
    .card > div[style*="flex"] > .btn-add {
        padding: 8px 14px;
        font-size: 12px;
        min-height: 38px;
        font-weight: 600;
        border-radius: 6px;
        box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
        transition: all 0.3s ease;
        background: #667eea;
        color: white;
    }

    .card > div[style*="flex"] > .btn-add:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(102, 126, 234, 0.25);
    }

    .card > div[style*="flex"] > .btn-add:active {
        transform: translateY(0);
        box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
    }

    .card > div[style*="flex"] > .btn-add::before {
        content: '+';
        display: inline-block;
        margin-right: 4px;
        font-weight: 700;
        font-size: 15px;
        line-height: 1;
    }
        display: none !important;
    }

    td[data-label="操作"] .actions {
        flex-direction: row !important;
        gap: 6px !important;
        justify-content: flex-start;
        flex-wrap: wrap;
        width: 100% !important;
        max-width: 100% !important;
    }

    td[data-label="操作"] .actions .btn-sm {
        width: auto !important;
        min-width: 65px !important;
        max-width: 120px !important;
        padding: 9px 12px !important;
        min-height: 38px;
        flex: 0 1 auto;
        font-size: 12px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    td[data-label="操作"] .actions .btn-sm:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    }

    .main-header {
        padding: 10px 12px;
    }

    .logo h1 {
        font-size: 15px;
    }

    .logo p {
        font-size: 10px;
    }

    .mobile-nav {
        width: 260px;
    }

    .mobile-nav a {
        padding: 14px 16px;
        font-size: 15px;
    }

    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 16px;
    }

    .header p {
        font-size: 12px;
    }

    .nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .nav a {
        padding: 12px 8px;
        font-size: 12px;
    }

    .card {
        padding: 12px;
    }

    .card h2 {
        font-size: 14px;
    }

    .card h3 {
        font-size: 13px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 12px;
        min-height: 48px;
    }

    .btn {
        font-size: 15px;
        padding: 12px 16px;
        min-height: 48px;
    }

    .btn-sm {
        font-size: 14px;
        padding: 11px 14px;
        min-height: 46px;
        width: 100%;
    }

    /* 确保操作按钮在所有尺寸下都垂直排列 */
    /* 超小屏幕的操作按钮样式在前面的媒体查询中定义 */



    .actions .btn-sm {
        width: 100% !important;
        min-width: auto !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        padding: 11px 14px !important;
        min-height: 46px !important;
    }

    table {
        min-width: 500px;
        font-size: 11px;
    }

    th, td {
        padding: 8px 6px;
        font-size: 11px;
    }

    th {
        font-size: 10px;
        padding: 6px 4px;
    }

    .info-value {
        font-size: 14px;
    }

    .stat-card h3 {
        font-size: 24px;
    }

    .stat-card .label {
        font-size: 11px;
    }

    .dashboard-card h3 {
        font-size: 28px;
    }

    .summary-item h3 {
        font-size: 20px;
    }

    .summary-item p {
        font-size: 11px;
    }

    .status-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* 超小屏幕操作按钮优化 - 全新设计 */
    td[data-label="操作"] {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    td[data-label="操作"]::before {
        display: none !important;
    }

    td[data-label="操作"] .actions {
        flex-direction: row !important;
        gap: 10px !important;
        justify-content: flex-start;
        flex-wrap: nowrap;
        margin-top: 0;
        padding: 0;
    }

    td[data-label="操作"] .actions .btn-sm {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        padding: 10px !important;
        min-height: 44px;
        flex: 0 0 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        position: relative;
        overflow: hidden;
    }

    td[data-label="操作"] .actions .btn-sm:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    td[data-label="操作"] .icon-btn {
        margin: 0;
        font-size: 20px;
        position: relative;
        z-index: 1;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }

    /* 隐藏文字，只显示图标 */
    td[data-label="操作"] .actions .btn-sm span:not(.icon-btn) {
        display: none;
    }

    /* 不同按钮的渐变背景 */
    td[data-label="操作"] .actions .btn-primary {
        background: #667eea;
    }

    td[data-label="操作"] .actions .btn-success {
        background: #28a745;
    }

    td[data-label="操作"] .actions .btn-warning {
        background: #ffc107;
    }

    td[data-label="操作"] .actions .btn-danger {
        background: #dc3545;
    }

    td[data-label="操作"] .actions .btn-info {
        background: #17a2b8;
    }

    /* 页面头部或其他位置的操作按钮（如 materials.php）- 超小屏幕 */
    .card .actions,
    .actions.header-actions {
        flex-direction: row !important;
        gap: 10px !important;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    .card .actions .btn-sm,
    .actions.header-actions .btn-sm {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        padding: 10px !important;
        min-height: 44px;
        flex: 0 0 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .card .actions .btn-sm:hover,
    .actions.header-actions .btn-sm:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .card .actions .icon-btn,
    .actions.header-actions .icon-btn {
        margin: 0;
        font-size: 20px;
        position: relative;
        z-index: 1;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }

    .card .actions .btn-sm span:not(.icon-btn),
    .actions.header-actions .btn-sm span:not(.icon-btn) {
        display: none;
    }

    .card .actions .btn-primary,
    .actions.header-actions .btn-primary {
        background: #667eea;
    }

    .card .actions .btn-success,
    .actions.header-actions .btn-success {
        background: #28a745;
    }

    .card .actions .btn-warning,
    .actions.header-actions .btn-warning {
        background: #ffc107;
    }

    .card .actions .btn-danger,
    .actions.header-actions .btn-danger {
        background: #dc3545;
    }

    .card .actions .btn-info,
    .actions.header-actions .btn-info {
        background: #17a2b8;
    }

    .amount,
    .salary-amount {
        font-size: 15px;
    }

    .work-days,
    .work-time {
        font-size: 14px;
    }

    /* 隐藏表格中不重要的列 */
    .hide-mobile {
        display: none;
    }
}

/* ==================== 辅助类 ==================== */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-light);
}

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

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

.d-flex {
    display: flex;
}

.d-flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.row-count {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    margin-left: 8px;
}

/* ==================== 业主财务统计 - 统一布局 ==================== */
/* 桌面端和手机端统一样：每行3个字段，共2行 */
#owner_financial_summary .form-row,
#owner_financial_summary_edit .form-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 12px;
}

#owner_financial_summary .form-row:last-child,
#owner_financial_summary_edit .form-row:last-child {
    margin-bottom: 0;
}

/* 业主财务统计字段样式 */
#owner_financial_summary .form-group,
#owner_financial_summary_edit .form-group {
    margin-bottom: 0;
    text-align: center;
}

#owner_financial_summary .form-group label,
#owner_financial_summary_edit .form-group label {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-weight: 500;
}

#owner_financial_summary .form-group div[style*="font-size"],
#owner_financial_summary_edit .form-group div[style*="font-size"] {
    font-size: 1.3em !important;
    font-weight: 700;
    line-height: 1.4;
}

/* 业主财务统计卡片标题 */
#owner_financial_summary h3,
#owner_financial_summary_edit h3 {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
    color: #1890ff;
}

/* ==================== 业主财务统计 - 手机端优化 ==================== */
@media (max-width: 768px) {
    /* 业主财务统计区域 - 所有行都是3列布局（覆盖全局的2列布局） */
    #owner_financial_summary .form-row,
    #owner_financial_summary_edit .form-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    #owner_financial_summary .form-row:last-child,
    #owner_financial_summary_edit .form-row:last-child {
        margin-bottom: 0 !important;
    }

    /* 财务统计字段样式优化 */
    #owner_financial_summary .form-group,
    #owner_financial_summary_edit .form-group {
        margin-bottom: 0;
        text-align: center;
    }

    #owner_financial_summary .form-group label,
    #owner_financial_summary_edit .form-group label {
        font-size: 11px;
        margin-bottom: 4px;
        color: var(--text-light);
    }

    #owner_financial_summary .form-group div[style*="font-size"],
    #owner_financial_summary_edit .form-group div[style*="font-size"] {
        font-size: 14px !important;
        font-weight: 700;
        line-height: 1.4;
    }

    /* 财务统计卡片标题优化 */
    #owner_financial_summary h3,
    #owner_financial_summary_edit h3 {
        font-size: 14px;
        margin-bottom: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕：保持3列布局 */
    #owner_financial_summary .form-row,
    #owner_financial_summary_edit .form-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    /* 财务统计字段字体调整 */
    #owner_financial_summary .form-group div[style*="font-size"],
    #owner_financial_summary_edit .form-group div[style*="font-size"] {
        font-size: 12px !important;
    }

    #owner_financial_summary .form-group label,
    #owner_financial_summary_edit .form-group label {
        font-size: 9px;
    }
}
