/* =====================================================================================
   组件样式：表格、徽章、进度条、弹窗、抽屉、提示、空状态、分页、标签页
   ===================================================================================== */

/* ---------- 表格 ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    background: var(--color-surface-alt);
}

.data-table tbody tr:hover {
    background: var(--color-primary-soft);
}

.data-table tbody tr.is-selected {
    background: var(--color-primary-soft);
}

.data-table tbody tr.is-deleted {
    opacity: 0.6;
}

.data-table td.col-actions {
    white-space: nowrap;
    text-align: right;
}

.data-table .sortable {
    cursor: pointer;
    user-select: none;
}

.data-table .sortable:hover {
    color: var(--color-primary);
}

.data-table .sort-indicator {
    margin-left: 4px;
    font-size: 10px;
    color: var(--color-primary);
}

.col-check {
    width: 36px;
    text-align: center !important;
}

.task-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 180px;
}

.task-title__main {
    font-weight: 500;
    color: var(--color-text);
    word-break: break-word;
}

.task-title__meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.cell-nowrap {
    white-space: nowrap;
}

.cell-datetime {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
}

/* ---------- 徽章与标签 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.badge--notstarted { color: #475569; background: #f1f5f9; }
.badge--inprogress { color: #0e7490; background: var(--color-info-soft); }
.badge--completed { color: #15803d; background: var(--color-success-soft); }
.badge--cancelled { color: #64748b; background: #f8fafc; }
.badge--overdue { color: var(--color-danger); background: var(--color-danger-soft); }
.badge--warning { color: #b45309; background: var(--color-warning-soft); }
.badge--primary { color: var(--color-primary); background: var(--color-primary-soft); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.tag__close {
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.tag__close:hover {
    color: var(--color-danger);
}

.priority-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.priority-chip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.priority-1 { color: var(--priority-1); }
.priority-2 { color: var(--priority-2); }
.priority-3 { color: var(--priority-3); }
.priority-4 { color: var(--priority-4); }
.priority-5 { color: var(--priority-5); }

/* 同步状态角标 */
.sync-flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.sync-flag--pending { color: var(--color-warning); }
.sync-flag--conflict { color: var(--color-danger); cursor: pointer; }

/* ---------- 进度条 ---------- */
.progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.progress__track {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    transition: width 0.25s ease;
}

.progress__bar.is-completed { background: var(--color-success); }
.progress__bar.is-cancelled { background: var(--color-border-strong); }

.progress__text {
    width: 36px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
    text-align: right;
}

