/* 全局样式重置（已合并进主页面：作用域限定在 #view-todo 内，避免污染主页面）。
   注意：margin/padding 重置必须用 :where() 把特异性降为 0——若直接写 #view-todo *，
   特异性 (1,0,0) 会碾压后面 .add-task-panel{padding:24px} 等类规则，
   导致所有卡片的内外边距丢失（原版 * 选择器特异性即为 0，类规则可正常覆盖）。 */
#view-todo,
#view-todo *,
#view-todo *::before,
#view-todo *::after {
    box-sizing: border-box;
}
:where(#view-todo) :where(*) {
    margin: 0;
    padding: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .form-group select {
        padding: 10px 14px;
        font-size: 0.95rem;
    }
}

/* 隐藏元素 */
.hidden {
    display: none;
}

/* 循环任务选项样式 */
.recurrence-options {
    background-color: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.recurrence-specific-options {
    margin-top: 16px;
    padding: 16px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* 复选框组样式 */
.weekday-checkboxes,
.monthday-checkboxes {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 每周 7 个一行排满；每月 31 号自动换行对齐 */
    gap: 6px;
    margin-top: 12px;
}

.weekday-checkboxes label,
.monthday-checkboxes label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    background-color: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    user-select: none;
}

.weekday-checkboxes label:hover,
.monthday-checkboxes label:hover {
    background-color: #f0f7ff;
    border-color: #4299e1;
}

/* 隐藏原生勾选框：整个 chip 即开关，选中态由 label:has(input:checked) 表达 */
.weekday-checkboxes input[type="checkbox"],
.monthday-checkboxes input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.weekday-checkboxes span,
.monthday-checkboxes span {
    padding-left: 0;
    pointer-events: none;
}

/* 选中：实心蓝底白字 */
.weekday-checkboxes label:has(input:checked),
.monthday-checkboxes label:has(input:checked) {
    background-color: #3182ce;
    border-color: #3182ce;
    color: #fff;
    font-weight: 600;
}

/* 优化时间选择器样式 */
#daily-time {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    margin-top: 8px;
    transition: border-color 0.2s ease;
}

#daily-time:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 优化循环类型选择器 */
#recurrence-type {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

#recurrence-type:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 优化循环任务复选框 */
#recurring-task-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #4299e1;
    margin-right: 8px;
}

#recurring-task-checkbox + span {
    font-size: 16px;
    color: #2d3748;
}

/* 循环任务错误提示样式 */
.recurrence-error {
    color: #FF4D4F;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 0;
    margin-left: 0; /* 已移入循环类型行内（分段单选 + 摘要之后），不再缩进 */
    opacity: 0;
    transition: opacity 0.2s ease;
}

.recurrence-error.hidden {
    display: none;
}

.recurrence-error.show {
    opacity: 1;
}

/* 时间选择器样式 */
#daily-time {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 16px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background-color: white;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
}

.form-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.btn-secondary {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
}

.btn-secondary:hover {
    background-color: #e9e9e9;
}

.btn-primary {
    background-color: #4CAF50;
    border: 1px solid #4CAF50;
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
}

/* 用户列表弹窗（@ 提及）
   参考「所属项目」antd.Select 下拉：浮层限高，滚动只发生在列表区；
   全局 8px 滚动条样式（index.html head）保证滚动条可见。 */
.user-list-popup {
    position: absolute;
    z-index: 3000;              /* 与 .todo-project-select-dropdown 一致 */
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 300px;
    max-height: 280px;          /* 与 .jira-dd-searchpop .ant-dropdown-menu 一致 */
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* 只裁圆角，滚动交给 .user-list */
}

/* 必须压过上面同特异性的 display:flex，否则加 .hidden 也关不掉浮层 */
.user-list-popup.hidden {
    display: none;
}

