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

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

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 1.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.9;
}

@media (min-width: 768px) {
    header h1 {
        font-size: 2.5em;
    }
    
    .subtitle {
        font-size: 1.1em;
    }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

.card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.card h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

@media (min-width: 768px) {
    .card {
        padding: 25px;
        margin-bottom: 20px;
    }
    
    .card h2 {
        margin-bottom: 20px;
        font-size: 1.3em;
        padding-bottom: 10px;
    }
}

.upload-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

@media (min-width: 640px) {
    .upload-section {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (min-width: 1024px) {
    .upload-section {
        grid-template-columns: 1fr 1fr 1fr;
        margin-bottom: 20px;
    }
}

.upload-btn {
    background: #667eea;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s;
    font-size: 0.9em;
}

.upload-btn:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #48bb78;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

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

.btn-template {
    background: #ed8936;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-template:hover {
    background: #dd6b20;
}

@media (min-width: 768px) {
    .upload-btn,
    .btn-secondary,
    .btn-template {
        padding: 12px 20px;
        font-size: 1em;
    }
}

.student-list {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.student-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.student-item:hover {
    background: #f7fafc;
}

@media (min-width: 768px) {
    .student-list {
        max-height: 300px;
    }
    
    .student-item {
        padding: 10px;
        font-size: 1em;
    }
}

.today-info {
    background: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.95em;
    color: #2d3748;
}

@media (min-width: 768px) {
    .today-info {
        padding: 15px;
        margin-bottom: 20px;
        font-size: 1.1em;
    }
}

#currentDate {
    font-weight: bold;
    color: #667eea;
}

.leave-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label {
    min-width: 80px;
    font-weight: 500;
    font-size: 0.9em;
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .form-group {
        gap: 10px;
    }
    
    .form-group label {
        min-width: 100px;
        font-size: 1em;
    }
    
    .form-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

.today-leave-list {
    min-height: 120px;
}

.leave-item {
    background: #fff5f5;
    border-left: 4px solid #fc8181;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.leave-item .name {
    font-weight: bold;
    color: #c53030;
    font-size: 1em;
}

.leave-item .reason {
    color: #718096;
    margin-top: 4px;
    font-size: 0.85em;
}

.leave-item .days {
    color: #4299e1;
    margin-top: 4px;
    font-size: 0.85em;
    font-weight: 500;
}

.leave-item .return-date {
    color: #38a169;
    margin-top: 4px;
    font-size: 0.85em;
    font-weight: 600;
    background: #f0fff4;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 6px;
}

@media (min-width: 768px) {
    .today-leave-list {
        min-height: 150px;
    }
    
    .leave-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .leave-item .name {
        font-size: 1.1em;
    }
    
    .leave-item .reason,
    .leave-item .days {
        margin-top: 5px;
        font-size: 0.9em;
    }
    
    .leave-item .return-date {
        font-size: 0.9em;
        padding: 5px 10px;
        margin-top: 8px;
    }
}

.empty-state {
    text-align: center;
    color: #a0aec0;
    padding: 20px;
    font-size: 0.95em;
}

canvas {
    max-height: 250px;
    width: 100% !important;
    height: auto !important;
}

@media (min-width: 768px) {
    .empty-state {
        padding: 40px;
        font-size: 1.1em;
    }
    
    canvas {
        max-height: 300px;
    }
}

.delete-btn {
    background: #fc8181;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
}

.delete-btn:hover {
    background: #f56565;
}

@media (min-width: 768px) {
    .delete-btn {
        padding: 5px 10px;
        font-size: 0.9em;
    }
}

/* 滚动条美化 */
.student-list::-webkit-scrollbar,
.leave-form::-webkit-scrollbar {
    width: 6px;
}

.student-list::-webkit-scrollbar-track,
.leave-form::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.student-list::-webkit-scrollbar-thumb,
.leave-form::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.student-list::-webkit-scrollbar-thumb:hover,
.leave-form::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .upload-btn,
    .btn-secondary,
    .btn-template,
    .delete-btn {
        padding: 12px 16px;
        font-size: 1em;
    }
    
    .form-group input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
}