/* ---------- 空状态与加载 ---------- */
.empty-state {
    padding: 56px 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state__icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state__title {
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.empty-state__desc {
    font-size: 13px;
}

.loading-mask {
    padding: 48px;
    text-align: center;
    color: var(--color-text-muted);
}

.loading-spinner {
    width: 26px;
    height: 26px;
    margin: 0 auto 10px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination button {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination button.is-active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.45);
}

.modal {
    width: 100%;
    max-width: 720px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.18s ease-out;
}

.modal--sm {
    max-width: 440px;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal__title {
    font-size: 16px;
}

.modal__close {
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.modal__close:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
}

.modal__body {
    padding: 20px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

.modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- 详情抽屉 ---------- */
.drawer-mask {
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer);
    background: rgba(15, 23, 42, 0.35);
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    animation: drawer-in 0.2s ease-out;
}

@keyframes drawer-in {
    from { transform: translateX(24px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.drawer__body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.drawer__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

/* 详情字段列表 */
.detail-list {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px 16px;
    font-size: 13px;
}

.detail-list dt {
    color: var(--color-text-muted);
}

.detail-list dd {
    margin: 0;
    color: var(--color-text);
    word-break: break-word;
    white-space: pre-wrap;
}

/* ---------- 标签页 ---------- */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
}

.tabs button {
    flex: 1;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.tabs button.is-active {
    color: var(--color-primary);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

/* ---------- 提示消息 ---------- */
.toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 240px;
    max-width: 380px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
}

.toast--success { border-left-color: var(--color-success); }
.toast--error { border-left-color: var(--color-danger); }
.toast--warning { border-left-color: var(--color-warning); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- 提示条 ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    border-radius: var(--radius-md);
}

.alert--info { color: #0e7490; background: var(--color-info-soft); }
.alert--warning { color: #b45309; background: var(--color-warning-soft); }
.alert--danger { color: #b91c1c; background: var(--color-danger-soft); }
.alert--success { color: #15803d; background: var(--color-success-soft); }

/* ---------- 冲突对比面板 ---------- */
.conflict-item {
    margin-bottom: 12px;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-danger);
    border-radius: var(--radius-md);
}

.conflict-item__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.conflict-compare {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.conflict-col {
    padding: 12px;
    font-size: 13px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.conflict-col__title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.conflict-field {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px dashed var(--color-border);
}

.conflict-field:last-child {
    border-bottom: none;
}

.conflict-field__label {
    width: 84px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.conflict-field__value {
    flex: 1;
    word-break: break-word;
}

.conflict-field.is-different .conflict-field__value {
    font-weight: 600;
    color: var(--color-danger);
}

@media (max-width: 720px) {
    .conflict-compare {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- 抽屉内的分隔线 ---------- */
.drawer__divider {
    height: 1px;
    margin: 20px 0;
    border: none;
    background: var(--color-border);
}

/* ---------- 附件区块 ---------- */
.attachment-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-section__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.attachment-section__title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.attachment-section__hint {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* 紧凑排版：用于子任务内部，减少视觉层级 */
.attachment-section.is-compact .attachment-section__title {
    font-size: 13px;
}

.attachment-section.is-compact .attachment-section__hint {
    display: none;
}

/* ---------- 图片缩略图墙（一行多张） ---------- */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.thumb {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 6px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.thumb.is-pending {
    border-style: dashed;
    border-color: var(--color-warning);
}

.thumb__holder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 84px;
    overflow: hidden;
    cursor: zoom-in;
    background: #0f172a;
    border-radius: var(--radius-sm);
}

.thumb__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.thumb__placeholder {
    font-size: 11px;
    color: var(--color-text-muted);
}

.thumb__caption {
    font-size: 11px;
    color: var(--color-text-secondary);
    word-break: break-all;
    /* 文件名最多展示两行 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thumb__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
}

/* ---------- 文件选择拖拽区 ---------- */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--color-surface-alt);
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.drop-zone__icon {
    font-size: 28px;
    line-height: 1;
}

.drop-zone__title {
    font-size: 14px;
    font-weight: 500;
}

.drop-zone__hint {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ---------- 子任务 ---------- */
.subtask-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subtask-panel__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subtask-panel__title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.subtask-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subtask-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.subtask-item.is-done {
    background: var(--color-success-soft);
    border-color: #bbf7d0;
}

.subtask-item.is-done .subtask-item__title {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.subtask-item.is-cancelled {
    opacity: 0.65;
}

.subtask-item.is-pending {
    border-style: dashed;
    border-color: var(--color-warning);
    background: var(--color-warning-soft);
}

.subtask-item__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subtask-item__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.subtask-item__title {
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
}

.subtask-item__requirement {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
}

.subtask-item__actions {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: flex-end;
}

/* ---------- 表格：操作列固定在右侧 ---------- */
.data-table th.col-actions,
.data-table td.col-actions {
    position: sticky;
    right: 0;
    background: var(--color-surface);
}

.data-table th.col-actions {
    /* 表头本身也是 sticky，层级需要高于普通单元格 */
    z-index: 3;
    background: var(--color-surface-alt);
}

.data-table td.col-actions {
    z-index: 2;
    /* 左侧投一层浅阴影，滚动时与内容区形成分隔 */
    box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.18);
}

.data-table tbody tr:hover td.col-actions,
.data-table tbody tr.is-selected td.col-actions {
    background: var(--color-primary-soft);
}

/* ---------- 表格：进度下方的子任务完成情况 ---------- */
.progress__sub {
    margin-top: 3px;
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: right;
}

/* ---------- 响应式：窗口变窄时依次隐藏次要列 ---------- */
@media (max-width: 1500px) {
    .col-hide-xl { display: none; }
}

@media (max-width: 1320px) {
    .col-hide-lg { display: none; }
}

@media (max-width: 1150px) {
    .col-hide-md { display: none; }
}

@media (max-width: 980px) {
    .col-hide-sm { display: none; }
}

@media (max-width: 820px) {
    .col-hide-xs { display: none; }
}

/* =====================================================================================
   甘特图
   ===================================================================================== */

.gantt {
    /* 左侧任务名称列宽度，进度条区域的计算需要用到，故以变量形式统一维护 */
    --gantt-label-width: 240px;
    /* 行高：需容纳任务名称 + 负责人/类别元信息，过小会导致文字溢出被下一行覆盖 */
    --gantt-row-height: 60px;
}

/* ---------- 时间窗口导航 ---------- */
.gantt-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-secondary);
}

.gantt-nav__range {
    font-weight: 600;
    color: var(--color-text);
    margin-left: 6px;
}

.gantt-nav .text-muted {
    margin-left: auto;
}

/* ---------- 模板快速筛选 ---------- */
.template-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.template-filters .form-item {
    min-width: 170px;
}

.template-filters__reset {
    margin-bottom: 2px;
}

/* ---------- 过滤区 ---------- */
.gantt-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.gantt-filter {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gantt-filter--inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.gantt-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.gantt-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gantt-legend__swatch {
    display: inline-block;
    width: 16px;
    height: 8px;
    border-radius: 2px;
}

.gantt-legend__swatch--planned { background: var(--color-primary); }
.gantt-legend__swatch--green { background: var(--color-success); }
.gantt-legend__swatch--red { background: var(--color-danger); }

/* ---------- 画布 ---------- */
.gantt__scroll {
    max-height: 62vh;
    overflow: auto;
}

.gantt__inner {
    position: relative;
    min-width: 100%;
}

/* ---------- 表头 ---------- */
.gantt-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border-strong);
}

.gantt-header__label {
    position: sticky;
    left: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: var(--gantt-label-width);
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    border-right: 1px solid var(--color-border-strong);
}

.gantt-header__track {
    position: relative;
    flex-shrink: 0;
}

.gantt-groups {
    position: relative;
    height: 22px;
    border-bottom: 1px solid var(--color-border);
}

.gantt-group {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-left: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
}

.gantt-ticks {
    position: relative;
    height: 26px;
}

.gantt-tick {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--color-border);
    overflow: hidden;
}

.gantt-tick__label {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ---------- 数据行 ---------- */
.gantt-row {
    display: flex;
    height: var(--gantt-row-height);
    border-bottom: 1px solid var(--color-border);
}

.gantt-row:hover {
    background: var(--color-primary-soft);
}

.gantt-row.is-overdue .gantt-row__title::after {
    content: '逾期';
    margin-left: 6px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--color-danger);
    background: var(--color-danger-soft);
    border-radius: var(--radius-pill);
}

.gantt-row__label {
    position: sticky;
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    width: var(--gantt-label-width);
    padding: 4px 12px;
    cursor: pointer;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border-strong);
    overflow: hidden;
}

.gantt-row:hover .gantt-row__label {
    background: var(--color-primary-soft);
}

.gantt-row__title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-row__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
}

.gantt-row__track {
    position: relative;
    flex-shrink: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(var(--gantt-row-height) / 2 - 1px),
        var(--color-border) calc(var(--gantt-row-height) / 2 - 1px),
        var(--color-border) calc(var(--gantt-row-height) / 2)
    );
}

/* ---------- 进度条 ---------- */
.gantt-bar {
    position: absolute;
    border-radius: 3px;
}

.gantt-bar--planned {
    top: 8px;
    height: 9px;
    background: var(--color-primary);
    opacity: 0.85;
}

.gantt-bar--actual {
    top: 26px;
    height: 9px;
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.gantt-bar__green {
    height: 100%;
    background: var(--color-success);
}

.gantt-bar__red {
    height: 100%;
    background: var(--color-danger);
}

/* ---------- 今天标记线 ---------- */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dashed rgba(220, 38, 38, 0.6);
    pointer-events: none;
    z-index: 1;
}

/* ---------- 只读信息块（完成弹窗中的要求 / 子任务说明） ---------- */
.readonly-block {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- 进度滑块 ---------- */
.range-input {
    width: 100%;
    accent-color: var(--color-primary);
}

/* ---------- 重复任务模板 ---------- */
.template-list {
    padding: 8px 0;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.template-item:last-child {
    border-bottom: none;
}

.template-item__main {
    flex: 1;
    min-width: 0;
}

.template-item__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.template-item__title {
    font-size: 14px;
    font-weight: 600;
}

.template-item__meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.template-item__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ---------- 自动添加提示弹窗 ---------- */
.auto-add-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.auto-add-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.auto-add-item:last-child {
    border-bottom: none;
}

.auto-add-item:hover {
    background: var(--color-surface-alt);
}

.auto-add-item__title {
    font-size: 14px;
    font-weight: 500;
}

.gantt-today-line__tag {
    position: absolute;
    top: 2px;
    left: 2px;
    padding: 0 4px;
    font-size: 10px;
    color: #fff;
    background: var(--color-danger);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.attachment-empty {
    padding: 20px;
    font-size: 13px;
    text-align: center;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-md);
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s, background 0.15s;
}

.attachment-item:hover {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
}

.attachment-item__icon {
    flex-shrink: 0;
    font-size: 20px;
    line-height: 1;
}

.attachment-item__main {
    flex: 1;
    min-width: 0;
}

.attachment-item__name {
    font-size: 13px;
    font-weight: 500;
    word-break: break-all;
}

.attachment-item__meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.attachment-item__actions {
    display: flex;
    flex-shrink: 0;
    gap: 2px;
}

/* ---------- 图片预览灯箱 ---------- */
.preview-mask {
    position: fixed;
    inset: 0;
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(15, 23, 42, 0.82);
}

.preview-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    max-height: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modal-in 0.18s ease-out;
}

.preview-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.preview-box__title {
    font-size: 14px;
    font-weight: 500;
    word-break: break-all;
}

.preview-box__body {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 200px;
    padding: 16px;
    overflow: auto;
    background: #0f172a;
}

.preview-box__image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.preview-box__footer {
    padding: 10px 16px;
    font-size: 12px;
    text-align: right;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 720px) {
    .preview-mask {
        padding: 12px;
    }

    .attachment-item {
        flex-wrap: wrap;
    }

    .attachment-item__actions {
        width: 100%;
        justify-content: flex-end;
    }
}