.user-list {
    flex: 1 1 auto;
    min-height: 0;              /* flex 子项必须允许收缩，否则不会滚动 */
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;   /* 滚到底不穿透到页面/弹窗 */
    scroll-padding-top: 28px;       /* 键盘 ↑↓ 时不被吸顶分组标题挡住 */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

.user-item {
    padding: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-item:hover {
    background-color: #f5f5f5;
}

.user-item input[type="checkbox"] {
    margin-right: 10px;
}

.user-item.selected {
    background-color: #e8f0fe;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-username {
    font-size: 12px;
    color: #666;
}

/* @ 提及：部门分组标题 + 部门项（部门只插入标签，不展开成员名单） */
.mention-group {
    position: sticky;           /* 滚动时分组名保持可见 */
    top: 0;
    z-index: 1;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #8a94a6;
    background: #f7f9fc;
    border-top: 1px solid #eef1f6;
    border-bottom: 1px solid #eef1f6;
    letter-spacing: .5px;
}
.mention-group:first-child {
    border-top: none;
}
.mention-dept .user-name {
    color: #2563eb;
}
.mention-dept .user-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: #2563eb;
    margin-right: 6px;
    vertical-align: middle;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: white;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: calc(90vh - 140px);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #1a365d;
    font-weight: 600;
}

.close {
    color: #718096;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #2d3748;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0;
    color: #4a5568;
    font-size: 0.95rem;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #fafbfc;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

/* 确保模态框在移动设备上也有良好的显示效果 */
@media (max-width: 640px) {
    .modal-content {
        max-width: 95%;
        max-height: 95vh;
        width: 95%;
    }
    
    .modal-body {
        max-height: calc(95vh - 140px);
    }
}

/* 确保循环任务选项在弹窗中正确显示 */
.recurrence-options {
    max-width: 100%;
    overflow-x: hidden;
}

.modal-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1rem;
    color: #2d3748;
    box-sizing: border-box;
    min-height: 50px;
    resize: vertical;
}

.modal-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* ===== 任务进度时间线（#progress-modal，独立于 section，样式需全局） ===== */
.todo-progress-modal { max-width: 560px; }
#progress-modal .modal-header h3 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.todo-progress-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 46vh;
    overflow-y: auto;
    margin-bottom: 16px;
}
.todo-progress-empty {
    padding: 28px 12px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
}
.todo-progress-item {
    position: relative;
    padding: 10px 12px 10px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.todo-progress-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 16px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2f6fed;
}
.todo-progress-time {
    font-size: 11px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.todo-progress-text {
    margin-top: 4px;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.todo-progress-input {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 76px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
}
.todo-progress-input:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.12);
}
.todo-progress-input:disabled { background: #f1f5f9; color: #94a3b8; }
/* 「+ 进度」小方块按钮：白底细边框圆角，常驻在任务卡右上角 */
.todo-progress-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    height: 24px;
    padding: 0 10px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #fff;
    color: #4a5568;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.todo-progress-trigger:hover {
    border-color: #2f6fed;
    color: #2f6fed;
    background: #f7faff;
}
.todo-progress-plus {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #64748b;
}
.todo-progress-trigger:hover .todo-progress-plus { color: #2f6fed; }

/* 今日任务概览卡：小一号，且同样只在条目悬停时显示 */
.todo-progress-trigger-sm {
    height: 20px;
    padding: 0 7px;
    font-size: 11px;
    border-radius: 6px;
}
.todo-progress-trigger-sm .todo-progress-plus { font-size: 12px; }
.todo-overview-item .todo-progress-trigger {
    opacity: 0;
    transition: opacity .15s ease, border-color .15s ease, color .15s ease, background .15s ease;
}
.todo-overview-item:hover .todo-progress-trigger { opacity: 1; }

/* 详情下方「最近一条进度」摘要：任务列表 + 今日任务概览卡共用 */
.todo-progress-latest {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 0;   /* 上下间距由父容器 flex gap 统一控制 */
    padding: 5px 9px;
    background: #f5f8ff;
    border-left: 3px solid #2f6fed;
    border-radius: 0 8px 8px 0;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
}
.todo-progress-latest:hover { background: #eaf1ff; }
.todo-progress-latest-tag { flex: 0 0 auto; color: #2f6fed; font-weight: 600; }
.todo-progress-latest-time {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.todo-progress-latest-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 编辑任务弹窗：左表单 + 右任务进度（编辑模式加宽，新建模式隐藏右栏） ===== */
#edit-modal .modal-content.edit-wide { max-width: 1000px; }
#edit-modal .modal-body.edit-split {
    display: flex;
    gap: 22px;
    align-items: stretch;
}
.edit-form-col { flex: 1 1 auto; min-width: 0; }
/* 编辑弹窗底部「已完成」按钮：未完成任务可直接标记完成（走现有确认流程） */
.btn-complete-edit { background: #059669; border-color: #059669; color: #fff; margin-right: auto; }
.btn-complete-edit:hover { filter: brightness(1.08); }
/* 只读查看模式（项目管理详情页待办栏复用）：禁表单交互、隐进度追加与底部按钮 */
#edit-modal .modal-content.view-only .edit-form-col { pointer-events: none; }
#edit-modal .modal-content.view-only .edit-form-col textarea,
#edit-modal .modal-content.view-only .edit-form-col input { color: #334155; }
#edit-modal .modal-content.view-only #edit-progress-input,
#edit-modal .modal-content.view-only #edit-progress-add { display: none; }
#edit-modal .modal-content.view-only .modal-footer { display: none; }
.edit-progress-col {
    flex: 0 0 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid #eef2f7;
}
.edit-progress-col.hidden { display: none; }
.edit-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #1a365d;
}
.edit-progress-count { font-size: 12px; font-weight: 400; color: #94a3b8; }
/* 右栏列表独立滚动，弹窗整体高度不随进度条数增长 */
.edit-progress-list {
    flex: 1 1 auto;
    max-height: 42vh;
    margin-bottom: 0;
    overflow-y: auto;
}
.edit-progress-add {
    width: 100%;
    padding: 8px 0;
    font-size: 13px;
}
/* 窄屏：右栏掉到表单下方，取消左边框改上边框 */
@media (max-width: 900px) {
    #edit-modal .modal-body.edit-split { flex-direction: column; }
    .edit-progress-col {
        flex: 1 1 auto;
        padding-left: 0;
        padding-top: 14px;
        border-left: none;
        border-top: 1px solid #eef2f7;
    }
}

/* ===== 编辑弹窗：所属项目（复用系统 antd.Select，可输入筛选） =====
   宿主沿用 #view-todo .todo-antd-dd 的 display:block；antd 挂载后由 .ant-select 接管。
   浮层 getPopupContainer 指向 body，避免被 .modal 的 z-index / overflow 裁切。 */
.todo-project-dd { width: 100%; }
.todo-project-dd .ant-select { width: 100%; }
/* 未关联时框内留白：静态占位仍撑满整行、箭头靠右，避免 inline-flex 缩成小方块 */
.todo-project-dd .jira-status-placeholder {
    display: flex;
    width: 100%;
    justify-content: space-between;
}
/* 全局 .form-group input:focus（style.css:681 / 1073）会误伤 antd 内部这个几乎零宽的
   搜索 input，在选中项旁边叠出一小块浅蓝光晕。这里只清掉内部 input，
   保留 .ant-select-selector:focus-within 的「整框聚焦蓝圈」。
   选择器带 .form-group 前缀 + !important，确保压过全局规则与 antd 动态注入样式。 */
.form-group .todo-project-dd .ant-select-selection-search-input:focus {
    box-shadow: none !important;
    border-color: transparent !important;
    background-color: transparent !important;
}
/* 浮层挂 body，显式抬高层级，确保盖在 .modal(z-index:1000) 之上；
   下面两条分别对应 popupClassName 生效 / 未生效两种情况（本项目仅此一个 antd Select） */
.todo-project-select-dropdown { z-index: 3000 !important; }
.ant-select-dropdown { z-index: 3000 !important; }
/* vendor 加载失败时降级用的原生 select：至少能点选，不让项目关联整体失效 */
.form-group .todo-project-fallback {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
.todo-project-hint {
    margin-top: 6px;
    font-size: 11px;
    color: #94a3b8;
}

/* 卡片上的「所属项目」标签：任务列表 + 今日任务概览卡共用 */
.todo-project-tag {
    display: inline-flex;
    align-items: center;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1px 8px;
    border: 1px solid #dbe6ff;
    border-radius: 999px;
    background: #f2f7ff;
    color: #3b6fd4;
    font-size: 11px;
    line-height: 18px;
}

/* 按钮样式（作用域限定：主页面有同名 .btn，必须隔离；min-height:0 抵消主页面 .btn 的 min-height:44px 渗入） */
#view-todo .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 0;
}

.btn-primary {
    background-color: #4299e1;
    color: white;
}

.btn-primary:hover {
    background-color: #3182ce;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background-color: #c53030;
}

/* 原 body 级样式：合并后改为作用于 #view-todo 区块
   （背景色已按需求去掉，跟随主页面整体背景） */
#view-todo {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 用户信息区域样式 */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
}

.username {
    font-weight: 500;
    color: #2d3748;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.username:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* 主容器样式 */
.todo-container {
    max-width: 100%; /* 铺满内容区，去掉侧栏旁的留白，且不超过视口 */
    margin: 0;
    padding: 0; /* 去掉容器内边距，使卡片左/右/上边与日历等其他页面卡片对齐（消除比别的页面宽的左缝） */
}

.icon-btn {
    width: 32px; /* 缩小20% */
    height: 32px; /* 缩小20% */
    border: none;
    border-radius: 6px; /* 略微缩小 */
    background-color: #fff;
    color: #4a5568;
    font-size: 14px; /* 缩小20% */
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.icon-btn:hover {
    background-color: #edf2f7;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 内容区域布局 */
.todo-content {
    display: grid;
    grid-template-columns: 480px minmax(0, 1fr); /* 左:概览(加宽1/3) 右:任务列表(可收缩，防溢出)；右侧添加表单已删，改两栏 */
    grid-template-rows: minmax(0, 1fr); /* 单行占满容器高度，三栏各自内滚的前提 */
    gap: 24px; /* 缩小20% */
    /* 整页不滚动：占满视口剩余高度。height 100vh-92 正好吃满 .wrap 顶部 76px + 底部 16px 呼吸
       （.wrap 底部内边距已统一降到 16px，所有页面一致，无需负 margin 补偿） */
    height: calc(100vh - 92px);
}

/* 各栏允许收缩，避免内部宽内容把整行撑出横向滚动条 */
.todo-content > * {
    min-width: 0;
}

/* 左侧添加任务面板 */
.add-task-panel {
    background-color: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    height: fit-content;
    align-self: start; /* 按内容自适应高度，不随行高拉伸 */
    max-height: 100%;  /* 超出列高时面板内部滚动 */
    overflow-y: auto;
    border: 1px solid var(--line);
}

.add-task-panel h2 {
    font-size: 1.2rem; /* 缩小20% */
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 16px; /* 缩小20% */
}

/* 左侧「今日 & 过期任务」概览面板 */
.todo-overview-panel {
    background-color: #fff;
    border-radius: 12px;
    padding: 0;                 /* 内边距下放到标题/列表，让标题能做成固定头部 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--line);
    /* 占满列高（随 grid stretch）；标题固定、只有列表在下方独立滚动 */
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 固定头部：不随列表滚动，底部一条分隔线与任务区隔开 */
.todo-overview-panel h2 {
    flex: 0 0 auto;
    display: flex;              /* 单标题 + 计数徽章同一行 */
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a365d;
    margin: 0;
    padding: 24px 24px 16px;   /* 原面板 24px 内边距 + 原 margin-bottom 16px */
    background: #fff;
    border-bottom: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
}

.todo-overview-panel .todo-overview-count {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 700;
    background-color: #edf2f7;
    color: #4a5568;
    border-radius: 10px;
    padding: 1px 9px;
    min-width: 22px;
    text-align: center;
}

.todo-overview-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;           /* 滚动条只在列表区，不穿过固定头部 */
    padding: 0 24px 24px;       /* 左右/下留白，与改版前一致 */
    display: flex;
    flex-direction: column;
    gap: 0; /* 项间距由条目自身的 padding 提供，条目之间用分割线 */
}

.todo-overview-empty {
    font-size: 0.88rem;
    color: #a0aec0;
    padding: 8px 2px;
}

.todo-overview-item {
    display: flex;
    flex-direction: column; /* 标题行在上；详情/元信息与复选框左对齐，不缩进到标题下 */
    align-items: stretch;
    gap: 4px;
    padding: 10px 2px; /* 无卡片底色，仅上下留白；左右贴齐复选框列 */
    border-bottom: 1px solid #edf2f7; /* 条目之间的分割线 */
}

.todo-overview-item:last-child {
    border-bottom: none; /* 最后一条不画线 */
}

.todo-overview-item:hover {
    background-color: transparent; /* 无卡片样式，悬停不再整块变色 */
}

.todo-overview-item .task-checkbox {
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 标题行：复选框 + 文本 */
.todo-overview-item-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.todo-overview-item-header .todo-overview-item-text {
    flex: 1;
    min-width: 0;
}

.todo-overview-item-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: #2d3748;
    line-height: 1.35;
    word-break: break-word;
}

.todo-overview-item.completed .todo-overview-item-text {
    text-decoration: line-through;
    color: #a0aec0;
}

.todo-overview-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 2px; /* 与 .todo-overview-item-desc 的 margin-top 一致，详情上下缝隙对称（原 4px 导致下缝 8 > 上缝 6） */
    font-size: 0.76rem;
    color: #718096;
}
/* meta 行各标签统一基线盒：display/行高/字号一致，消除「协助/新建/优先级/截止」错位 */
.todo-overview-item-meta > * {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: 0.76rem;
}

/* 今日任务卡：协作人只显示一个人名，置于优先级徽章前 */
.todo-overview-item-collab {
    color: #4a5568;
    font-weight: 600;
}

/* 新建人徽章：别人分配的任务才显示（任务列表 + 今日概览卡共用） */
.todo-creator-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    color: #805ad5;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== 编辑任务弹窗：两栏一行布局 ===== */
.form-row {
    display: flex;
    gap: 14px;
    align-items: flex-end; /* 控件底边对齐：开关行与优先级选择框同基线 */
}
.form-row .form-group {
    flex: 1;
    min-width: 0;
}

/* 开关组：行高与选择框一致(32px)，内容垂直居中 → 与优先级框精确对齐 */
.switch-group .todo-switch {
    height: 32px;
}

/* 开关 UI（启用循环任务）：原生 checkbox 保留（id 不变），仅视觉替换 */
.todo-switch {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 0 !important;
    cursor: pointer;
}
.todo-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.todo-switch-track {
    width: 38px;
    height: 21px;
    border-radius: 11px;
    background: #cbd5e0;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.todo-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: left 0.2s ease;
}
.todo-switch input:checked + .todo-switch-track {
    background: #38a169;
}
.todo-switch input:checked + .todo-switch-track .todo-switch-thumb {
    left: 19px;
}
.todo-switch-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

/* 分段单选（循环类型：按天/按周/按月） */
.todo-segmented {
    display: inline-flex;
    background: #edf2f7;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

/* 循环类型行：分段单选 + 已选内容摘要 */
.recurrence-type-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.recurrence-summary {
    font-size: 0.8rem;
    color: #718096;
}
.todo-segmented-item {
    border: none;
    background: transparent;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.todo-segmented-item.active {
    background: #fff;
    color: #2b6cb0;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 概览卡任务详情描述（超 2 行省略） */
.todo-overview-item-desc {
    font-size: 0.76rem;
    color: #718096;
    line-height: 1.4;
    margin-top: 2px;
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.todo-overview-item .task-priority {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.76rem; /* 与 meta 行其它标签同字号，避免基线错位 */
    font-weight: 600;
}

.todo-overview-item-deadline,
.todo-overview-item-owner {
    color: #718096;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.95rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
    background-color: #f7fafc;
    box-sizing: border-box;
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
    background-color: #f7fafc;
    box-sizing: border-box;
}

/* 时间选择器样式优化 */
.form-group input[type="datetime-local"] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%234a5568" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 10px;
}

.form-group input[type="datetime-local"]:hover {
    border-color: #cbd5e0;
}

.form-group input[type="datetime-local"]:focus {
    border-color: #4299e1;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4299e1;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-group input::placeholder {
    color: #a0aec0;
}

.add-task-btn {
    width: 100%;
    padding: 14px 18px;
    background-color: #6b46c1;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.add-task-btn:hover {
    background-color: #553c9a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
}

/* 右侧任务面板 */
.tasks-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    min-height: 0; /* 允许任务列表在列内滚动而不是撑破整页 */
}

/* 视图控制栏 */
.view-controls {
    flex: 0 0 auto; /* 中列纵向 flex 中固定，不被压缩 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.view-controls-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1 1 auto; /* 撑满顶栏可用宽度，子元素统计卡才有空间等分 */
    min-width: 0; /* 允许左侧分组收缩，配合 stats-cards 换行 */
}

.view-controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.view-tabs {
    display: flex;
    gap: 10px;
}

.view-tab {
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.view-tab:hover:not(.active) {
    border-color: #cbd5e0;
    background-color: #f7fafc;
}

.view-tab.active {
    background-color: #ebf8ff;
    border-color: #3182ce;
    color: #2b6cb0;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.2);
}

/* 隐藏列表视图按钮 */
#list-view-btn {
    display: none;
}



.search-box {
    flex: 0 0 auto; /* 中列纵向 flex 中固定，不被压缩 */
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    height: 50px;
    padding: 8px 16px;
    gap: 10px;
    width: 100%;
    max-width: none;
    margin-bottom: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.search-box:hover {
    border-color: #a0aec0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.search-box:focus-within {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.search-box i {
    color: #4299e1;
    font-size: 1.2rem;
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 1.05rem;
    color: #2d3748;
    outline: none;
    flex-grow: 1;
}

.search-box input::placeholder {
    color: #a0aec0;
    font-size: 1.05rem;
}

.sort-box {
    position: relative;
}

.sort-box select {
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    outline: none;
}

.search-box input::placeholder {
    color: #a0aec0;
}

/* 统计卡片 */
.stats-cards {
    display: flex;
    flex: 1 1 auto; /* 撑满所在行：子卡是 flex-basis:0 的等分卡，容器不能按内容收缩，否则整行塌成一小条 */
    flex-wrap: nowrap; /* 始终一行：卡片等分宽度、可收缩 */
    gap: 8px;
    margin-bottom: 0;
}

.stat-card {
    flex: 1 1 0;   /* 5 张卡等分一行，窄屏时按比例收缩 */
    min-width: 0;  /* 允许收缩到内容以下，配合文字省略号 */
    padding: 8px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    height: auto;
    border: 1px solid var(--line);
    cursor: pointer;
    /* margin 归零：主页面日历区有同名 .pending 类（margin-top:16px），
       会把「待完成」卡片整体下推造成错位；本表在后加载，同特异性下以此为准 */
    margin: 0;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card.active {
    background-color: #e9ecef;
    box-shadow: 0 0 0 2px #6c5ce7, 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 不同类型统计卡片的颜色 */
.stat-card.total {
    background-color: #ebf8ff;
    border-color: #bee3f8;
}

.stat-card.completed {
    background-color: #f0fff4;
    border-color: #c6f6d5;
}

.stat-card.pending {
    background-color: #fff5f5;
    border-color: #fed7d7;
}

.stat-card.overdue {
    background-color: #fffaf0;
    border-color: #feebc8;
}

.stat-card.today {
    background-color: #f7fafc;
    border-color: #e2e8f0;
}

.stat-card.tomorrow {
    background-color: #fcf0ff;
    border-color: #fae6ff;
}

/* 统计内容容器 - 实现单行显示 */
.stat-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0;
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统计数字颜色 */
.stat-card.total .stat-number {
    color: #2b6cb0;
    font-weight: 700;
}

.stat-card.completed .stat-number {
    color: #2f855a;
    font-weight: 700;
}

.stat-card.pending .stat-number {
    color: #c53030;
    font-weight: 700;
}

.stat-card.overdue .stat-number {
    color: #dd6b20;
    font-weight: 700;
}

.stat-card.today .stat-number {
    color: #4a5568;
    font-weight: 700;
}

.stat-card.tomorrow .stat-number {
    color: #9f7aea;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.2;
    min-width: 0; /* 允许收缩，配合省略号 */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统计标签颜色 */
.stat-card.total .stat-label {
    color: #4299e1;
}

.stat-card.completed .stat-label {
    color: #48bb78;
}

.stat-card.pending .stat-label {
    color: #e53e3e;
}

.stat-card.overdue .stat-label {
    color: #ed8936;
}

.stat-card.today .stat-label {
    color: #718096;
}

.stat-card.tomorrow .stat-label {
    color: #805ad5;
}

.list-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 任务列表容器 */
.tasks-list-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    margin-top: 4px;
    border: 1px solid var(--line);
    /* 占满中列剩余高度；标题栏钉住，任务区单独滚动 */
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}



/* 任务操作按钮容器：整组悬停才显示（进度按钮与编辑/删除行为一致） */
.task-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.task-item:hover .task-actions {
    opacity: 1;
}

/* 图标按钮样式（任务卡内紧凑化）。
   注意：主页面 index.html 里有同名 .edit-btn{min-height:40px}（员工管理行的编辑按钮），
   会渗透到任务卡把标题行撑到 40px——这里必须显式 min-height/min-width:0 压掉。 */
.task-actions .icon-btn {
    background-color: transparent;
    border: none;
    padding: 2px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.2;
    height: 24px;
    width: 24px;
    min-height: 0;
    min-width: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 编辑按钮样式 */
.edit-btn {
    color: #4299e1;
}

.edit-btn:hover {
    background-color: #ebf8ff;
    color: #2b6cb0;
}

/* 删除按钮样式 */
.delete-btn {
    color: #e53e3e;
}

.delete-btn:hover {
    background-color: #fed7d7;
    color: #c53030;
}

/* 任务列表头部 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex: 0 0 auto; /* 标题栏钉在卡片顶部，不随任务区滚动 */
}

.list-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #1a365d;
}

/* 列表操作按钮组 */
.list-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.tasks-list-container h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 0;
}

/* 空任务状态 */
.tasks-empty {
    text-align: center;
    padding: 48px 16px;
    color: #718096;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.tasks-empty i {
    font-size: 3.2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.tasks-empty p {
    font-size: 0.9rem;
}

/* 任务内容容器 */
.tasks-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* 任务区单独滚动：占满卡片剩余高度 */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* 列表视图样式 */
.task-item {
    display: flex;
    flex-direction: column; /* 标题行在上；详情/元信息与复选框左对齐，不缩进到标题下 */
    align-items: stretch;
    gap: 2px; /* 纵向间隔收紧（间隙大头是行高，见 .task-text） */
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background-color: #fff;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}

.task-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.task-item.completed {
    background-color: #f0fff4;
    border-color: #c6f6d5;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #718096;
}

.task-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    margin-top: 3px; /* 与 1rem/1.35 标题行垂直居中对齐 */
    accent-color: #38a169;
}

/* 任务标题行：复选框 + 标题 + 操作按钮 */
.task-header {
    display: flex;
    align-items: flex-start;
}

.task-header .task-text {
    flex: 1;
    min-width: 0;
}

.task-text {
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    line-height: 1.35; /* 收紧标题行高：1.6 的行盒上下各多出约 5px 空白，是标题→详情间隙的大头 */
    margin-bottom: 0; /* 行间距由 .task-item 的 gap 控制 */
    white-space: pre-wrap; /* 保留换行符，自动换行 */
    word-break: break-word; /* 确保长单词也能换行 */
}

/* 点击标题进入编辑（任务列表与概览卡共用）：悬停变色提示可点 */
.task-text-editable {
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.task-text-editable:hover {
    color: #2b6cb0;
}

.task-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;            /* 标签变多（新建/协助/优先级/截止）时自动换行，截止时间不再被挤出容器 */
    gap: 8px 16px;              /* 行间距 8px、列间距 16px */
    font-size: 0.8rem;
    margin-top: 8px;            /* 与标题行拉开宽松间距（原 -3px 负补偿会把整行上拽、截止时间被挤压看不见） */
    color: #4a5568;
}
/* meta 行各标签统一行高，消除「新建/协助/优先级/截止」基线错位 */
.task-meta > * { line-height: 1; }

/* 任务详情描述（列表内直接显示，超 3 行省略） */
.task-desc {
    font-size: 0.85rem;
    color: #718096;
    line-height: 1.4;
    margin-top: 0; /* 间距由 .task-item 的 gap 统一控制 */
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 任务截止时间样式 */
.task-deadline {
    display: flex;
    align-items: center;
    flex-shrink: 0;             /* 不被同行其他标签压缩，保证截止时间始终可见 */
    gap: 4px;
    font-size: 0.8rem;
    color: #4a5568;
    font-weight: 500;
}

.task-collaborators {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 4px;
    font-size: 0.8rem;
    color: #4299e1;
    font-weight: 500;
}

.task-item.collaborative-task {
    border-left: 4px solid #4299e1;
}

/* 确保任务项相对定位，以便预览元素可以绝对定位 */
.task-item {
    position: relative;
}

.task-priority {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.8rem; /* 与 .task-meta 行其它标签同字号，避免基线错位 */
    text-transform: uppercase;
}

.task-overdue-time {
    color: #e53e3e; /* 已过期任务的截止时间段标红（任务列表 + 概览卡共用） */
    font-weight: 600;
}

.task-priority.high {
    background-color: #fed7d7;
    color: #c53030;
}

.task-priority.medium {
    background-color: #feebc8;
    color: #dd6b20;
}

.task-priority.low {
    background-color: #c6f6d5;
    color: #2f855a;
}

/* 优先级标签在 .task-meta 行内靠 flex align-items 对齐，不再用 margin-top hack */

/* 卡片视图功能已移除，仅保留列表视图 */

/* 响应式设计 */
/* 略窄屏：统计卡再收一档字号/内边距，保证 5 张卡一行放得下 */
@media (max-width: 1366px) {
    .stats-cards {
        gap: 6px;
    }

    .stat-card {
        padding: 8px 6px;
    }

    .stat-label {
        font-size: 0.8rem;
    }
}

/* 中宽屏：收窄两侧固定列，保证中间任务列表不被压扁 */
@media (max-width: 1280px) {
    .todo-content {
        grid-template-columns: 427px minmax(0, 1fr);
        gap: 18px;
    }
}

@media (max-width: 1024px) {
    .todo-content {
        grid-template-columns: 1fr;
        align-items: stretch;
        height: auto;          /* 单列下恢复整页滚动 */
        grid-template-rows: none;
    }

    .todo-overview-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .todo-overview-list {
        overflow: visible;       /* 单列整页滚动时，列表不再内部滚动 */
        flex: 0 0 auto;
    }

    .add-task-panel {
        position: static;
        order: -1;
        max-height: none;
        overflow: visible;
    }

    .tasks-list-container {
        display: block;
        overflow: visible;
    }

    .tasks-content,
    .tasks-empty {
        overflow: visible;
    }

    .view-controls {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .view-controls-left,
    .view-controls-right {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .todo-container {
        padding: 15px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .list-actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    

}

@media (max-width: 480px) {
    .add-task-panel {
        padding: 20px;
    }
    
    .view-controls {
        padding: 15px;
    }
    
    .view-tab {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .search-box,
    .sort-box {
        padding: 6px 10px;
    }
    
    .search-box input,
    .sort-box select {
        font-size: 0.8rem;
    }
    
    .task-item {
        padding: 15px;
    }
    
    .task-text {
        font-size: 1rem;
    }
    
    .task-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ===== antd 组件宿主（待办表单，与工单管理同族组件：antd Dropdown/DatePicker/TimePicker）===== */
#view-todo .todo-antd-dd,
#view-todo .todo-antd-dp,
#view-todo .todo-antd-tp {
    display: block;
}

/* 下拉触发器占满表单项宽度（样式基础沿用主页面 .jira-dd-trigger） */
#view-todo .todo-antd-dd .jira-dd-trigger {
    display: flex;
    width: 100%;
    justify-content: space-between;
    text-align: left;
}

/* 人员筛选 + 按优先级两个下拉按钮统一定宽：外观协调一致，选中不同文字时不再跳动。 */
.person-filter-box,
.priority-filter-box {
    position: relative;
    width: 120px;
    flex: 0 0 120px;
}
.person-filter-box .jira-status-placeholder,
.person-filter-box .jira-dd-trigger,
.priority-filter-box .jira-status-placeholder,
.priority-filter-box .jira-dd-trigger {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
}
.person-filter-box .ar,
.priority-filter-box .ar {
    flex: 0 0 auto;
}
/* 真实值就绪前隐藏默认占位文字，避免「先显示全部人员/按优先级，再跳成保留值」的内容闪跳。
   容器已定宽，隐藏内容不影响布局尺寸。render 首次渲染真实值后由 JS 移除 dd-pending。 */
.person-filter-box .dd-pending,
.priority-filter-box .dd-pending,
.dd-pending .jira-status-placeholder {
    visibility: hidden;
}

/* ===== antd 宿主挂载前静态占位（对齐工单管理做法：外观与最终组件一致，加载后由 React 替换）=====
   下拉占位直接复用工单管理的 .jira-status-placeholder；日期/时间占位复刻 ant-picker 观感 */
#view-todo .todo-picker-placeholder {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    height: 32px;
    padding: 4px 11px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: rgba(0, 0, 0, 0.25);
    font-size: 14px;
    user-select: none;
}

/* ===== 待办优先级配色（下拉菜单挂在 body 下，故用全局类）===== */
.todo-prio-high { color: #dc2626; font-weight: 600; }
.todo-prio-medium { color: #d97706; font-weight: 600; }
.todo-prio-low { color: #16a34a; font-weight: 600; }

/* ============================================================
   备忘录（Notes）—— 作用域限定 #view-notes，不污染主页面
   一条笔记 = 文档目录下的一个 .md 文件；收起只显示标题，展开显示渲染后的 Markdown
   ============================================================ */
#view-notes .notes-card {
  /* 右栏独立滚动：卡片占满视口剩余高度，底部只留 8px 呼吸；
     .wrap 底部内边距已统一降到 8px。notes-card 同时带 .card 类会继承 14px 下边距，
     这里显式清 0，否则会多出一截导致整页出现小滚动条 */
  margin-bottom: 0;
  height: calc(100vh - 92px);
  min-height: 420px;
  display: flex; flex-direction: column;
}
/* 两个视图 pane 都是 notes-card(flex column) 的内容子项：必须 flex:1 + min-height:0，
   否则内部 .notes-layout/.notes-main / .sh-layout 拿不到有限高度 → overflow-y:auto 失效 →
   长文把整个卡片撑高，整页出滚动条、左目录被一起拉长（截图「文档没单独滚动」根因）。
   隐藏由 JS 内联 display:none 控制（优先级高于这里），切换照常。 */
#view-notes #notesPanePersonal,
#view-notes #notesPaneShared {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
}
#view-notes .notes-search {
  width: 220px; padding: 6px 10px; font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
#view-notes .notes-search:focus { outline: none; border-color: var(--primary); }
#view-notes .notes-tagbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: -12px -16px 0;              /* 抵消 card-head 下边距与 .card 内边距，分隔线贯穿卡片 */
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
#view-notes .notes-tagbar:empty { display: none; }
#view-notes .notes-tagbar:not(:empty) + .notes-layout { margin-top: 12px; }
#view-notes .notes-tag-chip {
  border: 1px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 999px; padding: 3px 11px; font-size: 12px; cursor: pointer;
  transition: .15s;
}
#view-notes .notes-tag-chip:hover { border-color: var(--primary); color: var(--primary); }
#view-notes .notes-tag-chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
#view-notes .notes-empty { text-align: center; padding: 48px 20px; color: var(--sub); }
#view-notes .notes-empty .ic { font-size: 38px; line-height: 1; margin-bottom: 10px; }
#view-notes .notes-empty .t { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
#view-notes .notes-empty .s { font-size: 13px; line-height: 1.7; }

/* --- 笔记卡片 --- */
#view-notes .note-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
  /* 瀑布流（CSS columns）：卡片按内容高度自然错落，不强制等高网格 */
  break-inside: avoid; -webkit-column-break-inside: avoid;
  display: inline-block; width: 100%; margin: 0 0 14px; vertical-align: top;
}
#view-notes .note-card.dragging { opacity: .45; }
#view-notes .note-card.drag-over-top { box-shadow: inset 0 3px 0 0 var(--primary), var(--shadow); }
#view-notes .note-card.drag-over-bottom { box-shadow: inset 0 -3px 0 0 var(--primary), var(--shadow); }
#view-notes .note-card.pinned { border-left: 4px solid var(--primary); }
#view-notes .note-card:not(.dragging):hover { box-shadow: 0 4px 18px rgba(15,23,42,.10); transform: translateY(-1px); }
#view-notes .note-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; cursor: pointer; user-select: none;
  cursor: grab;   /* 拖拽排序唯一发起区 */
}
#view-notes .note-head:active { cursor: grabbing; }
#view-notes .note-head:hover { background: #f8fafc; }
#view-notes .note-caret {
  border: none; background: transparent; color: var(--sub); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 3px; flex: 0 0 auto;
}
#view-notes .note-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  word-break: break-all; flex: 0 1 auto;
}
#view-notes .note-tags { display: flex; gap: 5px; flex-wrap: wrap; flex: 0 0 auto; }
#view-notes .note-tag {
  font-size: 11px; color: var(--primary); background: var(--primary-soft);
  border: none; border-radius: 5px; padding: 2px 8px; line-height: 1.5;
}
#view-notes .note-time {
  font-size: 12px; color: var(--sub); margin-left: auto; flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
/* --- 笔记正文（Markdown 渲染） --- */
#view-notes .note-body {
  padding: 4px 16px 16px; border-top: 1px solid var(--line);
  font-size: 14px; line-height: 1.75; color: var(--ink);
  word-break: break-word; overflow-wrap: anywhere;
}
#view-notes .markdown > *:first-child { margin-top: 10px; }
#view-notes .markdown > *:last-child { margin-bottom: 0; }
#view-notes .markdown h1 { font-size: 20px; margin: 16px 0 8px; }
#view-notes .markdown h2 { font-size: 17px; margin: 16px 0 8px; }
#view-notes .markdown h3 { font-size: 15px; margin: 14px 0 6px; }
#view-notes .markdown h4, #view-notes .markdown h5, #view-notes .markdown h6 {
  font-size: 14px; margin: 12px 0 6px; color: var(--ink);
}
#view-notes .markdown p { margin: 8px 0; }
#view-notes .markdown ul, #view-notes .markdown ol { margin: 8px 0; padding-left: 24px; }
#view-notes .markdown li { margin: 3px 0; }
#view-notes .markdown li > ul, #view-notes .markdown li > ol { margin: 3px 0; }
#view-notes .markdown blockquote {
  margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--line);
  background: #f8fafc; color: var(--sub);
}
#view-notes .markdown code {
  background: #f1f5f9; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
#view-notes .markdown pre {
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  padding: 12px 14px; overflow: auto; margin: 10px 0;
}
#view-notes .markdown pre code {
  background: none; border: none; color: inherit; padding: 0; font-size: 12.5px;
}
#view-notes .markdown a { color: var(--primary); }
#view-notes .markdown hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
#view-notes .markdown img { max-width: 100%; border-radius: 8px; }
#view-notes .markdown table {
  border-collapse: collapse; margin: 10px 0; font-size: 13px; width: 100%;
}
#view-notes .markdown th, #view-notes .markdown td {
  border: 1px solid var(--line); padding: 6px 9px; text-align: left;
}
#view-notes .markdown th { background: #f8fafc; font-weight: 600; }
#view-notes .markdown input[type="checkbox"] { margin-right: 5px; }
#view-notes .md-fallback {
  white-space: pre-wrap; font-family: inherit; font-size: 14px;
  color: var(--ink); margin: 0;
}

