:root {
    /* WORK 模式默认变量 */
    --bg-color: #F7F7F5;
    --card-bg: #FFFFFF;
    --text-main: #37352F;
    --text-sec: #787774;
    --border: #E0E0DE;
    --primary: #2e81f5;
    --life-primary: #588157; /* Life 模式：森林绿/复古绿 */
    --life-bg: #fdfcf8;      /* Life 模式：米色纸张感 */
    --ai-color: #722ED1;
    --danger: #EB5757;
    --success: #27AE60;
    --focus-bg: #fff7e6;
    --focus-border: #ffd591;
    --column-width: 260px;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(0,0,0,0.06);
    --drawer-width: 320px;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: "Georgia", "Times New Roman", "Songti SC", serif;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s ease; /* 平滑过渡背景 */
}

/* --- Life 模式专属样式 (Leisure Style) --- */
body.mode-life {
    --bg-color: var(--life-bg);
    --primary: var(--life-primary);
    --radius: 12px; /* 更圆润的圆角 */
    --shadow: 0 4px 12px rgba(0,0,0,0.03); /* 更柔和的阴影 */
    background-image: radial-gradient(#e8e6df 1px, transparent 1px);
    background-size: 20px 20px; /* 点阵背景，手账感 */
}

body.mode-life .column-header {
    font-family: var(--font-serif); /* 标题使用衬线体 */
    font-size: 15px;
    font-style: italic;
    color: #5a6c5a;
}

body.mode-life .today-col {
    background: linear-gradient(to bottom, rgba(88, 129, 87, 0.08), transparent); /* 森林绿渐变 */
    border-radius: 16px 16px 0 0;
}

body.mode-life .card {
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02), 0 0 0 1px rgba(0,0,0,0.03);
}

body.mode-life .divider-line {
    background: #d4d1c9;
    height: 1px;
}

body.mode-life button {
    border-radius: 20px; /* 胶囊按钮 */
}

