* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

/* 容器通用样式 */
.container, .login-container, .admin-container, .worker-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* 登录页面容器 */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
}

@media (max-width: 480px) {
    .login-container {
        margin: 20px auto;
        padding: 20px;
    }
}

.login-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

@media (max-width: 480px) {
    .login-container h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
}

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

.login-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 16px;
}

.login-form input,
.login-form select,
.login-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

@media (max-width: 480px) {
    .login-form input,
    .login-form select {
        padding: 14px 15px; /* 更大的点击区域 */
        font-size: 16px; /* 防止iOS缩放 */
    }
}

.login-form input:focus,
.login-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

@media (max-width: 480px) {
    .btn {
        padding: 14px 20px;
        width: 100%; /* 手机端按钮全宽 */
        margin: 5px 0;
    }
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-warning {
    background: #ecc94b;
    color: #744210;
    border: none;
}

.btn-warning:hover {
    background: #d69e2e;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

@media (max-width: 480px) {
    .btn-small {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* 头部样式 */
.header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        text-align: center;
    }
}

.header h1 {
    color: #2d3748;
    font-size: 24px;
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }
}

.nav {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 480px) {
    .nav {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .nav .btn-small {
        width: 100%;
    }
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px;
}

@media (max-width: 768px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        padding: 20px;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 12px;
    }
}

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.card h3 {
    color: #718096;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.card .number {
    color: #2d3748;
    font-size: 28px;
    font-weight: bold;
}

@media (max-width: 480px) {
    .card {
        padding: 15px;
    }
    
    .card .number {
        font-size: 24px;
    }
}

/* 区块样式 */
.section {
    background: white;
    margin: 20px 30px;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .section {
        margin: 15px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .section {
        margin: 10px;
        padding: 15px;
    }
}

.section h2 {
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    font-size: 20px;
}

@media (max-width: 480px) {
    .section h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* 表单样式 */
.record-form, .worker-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .record-form, .worker-form {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .record-form, .worker-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.record-form select,
.record-form input,
.worker-form input {
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    width: 100%;
}

/* 表格容器 - 支持横向滚动 */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
    border-radius: 8px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* 确保小屏幕可横向滚动 */
}

@media (max-width: 768px) {
    table {
        min-width: 500px;
    }
}

th {
    background: #f7fafc;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 14px;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
    font-size: 14px;
    white-space: nowrap;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 120px;
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-buttons .btn-small {
        width: 100%;
        text-align: center;
    }
}

/* 状态标签 */
.status-badge, .settled-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-active, .settled-yes {
    background: #c6f6d5;
    color: #22543d;
}

.status-inactive, .settled-no {
    background: #fed7d7;
    color: #742a2a;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 768px) {
    .filter-bar {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar select,
    .filter-bar input,
    .filter-bar .btn {
        width: 100%;
    }
}

.filter-bar select,
.filter-bar input {
    padding: 10px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

@media (max-width: 768px) {
    .filter-bar select,
    .filter-bar input {
        min-width: 120px;
    }
}

/* 操作栏 */
.action-bar {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .action-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-bar .btn {
        width: 100%;
    }
}

/* 月度统计 */
.monthly-stats {
    margin: 20px 0;
}

.stat-item {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .stat-item {
        gap: 10px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

.stat-item .month {
    min-width: 80px;
    font-weight: 600;
    color: #4a5568;
}

.stat-item .hours {
    min-width: 80px;
    color: #718096;
    font-weight: 500;
}

.stat-item .amount {
    min-width: 100px;
    color: #2d3748;
    font-weight: 500;
}

.progress-bar {
    flex: 1;
    min-width: 150px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}

@media (max-width: 480px) {
    .progress-bar {
        width: 100%;
    }
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

/* 分享框 */
.share-box {
    background: #f7fafc;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

@media (max-width: 480px) {
    .share-box {
        padding: 20px 15px;
    }
}

.share-link {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .share-link {
        flex-direction: column;
        gap: 10px;
    }
}

.share-link input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    word-break: break-all;
}

@media (max-width: 480px) {
    .share-link input {
        font-size: 13px;
        padding: 10px;
    }
}

.tip {
    color: #718096;
    font-size: 13px;
    margin-top: 10px;
    line-height: 1.5;
}

/* 警告提示 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 30px;
    font-size: 14px;
}

@media (max-width: 480px) {
    .alert {
        margin: 15px;
        padding: 12px 15px;
    }
}

.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.success {
    background: #c6f6d5;
    color: #276749;
    border: 1px solid #9ae6b4;
}

/* 汇总卡片 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 30px;
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px 20px;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
        padding: 10px 15px;
        gap: 12px;
    }
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.summary-card h4 {
    color: #718096;
    font-size: 14px;
    margin-bottom: 10px;
}

.summary-card .amount {
    font-size: 24px;
    font-weight: bold;
    color: #2d3748;
}

/* 信息框 */
.info-box {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-box h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    color: #666;
    padding: 5px 0;
    font-size: 14px;
}

/* 金额预览 */
.amount-preview {
    background: #ebf8ff;
    padding: 15px;
    border-radius: 8px;
    color: #2b6cb0;
    font-weight: 500;
    text-align: center;
    border: 1px solid #90cdf4;
}

/* 打印样式 */
@media print {
    .btn, .action-bar, .share-box, .nav, .filter-bar {
        display: none !important;
    }
    
    body {
        background: white;
        padding: 0;
    }
    
    .admin-container, .worker-container {
        box-shadow: none;
        margin: 0;
    }
    
    table {
        min-width: auto;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    select, input, button {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    .container, .login-container, .admin-container, .worker-container {
        background: #2d3748;
    }
    
    .header, .section, .card, .summary-card {
        background: #1a202c;
        color: #e2e8f0;
    }
    
    .header h1, .section h2 {
        color: #e2e8f0;
    }
    
    input, select, textarea {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .stat-item {
        background: #2d3748;
    }
}