/* --- 编辑器（左编辑 / 右预览） --- */
#view-notes .note-edit-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px;
}
#view-notes .note-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; color: var(--ink); background: #fff; box-sizing: border-box;
}
#view-notes .note-input:focus { outline: none; border-color: var(--primary); }
#view-notes .note-title-input { flex: 1 1 220px; font-weight: 600; }
#view-notes .note-tags-input { flex: 0 1 200px; }
#view-notes .note-edit-pane {
  display: flex; gap: 10px; padding: 0 12px 12px; align-items: stretch;
}
#view-notes .note-textarea {
  flex: 1 1 50%; min-height: 260px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; line-height: 1.7; color: var(--ink); background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei", monospace;
}
#view-notes .note-textarea:focus { outline: none; border-color: var(--primary); }
#view-notes .note-preview {
  flex: 1 1 50%; min-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; font-size: 14px; line-height: 1.75; color: var(--ink);
}
@media (max-width: 900px) {
  #view-notes .note-edit-pane { flex-direction: column; }
  #view-notes .note-time { margin-left: 0; width: 100%; }
}

/* --- 存放位置弹窗（复用全局 .ui-dialog 组件，作用域限定 .notes-loc） --- */
.ui-dlg-bd.notes-loc { white-space: normal; }
.notes-loc .notes-set-pane .notes-loc-hint + .notes-loc-hint { margin-top: 8px; }
.notes-loc .notes-loc-label { font-size: 12px; color: var(--sub); margin: 0 0 5px; }
.notes-loc .notes-loc-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px;
}
.notes-loc .notes-loc-row .ui-dlg-input { flex: 1 1 auto; min-width: 0; }
.notes-loc .notes-loc-row .btn {
  flex: 0 0 auto; min-height: 44px; padding: 8px 14px; font-size: 13px;
  border-radius: 10px; white-space: nowrap;
}
.notes-loc .notes-loc-check {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px;
  color: var(--ink); margin-bottom: 8px; cursor: pointer;
}
.notes-loc .notes-loc-check input { flex: 0 0 auto; margin-top: 2px; }
.notes-loc .notes-loc-hint { font-size: 12px; color: var(--sub); line-height: 1.65; }
.notes-loc .notes-loc-divider { border: none; border-top: 1px solid var(--line); margin: 16px 0 8px; }

