:root {
    --slot-width: 17px; /* 5分钟 = 17px 以适应容器 */
    --box-height: 50px;
    --color-bg: #f8f9fa;
    --color-text: #212529;
    --color-primary: #0d6efd;
    --color-normal: #e7f1ff;
    --color-normal-border: #0d6efd;
    --color-normal-text: #0d6efd;
    
    --color-short: #d3f9d8; /* <= 15分钟 绿色 */
    --color-short-border: #2b8a3e;
    --color-short-text: #2b8a3e;

    --color-medium: #e7f1ff; /* <= 30分钟 蓝色 (默认) */
    --color-medium-border: #0d6efd;
    --color-medium-text: #0d6efd;

    --color-long: #fff3bf; /* <= 60分钟 黄色 */
    --color-long-border: #f08c00;
    --color-long-text: #e67700;
    
    --color-extra: #eebefa; /* > 60分钟 紫色 */
    --color-extra-border: #9c36b5;
    --color-extra-text: #9c36b5;

    --color-important: #fff0f0;
    --color-important-border: #dc3545;
    --color-important-text: #dc3545;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--color-bg);
    margin: 0;
    padding: 30px;
    color: var(--color-text);
}
.container {
    width: 1400px;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}
h2 { margin: 0; font-weight: 600; color: #333; }

button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}
button:hover { background-color: #0b5ed7; }

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
}
.palette {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    background: #f1f3f5;
    border-radius: 8px;
    align-items: center;
}
.palette span { font-size: 13px; color: #666; font-weight: 500; }

/* User Menu */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid #ddd;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.user-menu-btn:hover {
    background-color: #f8f9fa;
    color: var(--color-primary);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
    border: 1px solid #eee;
    z-index: 1000;
    padding: 5px 0;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    color: var(--color-text);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background-color: #f8f9fa;
    color: var(--color-primary);
}

.dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 5px 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    min-width: 80px;
}

