* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0078f5;
    --secondary-color: #f8f9fa;
    --border-color: #e1e5e9;
    --text-color: #333;
    --text-light: #666;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --priority-high: #dc3545;
    --priority-medium: #ffc107;
    --priority-low: #28a745;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --day-header-bg: linear-gradient(135deg, var(--secondary-color), #e9ecef);
    --day-header-hover-bg: linear-gradient(135deg, #e9ecef, #dee2e6);
    --day-header-today-bg: var(--day-header-bg);
}

[data-theme="dark"] {
    --primary-color: #4a9eff;
    --secondary-color: #1a1a1a;
    --border-color: #444;
    --text-color: #e1e5e9;
    --text-light: #aaa;
    --secondary-color-light: #2d2d2d;
    --shadow: 0 2px 4px rgba(255,255,255,0.1);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --priority-high: #f44336;
    --priority-medium: #ff9800;
    --priority-low: #4caf50;
    --day-header-bg: linear-gradient(135deg, #333, #2a2a2a);
    --day-header-hover-bg: linear-gradient(135deg, #3a3a3a, #333);
    --day-header-today-bg: var(--day-header-bg);
}

/* 深色主题专用样式 */
[data-theme="dark"] .header {
    background: var(--secondary-color-light);
    color: var(--text-color);
}

[data-theme="dark"] .task-cell {
    background: #2a2a2a;
}

[data-theme="dark"] .task-cell:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), rgba(74, 158, 255, 0.08));
}