/* ============ 备忘录新版布局：左目录 + 右两列卡片 ============ */

#view-notes .notes-layout {
  display: flex; gap: 14px; align-items: stretch;
  flex: 1 1 auto; min-height: 0;          /* 占满卡片剩余高度，交给子栏各自滚动 */
}
#view-notes .notes-sidebar {
  flex: 0 0 248px; max-width: 248px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;                          /* 整卡定高后无需 sticky，左栏与右栏同高 */
}
#view-notes .notes-sidebar .notes-search { width: 100%; flex: 0 0 auto; }
#view-notes .notes-dir-list {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto;
  border: none; border-radius: 12px; padding: 4px; background: #fff;
}
#view-notes .notes-dir-item {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; border: none; background: transparent;
  border-radius: 10px; padding: 7px 8px 7px 5px; color: var(--ink);
  transition: background .15s;
}
#view-notes .notes-dir-item:hover { background: #f1f5f9; }
#view-notes .notes-dir-item.active { background: var(--primary-soft); }
#view-notes .notes-dir-item.active .di-name { color: var(--primary); font-weight: 600; }
#view-notes .notes-dir-item { position: relative; }
#view-notes .notes-dir-item .di-head { display: flex; align-items: center; gap: 5px; }
/* 只读标识：置顶 ★（替代原按钮） */
#view-notes .notes-dir-item .di-pin {
  flex: 0 0 auto; color: #f59e0b; font-size: 13px; line-height: 1; padding: 2px 1px;
}
/* 云端共享标识：☁（源文件仍在本机） */
#view-notes .notes-dir-item .di-shared {
  flex: 0 0 auto; color: #2563eb; font-size: 13px; line-height: 1; padding: 2px 1px;
}
#view-notes .notes-dir-item .di-name {
  flex: 1 1 auto; min-width: 0; text-align: left; border: none; background: transparent;
  font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--ink);
  cursor: pointer; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#view-notes .notes-dir-item .di-name:hover { color: var(--primary); }