.draggable-source {
    height: 36px;
    border: 1px solid var(--color-normal-border);
    background: var(--color-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-size: 13px;
    user-select: none;
    border-radius: 6px;
    color: var(--color-normal-text);
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.draggable-source:active { cursor: grabbing; }
.w-5 { width: 25px; }
.w-10 { width: 35px; }
.w-15 { width: 45px; } 
.w-30 { width: 60px; }
.w-60 { width: 120px; }

.timeline-container {
    position: relative;
    overflow-x: hidden; /* 防止滚动条 */
    padding-bottom: 20px;
}

.time-labels {
    display: flex;
    height: 40px; /* 增加双标签的高度 */
    margin-bottom: 15px;
    position: relative;
    /* min-width: 1200px; 已移除 */
}
.time-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 11px;
    color: #868e96;
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
}
.time-label::after {
    content: '';
    position: absolute;
    top: 30px; /* 已调整 */
    left: 50%;
    width: 1px;
    height: 5px;
    background: #dee2e6;
}

.day-block {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: background-color 0.3s;
}
@keyframes highlight-pulse {
    0% { box-shadow: 0 0 15px rgba(13, 110, 253, 0.5); border-color: #0d6efd; }
    50% { box-shadow: 0 0 25px rgba(13, 110, 253, 0.3); border-color: #0d6efd; }
    100% { box-shadow: 0 2px 8px rgba(0,0,0,0.02); border-color: #eee; }
}
.day-block.highlight {
    animation: highlight-pulse 10s ease-out;
}
.day-header {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.day-header::before {
    content: '';
    display: block;
    width: 4px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 2px;
}

.track-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    margin-top: 25px; /* 时间标签的空间 */
}
.track-time-label {
    position: absolute;
    top: -18px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #adb5bd;
    pointer-events: none;
    white-space: nowrap;
}
.track-time-label.hour-mark {
    font-weight: 700;
    color: #495057;
    font-size: 11px;
    top: -20px;
}
.track-label {
    width: 60px;
    font-size: 12px;
    color: #868e96;
    font-weight: 500;
    text-align: right;
    padding-right: 15px;
    flex-shrink: 0;
}
.timeline-track {
    position: relative;
    height: var(--box-height);
    /* 
       图层 1: 30分钟线 (包含小时线)。颜色明显。 
       图层 2: 5分钟线。颜色微弱。
    */
    background-image: 
        linear-gradient(to right, #ced4da 1px, transparent 1px),
        linear-gradient(to right, #f1f3f5 1px, transparent 1px);
    background-size: 
        calc(var(--slot-width) * 6) 100%, 
        var(--slot-width) 100%;
    background-color: #fdfdfd;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    flex-grow: 1;
}
.timeline-track.pm-track {
    background-color: #fafafa;
}

.timebox {
    position: absolute;
    top: 3px;
    bottom: 3px;
    border-radius: 6px;
    border-width: 1px;
    border-style: solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px; /* 从 16px 减小以容纳更多文本 */
    box-sizing: border-box;
    user-select: none;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
    padding: 0 1px; /* 最小内边距 */
    font-weight: 800;
    z-index: 2;
    letter-spacing: -0.5px; /* 紧凑文本 */
}
.timebox .resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    z-index: 15;
    opacity: 0; /* 默认隐藏 */
}
.timebox:hover .resize-handle {
    opacity: 0.5; /* 悬停显示 */
    background: rgba(0,0,0,0.1);
}
.timebox .resize-handle.left { left: 0; }
.timebox .resize-handle.right { right: 0; }

.timebox-content {
    width: auto;
    max-width: calc(100% - 8px); /* 留出左右拖拽空间 */
    margin: 0 auto; /* 居中 */
    display: block;
    white-space: normal; /* 允许文本换行 */
    text-align: center;
    line-height: 1.1; /* 紧凑行高 */
    word-break: break-word; /* 打断长单词 */
    overflow-wrap: break-word;
    max-height: 100%;
    overflow: hidden;
}
.timebox:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 5;
}
.timebox:active {
    cursor: grabbing;
    z-index: 10;
}
.timebox.dur-short {
    background-color: var(--color-short);
    border-color: var(--color-short-border);
    color: var(--color-short-text);
}
.timebox.dur-medium {
    background-color: var(--color-medium);
    border-color: var(--color-medium-border);
    color: var(--color-medium-text);
}
.timebox.dur-long {
    background-color: var(--color-long);
    border-color: var(--color-long-border);
    color: var(--color-long-text);
}
.timebox.dur-extra {
    background-color: var(--color-extra);
    border-color: var(--color-extra-border);
    color: var(--color-extra-text);
}

.timebox.important {
    background-color: var(--color-important) !important;
    border-color: var(--color-important-border) !important;
    color: var(--color-important-text) !important;
    font-weight: 800;
}

.timebox.completed {
    opacity: 0.8;
    border-style: dashed;
}
.timebox.completed::after {
    content: '✓';
    position: absolute;
    left: auto;
    right: 5px;
    bottom: 2px;
    transform: none;
    font-weight: bold;
    font-size: 18px;
    color: inherit;
    pointer-events: none;
}

.timebox.postponed {
    opacity: 0.8;
    border-style: dotted;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.05) 5px,
        rgba(0,0,0,0.05) 10px
    );
}
.timebox.postponed::after {
    content: '»';
    position: absolute;
    left: auto;
    right: 5px;
    bottom: 2px;
    transform: none;
    font-weight: bold;
    font-size: 18px;
    color: inherit;
}

/* Status Buttons */
.status-selector {
    display: flex;
    gap: 10px;
}
.status-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    transition: all 0.2s;
}
.status-btn:hover {
    background: #f8f9fa;
}
.status-btn.active-incomplete {
    background: #e9ecef;
    color: #495057;
    border-color: #ced4da;
    font-weight: 600;
}
.status-btn.active-completed {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
    font-weight: 600;
}
.status-btn.active-postponed {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
    font-weight: 600;
}

/* Modal Title Input */
#modalTitle {
    font-size: 18px;
    font-weight: 600;
    padding: 10px 12px;
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    z-index: 2000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 5px 0;
    min-width: 150px;
}
.context-menu.active {
    display: block;
}
.context-menu-item {
    padding: 8px 15px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.context-menu-item:hover {
    background-color: #f8f9fa;
    color: var(--color-primary);
}

/* Dark Mode Overrides */
body.dark-mode {
    --color-bg: #121212;
    --color-text: #e0e0e0;
    --color-primary: #3d8bfd;
    
    --color-normal: #102a44;
    --color-normal-border: #3d8bfd;
    --color-normal-text: #6ea8fe;
    
    --color-short: #0f2f12;
    --color-short-border: #46a758;
    --color-short-text: #75b798;

    --color-medium: #102a44;
    --color-medium-border: #3d8bfd;
    --color-medium-text: #6ea8fe;

    --color-long: #332b00;
    --color-long-border: #ffc107;
    --color-long-text: #ffca2c;
    
    --color-extra: #2a0a33;
    --color-extra-border: #d63384;
    --color-extra-text: #f783ac;

    --color-important: #2c0b0e;
    --color-important-border: #e35d6a;
    --color-important-text: #ea868f;
}

body.dark-mode .container,
body.dark-mode .day-block,
body.dark-mode .modal,
body.dark-mode .context-menu,
body.dark-mode .preset-list {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-color: #333;
}

body.dark-mode header,
body.dark-mode .legend,
body.dark-mode .preset-item {
    border-color: #333;
}

body.dark-mode h2, 
body.dark-mode h3,
body.dark-mode .day-header,
body.dark-mode .form-group label,
body.dark-mode .palette span,
body.dark-mode .context-menu-item {
    color: #e0e0e0;
}

body.dark-mode .context-menu-item:hover {
    background-color: #333;
}

/* Icons */
.icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: text-bottom;
    fill: currentColor;
    margin-right: 5px;
}
.user-menu-btn .icon {
    width: 1.4em;
    height: 1.4em;
}
.user-dropdown a {
    display: flex;
    align-items: center;
}