/* --- Header --- */
header {
    background: var(--card-bg);
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 20;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 标题切换样式 */
.app-title-container {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}
.app-title-container:hover { background: rgba(0,0,0,0.05); }
h1 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text-main); display:flex; align-items:center; gap:6px;}
.mode-badge {
    font-size: 10px; color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.date-controls { display: flex; align-items: center; gap: 4px; background: #f0f0f0; padding: 4px 8px; border-radius: 6px; }
body.mode-life .date-controls { background: #efeFEA; }

.date-input { border: none; background: transparent; font-family: inherit; font-size: 12px; color: var(--text-main); width: 100px; cursor: pointer;}
.nav-btn { background: transparent; border: none; cursor: pointer; color: #666; padding: 2px 4px; border-radius: 4px; display: flex; align-items: center;}
.nav-btn:hover { background: rgba(0,0,0,0.05); color: var(--primary); }
.reset-btn { font-size: 12px; padding: 2px 8px; background: white; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; color: var(--primary); font-weight: 500; margin-left: 8px;}

.header-right { display: flex; gap: 8px; align-items: center; }

button {
    border: 1px solid var(--border); background: white; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 5px; transition: all 0.2s; color: var(--text-main);
}
button:hover { background: #f7f7f5; border-color: #ccc; }
button.primary { background: var(--text-main); color: white; border-color: var(--text-main); }
button.primary:hover { opacity: 0.9; }
.ai-btn { border-color: var(--ai-color); color: var(--ai-color); font-weight: 500; }
.ai-btn:hover { background: #f9f0ff; }
.backlog-btn { border-color: var(--primary); color: var(--primary); font-weight: 500; }
.backlog-btn.active { background: var(--primary); color: white; }

/* --- Board --- */
.board-container {
    flex: 1; overflow-x: auto; overflow-y: hidden; padding: 20px 20px 0 20px; display: flex; gap: 12px; align-items: flex-start;
}

.column {
    min-width: var(--column-width); max-width: var(--column-width); display: flex; flex-direction: column; height: 100%; padding-bottom: 20px; transition: min-width 0.3s ease;
}

/* 2x Width for Today */
.column.today-col {
    min-width: calc(var(--column-width) * 2);
    max-width: calc(var(--column-width) * 2);
    background: linear-gradient(to bottom, rgba(46,129,245,0.02), transparent);
    border-radius: 8px 8px 0 0;
}

.week-start { border-left: 2px dashed #E0E0DE; padding-left: 20px; margin-left: 10px; }
body.mode-life .week-start { border-left-style: dotted; border-color: #ccc; }

.column-header {
    padding: 8px 4px; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-sec); display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid transparent;
}
.column-header.today { color: var(--text-main); border-bottom-color: var(--primary); }
.column-header .date-sub { font-weight: 400; font-size: 11px; margin-left:4px; color: #999; }
.header-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn { opacity: 0.6; transition: opacity 0.2s; cursor: pointer; color: var(--text-main); padding: 4px; border-radius: 4px; }
.column:hover .icon-btn { opacity: 1; }
.icon-btn:hover { background: #eee; }
.summary-btn { color: #F59E0B; } 

.task-list { flex: 1; overflow-y: auto; padding: 4px; padding-bottom: 60px; transition: background 0.2s; }
.task-list.drag-over { background: rgba(0,0,0,0.02); border-radius: 6px; }

/* --- Card & Divider --- */
.card {
    background: var(--card-bg); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); border: 1px solid transparent; cursor: grab; transition: all 0.2s; user-select: none; position: relative;
}
.card:active { cursor: grabbing; }
.card:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.08); transform: translateY(-1px); border-color: #ddd;}
.card.on-it { background: var(--focus-bg); border-left: 3px solid var(--focus-border); }
body.mode-life .card.on-it { border-left-width: 0; background: #fffcf0; border: 1px solid #eaddcf; }

.card.completed { opacity: 0.6; background: #f4f4f4; border-left: none; }
.card.completed .card-title { text-decoration: line-through; color: #999; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; color: #333; }
.card-title { font-size: 13px; line-height: 1.4; margin-bottom: 6px; color: var(--text-main); font-weight: 500; }
.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; border-top: 1px solid #f7f7f5; font-size: 10px; color: #ccc; }
.log-indicator.has-logs { color: var(--primary); }
.defer-indicator { position: absolute; top: 4px; right: 4px; font-size: 14px; color: var(--primary); }

/* 周期性任务标记 */
.recurring-icon { font-size: 10px; margin-right: 4px; color: var(--primary); }

/* Divider */
.divider-card {
    height: 24px; margin: 8px 0; display: flex; align-items: center; justify-content: center; cursor: grab; user-select: none; background: transparent;
}
.divider-line {
    height: 2px; background: #E0E0DE; width: 100%; border-radius: 2px; position: relative;
}
.divider-label {
    position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--bg-color); padding: 0 8px; font-size: 10px; color: #999; font-weight: 600; text-transform: uppercase;
}

/* --- Drawers & Modals --- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.1); z-index: 90; display: none; pointer-events: none; }
.drawer-overlay.open { display: block; }
.drawer { position: fixed; top: 55px; right: -350px; bottom: 0; width: var(--drawer-width); background: #fdfdfd; border-left: 1px solid var(--border); box-shadow: -2px 0 10px rgba(0,0,0,0.05); z-index: 100; transition: right 0.3s ease; display: flex; flex-direction: column; pointer-events: auto; }
.drawer.open { right: 0; }
.drawer-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; background: #fafafa; }
.drawer-content { flex: 1; overflow-y: auto; padding: 12px; background: repeating-linear-gradient(45deg, #fdfdfd, #fdfdfd 10px, #f7f7f7 10px, #f7f7f7 20px); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: none; justify-content: center; align-items: center; z-index: 2000; }
.modal { background: white; padding: 24px; border-radius: 8px; width: 480px; max-width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column;}
body.mode-life .modal { border-radius: 16px; box-shadow: 0 10px 40px rgba(88, 129, 87, 0.15); }

.modal h2 { margin-top: 0; font-size: 16px; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; flex-shrink: 0;}
body.mode-life .modal h2 { font-family: var(--font-serif); color: var(--life-primary); font-style: italic;}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sec); margin-bottom: 5px; }
.form-group input:not([type="checkbox"]):not([type="file"]):not([type="color"]), .form-group select, .form-group textarea { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box; font-family: inherit; font-size: 13px; }
.btn-close { color: #999; cursor: pointer; float:right; }

#summaryContent { font-size: 13px; line-height: 1.6; color: #333; white-space: pre-wrap; min-height: 100px; }

.context-menu { position: fixed; background: white; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 6px; padding: 4px; width: 140px; z-index: 1000; display: none; }
.context-menu-item { padding: 8px 12px; font-size: 13px; color: var(--text-main); cursor: pointer; border-radius: 4px; display: flex; align-items: center; gap: 8px; }
.context-menu-item:hover { background: #f0f0f0; }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.on-it-active { color: #d46b08; font-weight: 500; }

.tag-add-row { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; }
.color-palette { display: flex; gap: 6px; align-items: center; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.selected { border-color: #333; box-shadow: 0 0 0 1px white inset; }
.tag-item-row { display: flex; justify-content: space-between; align-items: center; background: white; padding: 6px 10px; border-radius: 4px; border: 1px solid #eee; margin-bottom:6px;}

/* 让同步图标转圈圈的动画 */
.sync-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}
@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

.ai-loading { display: none; text-align: center; color: var(--ai-color); margin-top: 10px; font-size: 13px; }
.ai-loading i { animation: spin 1s linear infinite; }

/* --- Floating AI Button --- */
.float-ai-btn {
    position: fixed; bottom: 20px; right: 20px; 
    width: 48px; height: 48px; border-radius: 50%; 
    background: var(--ai-color); color: white; 
    box-shadow: 0 4px 12px rgba(114, 46, 209, 0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; cursor: pointer; z-index: 1000;
    transition: transform 0.2s;
}
.float-ai-btn:hover { transform: scale(1.1); }

.chat-history {
    height: 300px; overflow-y: auto; border: 1px solid #eee; 
    border-radius: 4px; padding: 10px; margin-bottom: 10px; 
    background: #fafafa; font-size: 13px;
}
.chat-msg { margin-bottom: 10px; }
.chat-msg.user { text-align: right; color: var(--primary); }
.chat-msg.ai {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

/* Recurring List in Modal */
.rule-item { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px; border: 1px solid #eee; margin-bottom: 6px; border-radius: 4px;
}
.week-selector { display: flex; gap: 4px; margin-top: 4px; }
.week-day-btn {
    font-size: 10px; width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid #ddd; background: white; cursor: pointer; display: flex; justify-content: center; align-items: center;
}
.week-day-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }


/* ==========================================================================
   📱 Mobile Responsiveness (Added in v5.4.2)
   ========================================================================== */
@media screen and (max-width: 768px) {
    
    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 16px;
        gap: 10px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .date-controls {
        flex: 1;
        justify-content: flex-end;
    }
    
    .date-input { width: 85px; font-size: 11px; }

    .header-right {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }
    
    .header-right::-webkit-scrollbar { display: none; }
    
    .board-container {
        padding: 10px 16px 0 16px;
        scroll-snap-type: x mandatory;
        gap: 16px;
    }
    
    .column {
        min-width: 88vw;
        max-width: 88vw;
        scroll-snap-align: center;
    }
    
    .column.today-col {
        min-width: 88vw; 
        max-width: 88vw;
        background: linear-gradient(to bottom, rgba(46,129,245,0.05), transparent);
    }
    
    .modal {
        width: 92%;
        max-height: 85vh;
        margin: auto;
    }
    
    .drawer {
        width: 85%;
        right: -100%;
    }
    
    .icon-btn { opacity: 0.8; padding: 6px; } 
    .card { padding: 14px 12px; }
    
    .float-ai-btn {
        bottom: 30px; 
        right: 16px;
        width: 52px; 
        height: 52px;
    }
    
    .form-group input, .form-group select, .form-group textarea {
        font-size: 16px;
    }

    .view-toggle-group { display: none; }
    .search-box { min-width: 120px !important; }
    
    /* 周视图/月视图手机适配 */
    .week-view-container { padding: 10px !important; }
    .week-grid { gap: 4px !important; }
    .week-col-header { font-size: 10px !important; }
    .week-cell-task { font-size: 9px !important; padding: 2px 3px !important; }
    
    .month-view-container { padding: 10px !important; }
    .month-grid { gap: 2px !important; }
    .month-cell { min-height: 60px !important; padding: 3px !important; }
    .month-cell-date { font-size: 10px !important; }
    .month-task-dot { width: 5px !important; height: 5px !important; }
}

/* --- History Modal Styles --- */
.history-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    position: relative;
    transition: all 0.2s;
}

.history-item:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-color: #ddd;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.history-time {
    font-size: 12px;
    color: #999;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-delete-btn {
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.history-delete-btn:hover {
    color: var(--danger);
    background: rgba(235, 87, 87, 0.1);
}

.history-content {
    font-size: 13px;
    line-height: 1.6;
    color: #444;
    white-space: pre-wrap;
}

.history-btn {
    color: #666;
    margin-right: 4px;
}
.history-btn:hover {
    color: var(--primary);
    background: #eee;
}

/* --- Feature: Subtasks --- */

.subtask-wrapper {
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px dashed rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subtask-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
    color: #555;
    width: 92%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.subtask-card:hover {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.subtask-card.completed {
    text-decoration: line-through;
    color: #bbb;
    background: #f4f4f4;
    border-color: transparent;
}

.subtask-check {
    width: 12px;
    height: 12px;
    border: 1px solid #ccc;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
}

.subtask-card.completed .subtask-check {
    background: #ccc;
    border-color: #ccc;
}
.subtask-card.completed .subtask-check::after {
    content: '✔';
    color: white;
    font-size: 8px;
    line-height: 1;
}

/* 弹窗里的编辑行样式 */
.modal-subtask-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.modal-subtask-check {
    cursor: pointer;
    width: 16px; 
    height: 16px;
    margin: 0;
}

#taskModalOverlay .modal-subtask-input {
    flex: 1 1 0% !important; 
    width: 0 !important; 
    min-width: 0 !important; 
    font-size: 13px !important;
    padding: 8px 10px !important;
    border: 1px solid #E0E0DE !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    color: #333 !important;
    outline: none;
    height: auto !important;
    box-shadow: none;
    transition: all 0.2s;
}

#taskModalOverlay .modal-subtask-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(46, 129, 245, 0.1) !important;
}

.modal-subtask-row .btn-close {
    color: #EB5757; 
    font-size: 18px; 
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 4px;
}
.modal-subtask-row .btn-close:hover {
    opacity: 1;
    background: rgba(235, 87, 87, 0.1);
    border-radius: 4px;
}

/* --- Feature: Emoji Status --- */

.status-btn-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.status-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid #eee;
    background: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.status-btn:hover {
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.status-btn.selected {
    background: #e6f7ff;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.card.status-cancelled {
    opacity: 0.7;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
}
.card.status-cancelled .card-title {
    text-decoration: line-through;
    color: #999;
}
.card.status-cancelled .tag {
    filter: grayscale(1);
    opacity: 0.6;
}

.card.status-urgent {
    border-left: 3px solid #ff4d4f !important;
}

/* --- Feature: Reminder --- */
.reminder-indicator {
    font-size: 11px;
    color: #F59E0B;
    display: flex;
    align-items: center;
    gap: 2px;
    background: #fff7e6;
    padding: 1px 4px;
    border-radius: 4px;
    margin-right: 4px;
}

/* --- Feature: Copy Task Modal --- */
#copyTaskModalOverlay input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* --- Feature: Tentative Divider & Collapsible Column --- */

.divider-card.tentative .divider-line {
    background: repeating-linear-gradient(to right, #E0E0DE 0, #E0E0DE 4px, transparent 4px, transparent 8px);
    height: 1px;
}
.divider-card.tentative .divider-label {
    color: #bbb;
    font-style: italic;
    font-size: 9px;
}

.task-list {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 2000px;
    opacity: 1;
}

.task-list.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    flex: 0;
    overflow: hidden;
}

.column-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-radius: 6px;
}
.column-header:hover {
    background: rgba(0,0,0,0.02);
}

/* --- Feature: Subtask Sorting & Numbering (Modal) --- */

#modalSubtaskList {
    counter-reset: subtask-counter;
}

.modal-subtask-row::before {
    counter-increment: subtask-counter;
    content: counter(subtask-counter);
    width: 18px;
    height: 18px;
    background: #e6f7ff;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    flex-shrink: 0;
}

.subtask-sort-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 4px;
}
.subtask-sort-btn {
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    color: #ccc;
    padding: 1px;
}
.subtask-sort-btn:hover {
    color: var(--primary);
    background: #f0f0f0;
    border-radius: 2px;
}

/* --- Feature: Collapsible Subtasks (Board) --- */

.subtask-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 2px 4px;
    background: #f9f9f9;
    border-radius: 4px 4px 0 0;
    border: 1px solid #eee;
    border-bottom: none;
}

.subtask-header + .subtask-wrapper {
    margin-top: 0;
    border-top: none;
    border-radius: 0 0 4px 4px;
    border-top: 1px dashed #eee;
}

.subtask-collapse-btn {
    font-size: 10px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    width: 100%;
}
.subtask-collapse-btn:hover {
    color: var(--primary);
}

.subtask-wrapper.collapsed {
    display: none;
}

.subtask-header.is-collapsed-header {
    border-bottom: 1px solid #eee;
    border-radius: 4px;
}


/* ==========================================================================
   🆕 NEW FEATURES v5.11
   ========================================================================== */

/* --- Feature: View Toggle Buttons --- */
.view-toggle-group {
    display: flex;
    gap: 2px;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 6px;
}

.view-toggle-btn {
    padding: 4px 10px !important;
    border: none !important;
    background: transparent !important;
    color: #999 !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}
.view-toggle-btn:hover {
    color: var(--text-main) !important;
    background: rgba(255,255,255,0.5) !important;
}
.view-toggle-btn.active {
    background: white !important;
    color: var(--primary) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body.mode-life .view-toggle-group { background: #efeEeA; }

/* --- Feature: Search Bar --- */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 10px;
    min-width: 160px;
    transition: all 0.25s;
}
.search-box.focused {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 129, 245, 0.08);
    min-width: 220px;
}
.search-icon { color: #999; font-size: 14px; flex-shrink: 0; }
.search-box input {
    border: none !important;
    background: transparent !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    outline: none;
    width: 100%;
    color: var(--text-main);
}
.search-box input::placeholder { color: #bbb; }

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 3000;
    display: none;
    min-width: 280px;
}
.search-results-dropdown.visible { display: block; }

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f7f8fa; }
.search-result-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 2px;
}
.search-result-title mark {
    background: #fff3bf;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.search-result-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    gap: 8px;
    align-items: center;
}
.search-empty {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: #bbb;
}

/* --- Feature: Undo Toast --- */
.undo-toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5000;
    font-size: 13px;
    transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}
.undo-toast.visible {
    bottom: 24px;
}
.undo-toast-btn {
    background: rgba(255,255,255,0.15) !important;
    color: #6cb4ff !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 4px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.undo-toast-btn:hover {
    background: rgba(255,255,255,0.25) !important;
}

/* --- Feature: Emoji Picker --- */
.emoji-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
}
.emoji-picker-overlay.visible { display: flex; }

.emoji-picker-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 320px;
    max-width: 90vw;
    padding: 16px;
}
.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.emoji-picker-item {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.emoji-picker-item:hover {
    background: #f0f0f0;
    transform: scale(1.15);
}

/* --- Feature: Log Delete Button --- */
.log-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    gap: 8px;
}
.log-entry-text {
    flex: 1;
}
.log-delete-btn {
    opacity: 0;
    cursor: pointer;
    color: #ccc;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.log-entry:hover .log-delete-btn {
    opacity: 1;
}
.log-delete-btn:hover {
    color: var(--danger);
    background: rgba(235, 87, 87, 0.1);
}

/* --- Feature: Markdown Rendered Content --- */
.md-rendered {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    line-height: 1.5;
    word-break: break-word;
}
.md-rendered strong { color: #555; font-weight: 600; }
.md-rendered em { font-style: italic; }
.md-rendered code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 10px;
    color: #d63384;
}
.md-rendered ul, .md-rendered ol {
    margin: 2px 0;
    padding-left: 16px;
}
.md-rendered li { margin-bottom: 1px; }
.md-rendered a {
    color: var(--primary);
    text-decoration: none;
}
.md-rendered a:hover { text-decoration: underline; }

/* --- Feature: Week View --- */
.week-view-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    height: 100%;
    min-height: calc(100vh - 120px);
}

.week-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
}

.week-col.is-today {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 2px 8px rgba(46,129,245,0.1);
}

.week-col.is-weekend {
    background: #fafafa;
    opacity: 0.7;
}

.week-col-header {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    text-align: center;
    flex-shrink: 0;
}
.week-col.is-today .week-col-header {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.week-col-header .week-date-num {
    font-size: 18px;
    font-weight: 700;
    display: block;
    line-height: 1.2;
    color: var(--text-main);
}
.week-col.is-today .week-col-header .week-date-num { color: white; }

.week-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-cell-task {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.3;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.week-cell-task:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.week-cell-task.completed {
    text-decoration: line-through;
    opacity: 0.5;
}
.week-cell-task.on-it {
    border-left-color: var(--focus-border);
    background: var(--focus-bg);
}

.week-col-footer {
    padding: 4px 8px;
    text-align: center;
    font-size: 10px;
    color: #bbb;
    border-top: 1px solid #f0f0f0;
    cursor: pointer;
    flex-shrink: 0;
}
.week-col-footer:hover { background: #f9f9f9; color: var(--primary); }

/* --- Feature: Month View --- */
.month-view-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}
.month-nav-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    min-width: 140px;
    text-align: center;
}

.month-weekday-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.month-weekday-label {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sec);
    padding: 4px;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.month-cell {
    min-height: 80px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid #eee;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
    position: relative;
}
.month-cell:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.month-cell.is-today {
    border-color: var(--primary);
    background: rgba(46,129,245,0.03);
    box-shadow: inset 0 0 0 1px var(--primary);
}
.month-cell.other-month {
    opacity: 0.35;
    background: #fafafa;
}
.month-cell.is-weekend {
    background: #fcfcfb;
}

.month-cell-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 4px;
}
.month-cell.is-today .month-cell-date {
    color: white;
    background: var(--primary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.month-cell-tasks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.month-task-pill {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.month-task-pill.completed {
    text-decoration: line-through;
    opacity: 0.5;
}

.month-more-indicator {
    font-size: 10px;
    color: #999;
    text-align: center;
    padding: 1px;
}

/* 调休工作日徽章 */
.extra-work-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
    margin-left: 6px;
    font-weight: 600;
    vertical-align: middle;
}

/* 周视图图钉按钮 */
.pin-workday-btn {
    cursor: pointer;
    font-size: 12px;
    opacity: 0.4;
    transition: opacity 0.2s;
    margin-left: 4px;
}
.pin-workday-btn:hover { opacity: 1; }
.pin-workday-btn.pinned { opacity: 0.9; }