/* ⋮ 悬停按钮 */
#view-notes .notes-dir-item .di-dots {
  flex: 0 0 auto; border: none; background: transparent; color: #64748b;
  cursor: pointer; font-size: 17px; line-height: 1; padding: 0 4px; border-radius: 6px;
  opacity: 0; transition: opacity .12s, background .12s;
}
#view-notes .notes-dir-item:hover .di-dots,
#view-notes .notes-dir-item .di-dots.open { opacity: 1; }
#view-notes .notes-dir-item .di-dots:hover { background: #e2e8f0; }
/* ⋮ 下拉菜单（目录 ⋮ 与文档预览弹窗共用；.notes-pop-menu 挂在 body 上） */
#view-notes .notes-dir-item .di-menu,
.notes-pop-menu {
  display: none; flex-direction: column; gap: 1px; z-index: 50;
  min-width: 172px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 26px rgba(15,23,42,.18); padding: 5px;
}
/* 挂在 body 上，需高于弹窗遮罩 .ui-mask(9998)，否则预览弹窗里菜单被压住看不见 */
.notes-pop-menu { position: fixed; z-index: 9999; }
/* 点击父项也能展开子菜单（不依赖悬停） */
#view-notes .notes-dir-item .di-menu .mi.mi-has-sub.sub-open > .mi-sub,
.notes-pop-menu .mi.mi-has-sub.sub-open > .mi-sub { display: flex; }
#view-notes .notes-dir-item .di-menu .mi,
.notes-pop-menu .mi {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: none; background: transparent; text-align: left; cursor: pointer;
  font-size: 13px; color: var(--ink); padding: 7px 9px; border-radius: 7px;
}
#view-notes .notes-dir-item .di-menu .mi:hover,
.notes-pop-menu .mi:hover { background: #f1f5f9; }
#view-notes .notes-dir-item .di-menu .mi .mi-glyph,
.notes-pop-menu .mi .mi-glyph { flex: 0 0 auto; width: 16px; text-align: center; }
#view-notes .notes-dir-item .di-menu .mi .mi-label,
.notes-pop-menu .mi .mi-label { flex: 1 1 auto; }
#view-notes .notes-dir-item .di-menu .mi.mi-danger,
.notes-pop-menu .mi.mi-danger { color: #dc2626; }
#view-notes .notes-dir-item .di-menu .mi.mi-danger:hover,
.notes-pop-menu .mi.mi-danger:hover { background: #fef2f2; }
#view-notes .notes-dir-item .di-menu .mi.armed,
.notes-pop-menu .mi.armed { color: #dc2626; font-weight: 600; }
/* 二级子菜单（导出 ▸）：hover 父项时向右展开；菜单靠屏幕右缘时向左翻 */
#view-notes .notes-dir-item .di-menu .mi.mi-has-sub,
.notes-pop-menu .mi.mi-has-sub { position: relative; }
#view-notes .notes-dir-item .di-menu .mi .mi-arrow,
.notes-pop-menu .mi .mi-arrow { flex: 0 0 auto; color: #94a3b8; font-size: 11px; }
#view-notes .notes-dir-item .di-menu .mi .mi-sub,
.notes-pop-menu .mi .mi-sub {
  display: none; position: absolute; left: calc(100% + 2px); top: -5px; z-index: 60;
  min-width: 168px; flex-direction: column; gap: 1px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(15,23,42,.18); padding: 5px;
}
#view-notes .notes-dir-item .di-menu .mi.mi-has-sub:hover > .mi-sub,
#view-notes .notes-dir-item .di-menu .mi.mi-has-sub > .mi-sub:hover,
.notes-pop-menu .mi.mi-has-sub:hover > .mi-sub,
.notes-pop-menu .mi.mi-has-sub > .mi-sub:hover { display: flex; }
#view-notes .notes-dir-item .di-menu.sub-left .mi .mi-sub,
.notes-pop-menu.sub-left .mi .mi-sub { left: auto; right: calc(100% + 2px); }
/* 标签：随名字同行显示（名字后面、⋮ 前），复用右侧 .note-tag 方标签样式 */
#view-notes .notes-dir-item .di-tags {
  display: flex; gap: 4px; flex: 0 1 auto; min-width: 0;
  overflow: hidden; flex-wrap: nowrap;
}
#view-notes .notes-dir-item .di-tag {
  flex: 0 0 auto; font-size: 11px; color: var(--primary); background: var(--primary-soft);
  border: none; border-radius: 5px; padding: 1px 7px; line-height: 1.5;
  white-space: nowrap;
}
#view-notes .notes-dir-empty { font-size: 13px; color: var(--sub); text-align: center; padding: 16px 8px; }

#view-notes .notes-main {
  flex: 1 1 auto; min-width: 0; min-height: 0; position: relative;
  /* 不再自己滚动：改为 flex 列容器，把有限高度传给 .notes-grid → 两列各自滚动 */
  display: flex; flex-direction: column;
  overflow: hidden;                       /* 禁横向；纵向交给两列，避免双重滚动条 */
  padding: 2px 6px 8px 2px;               /* 底部收紧：原 18px 在卡片下方留一大截空白 */
}
/* 两列各自独立滚动：容器只负责横向排布，滚动交给下面每列。
   卡片由 JS 按高度贪心分配（见 notes.js renderList），不再用 CSS column-count 的自动流。 */
#view-notes .notes-grid {
  display: flex; align-items: stretch; gap: 14px;
  flex: 1 1 auto; min-height: 0; min-width: 0;
}
#view-notes .notes-grid-col {
  flex: 1 1 0; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 0;
  overflow-y: auto; overflow-x: hidden;
}
/* 卡片保持自然高度，禁止被列的 flex 高度压缩（否则内容被压扁、无法滚动） */
#view-notes .notes-grid-col .note-card { flex: 0 0 auto; }
/* Lute 渲染后容器类切成 .vditor-reset、不再带 .markdown，
   宽内容失去原 .markdown 约束会撑出横向滚动条；这里补齐约束。 */