[data-theme="dark"] .task-card {
    background: linear-gradient(135deg, #333, #2a2a2a);
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .task-card:hover {
    background: linear-gradient(135deg, #3a3a3a, #333);
}

[data-theme="dark"] .modal-content {
    background: var(--secondary-color-light);
    color: var(--text-color);
}

[data-theme="dark"] .form-control {
    background: #333;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary-color);
}

[data-theme="dark"] .properties-panel {
    background: var(--secondary-color-light);
    color: var(--text-color);
}



[data-theme="dark"] .time-label {
    background: linear-gradient(135deg, #333, #2a2a2a);
    color: var(--text-color);
}

[data-theme="dark"] .time-label:hover {
    background: linear-gradient(135deg, #3a3a3a, #333);
}

[data-theme="dark"] .drop-zone {
    border-color: var(--border-color);
    color: var(--text-light);
}

[data-theme="dark"] .drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 158, 255, 0.1);
}

[data-theme="dark"] .weekday-btn {
    background: #333;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

[data-theme="green"] {
    --primary-color: #28a745;
    --secondary-color: #f0f8f0;
    --border-color: #c3e6c3;
    --text-color: #2d5a2d;
    --text-light: #5a7a5a;
    --day-header-bg: linear-gradient(135deg, #d4edda, #c3e6cb);
    --day-header-hover-bg: linear-gradient(135deg, #c3e6cb, #b8dacc);
    --day-header-today-bg: var(--day-header-bg);
}

[data-theme="green"] .weekday-btn {
    background: white;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="green"] .weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 暗色主题标题样式 */
[data-theme="dark"] .table-title {
    color: var(--primary-color);
}

[data-theme="dark"] .table-title:hover {
    background: rgba(74, 158, 255, 0.1);
}

[data-theme="dark"] .table-title-input {
    background: #333;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .table-title-container {
    background: var(--secondary-color-light);
    border-bottom-color: var(--border-color);
}

/* 绿色主题标题样式 */
[data-theme="green"] .table-title {
    color: var(--primary-color);
}

[data-theme="green"] .table-title:hover {
    background: rgba(40, 167, 69, 0.1);
}

[data-theme="green"] .table-title-input {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="green"] .table-title-container {
    background: var(--secondary-color);
    border-bottom-color: var(--border-color);
}

/* 隐藏周末列的简化样式 - 只控制显示隐藏 */
.day-header[data-day="6"].hidden,
.task-cell[data-day="6"].hidden {
    display: none;
}

.day-header[data-day="7"].hidden,
.task-cell[data-day="7"].hidden {
    display: none;
}

/* 手机端隐藏周末时间标签 */
/* 超小屏幕优化 */
@media (max-width: 360px) {
    .weekly-grid {
        grid-template-columns: 35px 1fr 1fr 1fr !important;
        font-size: 8px !important;
    }
    
    .time-label {
        font-size: 8px !important;
        padding: 1px !important;
    }
    
    .task-cell {
        font-size: 8px !important;
        min-height: 50px !important;
        padding: 1px !important;
    }
}

@media (max-width: 480px) {
    /* 手机端隐藏周末元素 - 统一使用hidden类 */
    .time-label[data-mobile-day="6"].hidden,
    .time-label[data-mobile-day="7"].hidden,
    .task-cell[data-day="6"].hidden,
    .task-cell[data-day="7"].hidden {
        display: none !important;
    }
    
    /* 移动端隐藏类 - 完全移除元素，不占用空间 */
    .mobile-hidden {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    
    /* 隐藏晚上时段的相关元素 - 增强兼容性 */
    .day-header[data-day="3"].mobile-hidden,
    .day-header[data-day="3"][style*="display: none"],
    .task-cell[data-slot="EVENING"].mobile-hidden,
    .task-cell[data-slot="EVENING"][style*="display: none"] {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    
    /* 强制网格布局重新计算 - 浏览器兼容性增强 */
    .weekly-grid.evening-hidden {
        -ms-grid-columns: 45px 1fr 1fr !important;
        grid-template-columns: 45px 1fr 1fr !important;
    }
    
    .weekly-grid.evening-visible {
        -ms-grid-columns: 45px 1fr 1fr 1fr !important;
        grid-template-columns: 45px 1fr 1fr 1fr !important;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 100vh;
}

.header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 5px;
}

.title-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weekly-title {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    background: transparent;
    font-family: inherit;
    text-align: left;
}

.weekly-title:hover {
    background: rgba(0, 120, 245, 0.05);
    border-color: var(--primary-color);
}

.weekly-title:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

.weekly-title.editing {
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-display {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
}

.week-info {
    color: var(--text-light);
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 表格标题样式 */
.table-title-container {
    padding: 10px 20px 5px;
    text-align: center;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    display: inline-block;
    min-width: 200px;
}

.table-title:hover {
    background: rgba(0, 120, 245, 0.1);
    transform: translateY(-1px);
}

.table-title-input {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    text-align: center;
    min-width: 200px;
    outline: none;
}

.main-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.weekly-grid {
    display: grid;
    grid-template-columns: 150px repeat(7, 1fr);
    grid-template-rows: auto 1fr 1fr 1fr;
    min-height: 600px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: visible;
    box-shadow: var(--shadow);
}

.time-slot-header {
    background: var(--day-header-bg);
    color: var(--text-color);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1;
    grid-row: 1;
}

.day-header {
    background: var(--day-header-bg);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    font-size: 15px;
    color: var(--text-color);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-row: 1;
}

/* 移除固定定位，使用自然流布局 */

.day-header:hover {
    background: var(--day-header-hover-bg);
    transform: translateY(-1px);
}

.day-header.today {
    background: var(--day-header-today-bg);
    color: var(--text-color);
    font-weight: 700;
}

.time-label {
    background: linear-gradient(135deg, #f1f3f4, #e8eaed);
    padding: 20px 15px;
    text-align: center;
    font-weight: 600;
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    writing-mode: vertical-lr;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--text-color);
    letter-spacing: 1px;
    min-height: 160px;
    transition: all 0.3s ease;
    grid-column: 1;
}

/* 为时间标签设置明确的网格行位置 */
.time-label:nth-of-type(1) { grid-row: 2; }
.time-label:nth-of-type(2) { grid-row: 3; }
.time-label:nth-of-type(3) { grid-row: 4; }

.time-label:hover {
    background: linear-gradient(135deg, #e8eaed, #dadce0);
    transform: translateX(-2px);
}

.task-cell {
    border-right: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 15px;
    min-height: 160px;
    height: 100%;
    position: relative;
    overflow-y: auto;
    background: #fafbfc;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* 移除所有固定定位，使用自然流布局和JavaScript动态调整 */

.task-cell:hover {
    background: linear-gradient(135deg, rgba(0, 120, 245, 0.08), rgba(0, 120, 245, 0.04));
    box-shadow: inset 0 0 10px rgba(0, 120, 245, 0.1);
    transform: scale(1.02);
}

/* 自定义滚动条样式 */
.task-cell::-webkit-scrollbar {
    width: 6px;
}

.task-cell::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.task-cell::-webkit-scrollbar-thumb {
    background: rgba(0, 120, 245, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.task-cell::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 120, 245, 0.5);
}

.task-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.task-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px) scale(1.02);
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.task-cell.drag-over {
    background-color: rgba(0, 123, 255, 0.1) !important;
    border: 2px dashed var(--primary-color) !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.task-card.done {
    opacity: 0.6;
    text-decoration: line-through;
}

.task-card.high-priority {
    border-left: 3px solid var(--priority-high);
}

.task-card.medium-priority {
    border-left: 3px solid var(--priority-medium);
}

.task-card.low-priority {
    border-left: 3px solid var(--priority-low);
}

.task-checkbox {
    margin-right: 5px;
    cursor: pointer;
}

.task-title {
    font-weight: bold;
    margin-bottom: 2px;
    word-break: break-word;
}

.task-time {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.task-note {
    font-size: 11px;
    color: var(--text-light);
    word-break: break-word;
}

.task-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity 0.3s;
}

.task-card:hover .task-actions {
    opacity: 1;
}

.delete-btn {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.delete-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.add-task-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 120, 245, 0.3);
}

.task-cell:hover .add-task-btn {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 120, 245, 0.4);
}

.properties-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.properties-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

/* 统一时间输入框和备注文本框的字体样式 */
input[type="time"].form-control,
textarea.form-control {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

/* 确保备注文本框的字体一致性 */
#taskNote {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.priority-selector {
    display: flex;
    gap: 5px;
}

.priority-btn {
    flex: 1;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.priority-btn.active {
    background: var(--primary-color);
    color: white;
}

.repeat-selector {
    display: flex;
    gap: 5px;
}

.repeat-btn {
    flex: 1;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.repeat-btn.active {
    background: var(--primary-color);
    color: white;
}

.weekday-selector {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.weekday-btn {
    flex: 1;
    min-width: 50px;
    padding: 5px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

.weekday-btn.active {
    background: var(--primary-color);
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* CSV导入弹窗特殊样式 */
#importModal .modal-content {
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

#importModal .modal-body {
    max-height: calc(80vh - 140px);
    overflow: visible;
}

#importModal #importPreview {
    max-height: 200px;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.theme-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
}

.theme-btn.active {
    border-color: var(--primary-color);
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    margin-bottom: 15px;
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 120, 245, 0.1);
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .weekly-grid {
        grid-template-columns: 80px repeat(7, 1fr);
        grid-template-rows: auto 1fr 1fr 1fr;
        font-size: 12px;
        min-height: 500px;
    }
    
    /* 移动端网格布局将由JavaScript动态调整 */

    .time-label {
        padding: 15px 8px;
        font-size: 14px;
        min-height: 120px;
    }

    .task-cell {
        padding: 8px;
        min-height: 120px;
        height: 100%;
    }

    .day-header, .time-slot-header {
        padding: 12px 6px;
        font-size: 12px;
    }

    .task-card {
        padding: 8px;
        font-size: 12px;
        margin-bottom: 6px;
    }

    .add-task-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
        bottom: 6px;
        right: 6px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        text-align: center;
    }

    .weekly-title {
        font-size: 1.5em;
        text-align: center;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .weekly-grid {
        grid-template-columns: 80px repeat(7, 1fr);
        grid-template-rows: auto 1fr 1fr 1fr;
        height: calc(100vh - 250px);
        min-height: 500px;
        font-size: 12px;
    }
    
    /* 小屏幕网格布局将由JavaScript动态调整 */

    .time-slot-header,
    .day-header {
        padding: 8px 4px;
        font-size: 11px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .time-label {
        padding: 15px 4px;
        font-size: 11px;
        min-height: 120px;
    }

    .task-cell {
        padding: 6px;
        min-height: 120px;
        height: 100%;
    }

    .task-card {
        padding: 6px;
        font-size: 11px;
        margin-bottom: 4px;
    }

    .task-title {
        font-size: 11px;
    }

    .task-time {
        font-size: 9px;
    }

    .add-task-btn {
        width: 20px;
        height: 20px;
        font-size: 12px;
        bottom: 4px;
        right: 4px;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    .container {
        padding: 5px;
        gap: 5px;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .header {
        padding: 8px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }

    .header-info {
        justify-content: center;
        gap: 10px;
        margin-bottom: 8px;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .weekly-title {
        font-size: 1.2em;
        text-align: center;
    }

    /* 手机端专用网格布局：横向为时间段，纵向为星期 */
    .weekly-grid {
        display: grid !important;
        /* 网格模板由JavaScript动态设置 */
        height: auto !important;
        min-height: 400px !important;
        max-height: none !important;
        font-size: 10px !important;
        gap: 1px !important;
        border: 1px solid var(--border-color) !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        grid-auto-rows: minmax(auto, max-content) !important;
    }

    /* 手机端标题行重新布局 - 顶部显示时间段 */
    .time-slot-header {
        grid-column: 1 !important;
        grid-row: 1 !important;
        padding: 6px 2px !important;
        font-size: 10px !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        min-height: auto !important;
        height: 35px !important;
    }

    /* 手机端时间段标题 - 上午、下午、晚上 */
    .day-header[data-day="1"] {
        grid-column: 2 !important;
        grid-row: 1 !important;
        padding: 6px 2px !important;
        font-size: 10px !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        min-height: auto !important;
        height: 35px !important;
    }

    .day-header[data-day="2"] {
        grid-column: 3 !important;
        grid-row: 1 !important;
        padding: 6px 2px !important;
        font-size: 10px !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        min-height: auto !important;
        height: 35px !important;
    }

    .day-header[data-day="3"] {
        grid-column: 4 !important;
        grid-row: 1 !important;
        padding: 6px 2px !important;
        font-size: 10px !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        min-height: auto !important;
        height: 35px !important;
    }

    /* 隐藏多余的星期标题 */
    .day-header[data-day="4"],
    .day-header[data-day="5"],
    .day-header[data-day="6"],
    .day-header[data-day="7"] {
        display: none;
    }

    /* 手机端时间标签变为星期标签 */
    .time-label {
        grid-column: 1 !important;
        padding: 2px 1px !important;
        font-size: 9px !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        min-height: auto !important;
        height: auto !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        word-break: keep-all !important;
        white-space: nowrap !important;
    }

    /* 时间标签的grid-row由JavaScript动态设置 */
    .time-label {
        grid-column: 1 !important;
        /* grid-row由JavaScript动态控制 */
    }

    /* 手机端任务单元格重新定位 */
    .task-cell {
        padding: 2px !important;
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
        font-size: 9px !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        flex-grow: 1 !important;
        align-content: flex-start !important;
    }

    /* 手机端任务单元格布局由JavaScript动态设置 */
    .task-cell {
        /* 移除固定的grid-row设置，让JavaScript动态控制 */
    }

    .task-card {
        padding: 4px;
        font-size: 10px;
        margin-bottom: 2px;
        height: auto !important;
        min-height: auto !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.3;
    }

    .task-title {
        font-size: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.2;
    }

    .task-time {
        font-size: 9px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .task-note {
        font-size: 9px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.2;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .modal-content {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        width: calc(100% - 40px) !important;
        max-width: 90vw !important;
        max-height: calc(100vh - 40px) !important;
        overflow-y: auto;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-control {
        padding: 8px;
        font-size: 14px;
    }
}

/* 桌面端和移动端文本控制 */
.mobile-text {
    display: none;
}

.desktop-text {
    display: inline;
}

.mobile-only {
    display: none;
}

@media (max-width: 480px) {
    .mobile-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .desktop-text {
        display: none;
    }
    
    .mobile-only {
        display: flex;
    }
    
    /* 手机端时间范围样式 */
    .mobile-time-range {
        font-size: 8px;
        color: #666;
        margin-top: 2px;
        line-height: 1;
        font-weight: normal;
    }
    
    /* 移动端时间标签重新定位 - 现在按照新的布局逻辑 */
    .time-label:nth-of-type(1) { 
        grid-row: 2 !important;
        grid-column: 1 !important;
    }
    .time-label:nth-of-type(2) { 
        grid-row: 3 !important;
        grid-column: 1 !important;
    }
    .time-label:nth-of-type(3) { 
        grid-row: 4 !important;
        grid-column: 1 !important;
    }
    .time-label.mobile-only:nth-of-type(4) { 
        grid-row: 5 !important;
        grid-column: 1 !important;
    }
    .time-label.mobile-only:nth-of-type(5) { 
        grid-row: 6 !important;
        grid-column: 1 !important;
    }
    .time-label.mobile-only:nth-of-type(6) { 
        grid-row: 7 !important;
        grid-column: 1 !important;
    }
    .time-label.mobile-only:nth-of-type(7) { 
        grid-row: 8 !important;
        grid-column: 1 !important;
    }
}

/* 导出下拉菜单样式 */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: '▼';
    margin-left: 8px;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown-toggle.active::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--secondary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* 导出日期选择按钮样式 */
.export-day-btn {
    flex: 1;
    min-width: 50px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 14px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    color: var(--text-color);
}

.export-day-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.export-day-btn.selected {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* 深色主题下的导出按钮样式 */
[data-theme="dark"] .export-day-btn {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .export-day-btn:hover {
    background: #374151;
    border-color: var(--primary-color);
}

[data-theme="dark"] .export-day-btn.selected {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* 深色主题适配 */
[data-theme="dark"] .dropdown-menu {
    background: var(--secondary-color-light);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-color);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #3a3a3a;
}

[data-theme="dark"] .dropdown-divider {
    background-color: var(--border-color);
}