body.dark-mode .palette {
    background-color: #2c2c2c;
}

body.dark-mode .time-label {
    color: #adb5bd;
}

body.dark-mode .timeline-track {
    background-color: #252525;
    border-color: #444;
    background-image: 
        linear-gradient(to right, #444 1px, transparent 1px),
        linear-gradient(to right, #333 1px, transparent 1px);
}
body.dark-mode .timeline-track.pm-track {
    background-color: #2a2a2a;
}

body.dark-mode .form-group input[type="text"], 
body.dark-mode .form-group textarea {
    background-color: #2c2c2c;
    border-color: #444;
    color: #e0e0e0;
}

body.dark-mode .duration-btn,
body.dark-mode .importance-btn,
body.dark-mode .status-btn,
body.dark-mode .preset-item button {
    background-color: #2c2c2c;
    border-color: #444;
    color: #adb5bd;
}

body.dark-mode .duration-btn:hover,
body.dark-mode .importance-btn:hover,
body.dark-mode .status-btn:hover {
    background-color: #3a3a3a;
}

body.dark-mode .btn-secondary {
    background-color: #333;
    color: #e0e0e0;
}
body.dark-mode .btn-secondary:hover {
    background-color: #444;
}

body.dark-mode .btn-danger {
    background-color: #2c0b0e;
    color: #e35d6a;
    border-color: #842029;
}
body.dark-mode .btn-danger:hover {
    background-color: #4c1319;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body {
        padding: 0;
        background-color: var(--color-bg);
    }
    .container {
        width: 100%;
        border-radius: 0;
        padding: 15px 10px;
        box-shadow: none;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    .controls {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
    }
    .controls button {
        flex: 1;
        padding: 10px;
        min-width: 80px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .palette {
        width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
        overflow-x: auto;
    }
    .timeline-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        margin-right: -10px; /* Counteract padding */
        padding-right: 10px;
    }
    .day-block {
        min-width: 1000px; /* Force minimum width to trigger scroll */
        padding: 10px;
    }
    .track-row {
        margin-top: 35px; /* More space for labels */
    }
    .track-label {
        width: 40px; /* Smaller label width */
        font-size: 11px;
        padding-right: 5px;
    }
    .timeline-track {
        /* Width is set by JS, but ensure it doesn't shrink */
        flex-shrink: 0;
    }
    .timebox .resize-handle {
        width: 15px; /* Wider handles for touch */
        opacity: 0.3; /* Always visible slightly on mobile */
    }
    .modal {
        width: 90%;
        max-width: none;
        padding: 20px;
    }
    .modal-actions button {
        padding: 12px 20px;
        flex: 1;
    }
    /* Adjust context menu for touch */
    .context-menu {
        min-width: 150px;
    }
    .context-menu-item {
        padding: 12px 16px; /* Larger touch target */
    }
}

/* Calendar View Styles */
.calendar-container {
    display: none;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.calendar-container.active {
    display: block;
}
.calendar-header {
    /* Removed or reused for internal headers */
    display: none;
}
.calendar-month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    height: 30px;
}
.calendar-month-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}
.btn-sm {
    padding: 2px 8px;
    font-size: 12px;
    height: 24px;
    line-height: 1;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #eee;
    border: 1px solid #eee;
}
.calendar-cell {
    background: #fff;
    min-height: 80px; /* More compact */
    padding: 2px;
    position: relative;
}
.calendar-cell.other-month {
    background: #f9f9f9;
    color: #ccc;
}
.calendar-cell.today {
    background: #fff8e1;
}
.calendar-day-header {
    background: #f8f9fa;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}
.calendar-date-num {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}
.calendar-date-num span:last-child {
    margin-left: auto;
}
.calendar-holiday {
    font-size: 11px;
    color: #e35d6a;
    font-weight: bold;
    margin-right: 5px;
}
.calendar-holiday.red { color: #dc3545; }
.calendar-holiday.blue { color: #0d6efd; }
.calendar-holiday.purple { color: #6f42c1; }
.calendar-holiday.green { color: #198754; }
.calendar-holiday.orange { color: #fd7e14; }

/* Color Selector in Modal */
.color-selector {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}
.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    background-color: #ddd; /* Fallback */
}
.color-option.red { background-color: #dc3545; }
.color-option.blue { background-color: #0d6efd; }
.color-option.purple { background-color: #6f42c1; }
.color-option.green { background-color: #198754; }
.color-option.orange { background-color: #fd7e14; }
.color-option.default { 
    background: linear-gradient(135deg, #e35d6a 50%, #ddd 50%); 
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

body.dark-mode .color-option.selected {
    box-shadow: 0 0 0 2px #1e1e1e, 0 0 0 4px #fff;
}
.calendar-task {
    font-size: 10px; /* Compact */
    padding: 1px 3px;
    border-radius: 2px;
    background: #e9ecef;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    
    /* 2 items per row logic */
    flex: 0 0 calc(50% - 1px);
    max-width: calc(50% - 1px);
    box-sizing: border-box;
}
.calendar-tasks-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-content: flex-start;
}
.calendar-task.completed {
    background: #d4edda;
    color: #155724;
    text-decoration: line-through;
}
.calendar-task.important {
    border-left: 3px solid #dc3545;
}
.calendar-task.postponed {
    background: #fff3cd;
    color: #856404;
    border: 1px dotted #ffeeba;
}

body.dark-mode .calendar-container {
    background: #1e1e1e;
}
body.dark-mode .calendar-cell {
    background: #1e1e1e;
    border-color: #333;
}
body.dark-mode .calendar-grid {
    background: #333;
    border-color: #333;
}
body.dark-mode .calendar-day-header {
    background: #2c2c2c;
    color: #e0e0e0;
}
body.dark-mode .calendar-cell.other-month {
    background: #181818;
    color: #555;
}
body.dark-mode .calendar-cell.today {
    background: #2c2c2c;
    border: 1px solid #e35d6a;
}
body.dark-mode .calendar-task {
    background: #2c2c2c;
    color: #e0e0e0;
}
body.dark-mode .calendar-task.completed {
    background: #0f2f12;
    color: #75b798;
}
body.dark-mode .calendar-task.postponed {
    background: #332b00;
    color: #ffca2c;
    border-color: #ffc107;
}

/* Focus Mode */
body.focus-mode header,
body.focus-mode #calendarView,
body.focus-mode .legend,
body.focus-mode .view-btn-group,
body.focus-mode #btnViewSwitch {
    display: none !important;
}
body.focus-mode .container {
    background: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}
body.focus-mode #timelineView {
    display: block !important;
    margin-top: 20px;
}
body.focus-mode .day-block {
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}
body.focus-mode.dark-mode .day-block {
    background: #1e1e1e;
}
.view-btn.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}
.form-group input[type="text"], 
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}
.form-group textarea {
    height: 100px;
    resize: vertical;
}

.duration-selector {
    display: flex;
    gap: 10px;
}
.duration-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    transition: all 0.2s;
}
.duration-btn:hover {
    background: #f8f9fa;
}
.duration-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.importance-selector {
    display: flex;
    gap: 10px;
}
.importance-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    transition: all 0.2s;
}
.importance-btn:hover {
    background: #f8f9fa;
}
.importance-btn.active-normal {
    background: #e7f1ff;
    color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 600;
}
.importance-btn.active-important {
    background: #fff0f0;
    color: #dc3545;
    border-color: #dc3545;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}
.btn-secondary {
    background-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5c636a;
}
.btn-danger {
    background-color: #dc3545;
}
.btn-danger:hover {
    background-color: #bb2d3b;
}

.preset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.preset-tag {
    font-size: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}
.preset-tag:hover {
    background: #e9ecef;
    color: #333;
}

.preset-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}
.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}
.preset-item:last-child {
    border-bottom: none;
}
.preset-item button {
    background: #dc3545;
    padding: 4px 8px;
    font-size: 12px;
}
.preset-add-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.preset-add-row input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.preset-add-row button {
    padding: 8px 16px;
}
.legend {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #666;
    justify-content: center;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.site-footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px 0;
    font-size: 14px;
    color: var(--color-text);
    opacity: 0.6;
    border-top: 1px solid rgba(0,0,0,0.1);
}

body.dark-mode .site-footer {
    border-top-color: rgba(255,255,255,0.1);
}