#view-notes .notes-main table { max-width: 100%; table-layout: fixed; }
#view-notes .notes-main th,
#view-notes .notes-main td { overflow-wrap: anywhere; }
#view-notes .notes-main pre { max-width: 100%; overflow-x: auto; }

/* 卡片展开 / 收起预览（收起时截断为几行，带渐隐） */
#view-notes .note-pin { color: #f59e0b; font-size: 13px; flex: 0 0 auto; }
#view-notes .note-shared-badge { color: #2563eb; background: #eff6ff; border: 1px solid #dbeafe;
  border-radius: 8px; padding: 0 6px; font-size: 11px; line-height: 18px; flex: 0 0 auto; white-space: nowrap; }
#view-notes .note-body.collapsed { max-height: 5.4em; overflow: hidden; position: relative; }
#view-notes .note-body.collapsed::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.6em;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--card));
}

/* ---------------- 共享视图：左表格列表 + 右预览 ---------------- */
/* 共享筛选下拉：占位与 antd 触发器同几何，挂载前后不跳动 */
#view-notes #sharedAuthorHost,
#view-notes #sharedSortHost { display: inline-flex; align-items: center; flex: 0 0 auto; }
#view-notes .notes-dd-ph,
#view-notes #sharedAuthorHost .jira-dd-trigger,
#view-notes #sharedSortHost .jira-dd-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 6px;
  height: 36px; min-height: 36px; box-sizing: border-box; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); font-size: 13px; white-space: nowrap; user-select: none;
}
#view-notes .notes-dd-ph .ar,
#view-notes #sharedAuthorHost .jira-dd-trigger .ar,
#view-notes #sharedSortHost .jira-dd-trigger .ar { color: var(--sub); font-size: 12px; }
#view-notes .sh-pv-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#view-notes #shDelBtn { color: #dc2626; border-color: #fecaca; }
#view-notes #shDelBtn:hover { background: #fef2f2; border-color: #f87171; }

#view-notes .sh-layout {
  /* pane 已给有限高度，布局改为填满剩余空间；保留 min-height 兜底但收紧，避免固定 68vh 撑破卡片 */
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0; flex: 1 1 auto; min-height: 320px;
}
#view-notes .sh-table {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); overflow: hidden;
}
#view-notes .sh-thead, #view-notes .sh-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 76px 54px 116px;
  gap: 8px; align-items: center; padding: 9px 14px;
}
#view-notes .sh-thead {
  font-size: 12px; color: var(--sub); font-weight: 600;
  border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 1;
}
#view-notes .sh-row {
  font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; transition: background .12s;
}
#view-notes .sh-row:hover { background: #f8fafc; }
#view-notes .sh-row.on { background: #eff6ff; }
#view-notes .sh-row.pin { border-left-color: var(--primary); }
#view-notes .sh-row-title { min-width: 0; display: flex; align-items: center; gap: 6px; }
#view-notes .sh-row-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-notes .sh-row .sh-cell { color: var(--sub); font-size: 12px; font-variant-numeric: tabular-nums; }
#view-notes .sh-tag {
  color: var(--primary); background: var(--primary-soft); border: none;
  border-radius: 5px; padding: 1px 7px; font-size: 11px; line-height: 1.6; white-space: nowrap;
}
#view-notes .sh-rows { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
#view-notes .sh-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
/* 共享文档包装层：JS selectNote 把 inline display 置空 → 回退到这里声明的 flex；
   clearPreview 设 inline display:none 优先级更高，隐藏照常。
   必须 flex:1 + min-height:0，否则 .sh-pv-body 的 overflow-y:auto 拿不到有限高度 → 长文撑破不滚。 */
#view-notes #shPvDoc { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#view-notes .sh-pv-empty {
  display: flex; align-items: center; justify-content: center;
  flex: 1 1 auto; color: var(--sub); font-size: 14px;
}
#view-notes .sh-pv-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
}
#view-notes .sh-pv-head h3 { margin: 0; font-size: 16px; color: var(--ink); flex: 1 1 auto; word-break: break-all; }
#view-notes .sh-pv-export { position: relative; flex: 0 0 auto; }
#view-notes .sh-export-menu {
  position: absolute; right: 0; top: 100%; margin-top: 4px; z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 5px; min-width: 168px;
}
#view-notes .sh-export-menu button {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer; font-family: inherit;
}
#view-notes .sh-export-menu button:hover { background: #f1f5f9; }
#view-notes .sh-pv-meta { padding: 8px 16px; color: var(--sub); font-size: 12px; border-bottom: 1px solid var(--line); }
#view-notes .sh-pv-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 12px 16px 24px; }
@media (max-width: 900px) {
  #view-notes .sh-layout { grid-template-columns: 1fr; height: auto; max-height: none; }
  #view-notes .sh-table { border-right: none; border-bottom: 1px solid var(--line); max-height: 340px; }
  #view-notes .sh-preview { min-height: 320px; }
}

/* ---------------- 笔记文库：同排控件统一 34px 紧凑 ----------------
   历史遗留：主 .btn 44px / 切换 34px / 下拉 36px / 搜索 30px 混排，高低参差。
   此处只统一 #view-notes 内同排控件的几何，不动配色与层级语义。 */
#view-notes .btn,
#view-notes .notes-dd-ph,
#view-notes #sharedAuthorHost .jira-dd-trigger,
#view-notes #sharedSortHost .jira-dd-trigger {
  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-height: 34px; line-height: 1;
  padding: 0 12px; margin: 0;
  font-family: inherit; font-size: 13px; font-weight: 400;
  border-radius: 8px;
}
#view-notes .notes-search {
  box-sizing: border-box; height: 34px; min-height: 34px;
  padding: 0 12px; font-size: 13px; border-radius: 8px;
}
#view-notes .view-switch { box-sizing: border-box; height: 34px; padding: 3px; }
#view-notes .view-switch button {
  box-sizing: border-box; height: 26px; min-height: 26px; line-height: 1;
  padding: 0 12px; font-size: 13px; border-radius: 6px;
}
/* 设置弹窗内输入框与「浏览…/重新设置」按钮统一高度 */
.notes-loc .notes-loc-row .ui-dlg-input,
.notes-loc .notes-loc-row .btn {
  box-sizing: border-box; height: 44px; min-height: 44px;
  padding: 0 12px; line-height: 1; border-radius: 8px;
}

/* ---------------- 笔记文库预览/编辑弹窗（统一大尺寸，所见一致） ---------------- */
.ui-dialog.notes-dlg { width: min(1100px, 94vw); }
.ui-dialog.notes-dlg .ui-dlg-bd { height: 74vh; overflow: auto; }
/* 弹窗头部：标题文字 + 标题/标签输入同行 */
.ui-dialog.notes-dlg .ui-dlg-hd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px 12px; }
.ui-dialog.notes-dlg .ui-dlg-hd .note-edit-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 auto; padding: 0; min-width: 0; }
.ui-dialog.notes-dlg .ui-dlg-hd .note-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: 400; color: var(--ink); background: #fff; box-sizing: border-box;
}
.ui-dialog.notes-dlg .ui-dlg-hd .note-title-input { flex: 1 1 240px; font-weight: 600; }
.ui-dialog.notes-dlg .ui-dlg-hd .note-tags-input { flex: 0 1 200px; }
.ui-dialog.notes-dlg .ui-dlg-hd .note-input:focus { outline: none; border-color: var(--primary); }
/* 预览弹窗头部右侧的「⤓ 导出」按钮 */
.ui-dialog.notes-dlg .ui-dlg-hd .note-export-btn { margin-left: auto; flex: 0 0 auto; }

.ui-dlg-bd.notes-edit { white-space: normal; }
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit { display: flex; flex-direction: column; overflow: visible; }
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-edit-bar { flex: 0 0 auto; }
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-edit-pane,
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor { flex: 1 1 auto; min-height: 0; }
/* 注意：Vditor 初始化会把 vditor 类合并到容器自身（note-vditor vditor 同元素），必须用复合选择器 */
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor.vditor { height: 100% !important; border-radius: 10px; border: none; box-shadow: none; }
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor .vditor-ir .vditor-ir-content { font-size: 14px; }
/* Vditor 大纲模式自带行为：JS 会把工具栏 padding-left 撑到大纲宽度，左侧留一大块空白——压回去 */
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor.vditor > .vditor-toolbar { padding-left: 5px !important; }
/* 编辑正文默认左右 35px 内边距收窄 */
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor .vditor-ir pre.vditor-reset { padding-left: 14px !important; padding-right: 14px !important; }
/* 大纲面板 250px 收窄，减少树右侧空白 */
.ui-dialog.notes-dlg .ui-dlg-bd.notes-edit .note-vditor .vditor-outline { width: 200px; flex: 0 0 200px; }

.ui-dlg-bd.notes-preview { white-space: normal; }
.ui-dlg-bd.notes-preview .note-preview-meta {
  font-size: 12px; color: var(--sub); padding: 0 2px 10px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
/* 预览正文：Lute 渲染后容器类为 .vditor-reset，与编辑窗同源样式；滚动由弹窗 bd 统一处理 */
.ui-dlg-bd.notes-edit .note-edit-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px;
}
.ui-dlg-bd.notes-edit .note-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; color: var(--ink); background: #fff; box-sizing: border-box;
}
.ui-dlg-bd.notes-edit .note-input:focus { outline: none; border-color: var(--primary); }
.ui-dlg-bd.notes-edit .note-title-input { flex: 1 1 240px; font-weight: 600; }
.ui-dlg-bd.notes-edit .note-tags-input { flex: 0 1 200px; }
.ui-dlg-bd.notes-edit .note-edit-pane { display: flex; gap: 10px; align-items: stretch; }
.ui-dlg-bd.notes-edit .note-textarea {
  flex: 1 1 50%; min-height: 320px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; line-height: 1.7; color: var(--ink); background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei", monospace;
}
.ui-dlg-bd.notes-edit .note-textarea:focus { outline: none; border-color: var(--primary); }
.ui-dlg-bd.notes-edit .note-preview {
  flex: 1 1 50%; min-height: 320px; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; font-size: 14px; line-height: 1.75; color: var(--ink);
}
.ui-dlg-bd.notes-edit .note-preview > *:first-child { margin-top: 0; }

@media (max-width: 900px) {
  #view-notes .notes-card { height: auto; min-height: 0; margin-bottom: 14px; display: block; }
  #view-notes .notes-layout { flex: 0 0 auto; }
  #view-notes .notes-main { overflow: visible; display: block; padding: 0; }
  #view-notes .notes-layout { flex-direction: column; }
  #view-notes .notes-sidebar { flex-basis: auto; max-width: none; width: 100%; position: static; }
  #view-notes .notes-dir-list { max-height: 200px; flex: 0 0 auto; }
  /* 窄屏单列：第二列隐藏，JS 检测宽度后把所有卡片放进第一列 */
  #view-notes .notes-grid { flex: 0 0 auto; }
  #view-notes .notes-grid-col { overflow: visible; }
  #view-notes .notes-grid-col[data-col="1"] { display: none; }
  .ui-dlg-bd.notes-edit .note-edit-pane { flex-direction: column; }
}
