/*
 * 「工作/编码」会话输入框上方的任务进度条（js/ai-task-progress.js，V3.137）。
 * 只取主题变量，不写色值；标题行是整行按钮（触控高度 ≥ 44px），展开列表限高可滚。
 */
/* 上下边距由 ai-search.css「输入框上方叠放的几行」统一管（V3.196） */
.ai-task-progress {
    border: 1px solid var(--kb-paper-line);
    border-radius: 10px;
    background: var(--kb-paper-panel);
    color: var(--kb-ink);
    font-size: 0.8125rem;
    overflow: hidden;
}

.ai-task-progress[hidden] {
    display: none;
}

.ai-task-progress__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ai-task-progress__toggle:focus-visible {
    outline: 2px solid var(--kb-accent);
    outline-offset: -2px;
}

.ai-task-progress__icon {
    color: var(--kb-accent);
    font-size: 1rem;
}

.ai-task-progress__count {
    flex-shrink: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ai-task-progress__meter {
    flex: 0 0 72px;
    height: 4px;
    border-radius: 999px;
    background: var(--kb-active-bg);
    overflow: hidden;
}

.ai-task-progress__meter > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--kb-accent);
    transition: width 0.3s ease;
}

.ai-task-progress__current {
    flex: 1;
    min-width: 0;
    color: var(--kb-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-task-progress__chevron {
    flex-shrink: 0;
    color: var(--kb-ink-muted);
    transition: transform 0.2s ease;
}

.ai-task-progress__toggle[aria-expanded="true"] .ai-task-progress__chevron {
    transform: rotate(180deg);
}

.ai-task-progress__list {
    list-style: none;
    margin: 0;
    padding: 4px 12px 10px;
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid var(--kb-paper-line);
}

.ai-task-progress__list[hidden] {
    display: none;
}

.ai-task-progress__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    line-height: 1.5;
}

.ai-task-progress__item > i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--kb-ink-muted);
}

.ai-task-progress__item.is-completed > i,
.ai-task-progress__item.is-in_progress > i {
    color: var(--kb-accent);
}

.ai-task-progress__item.is-completed .ai-task-progress__title,
.ai-task-progress__item.is-cancelled .ai-task-progress__title {
    color: var(--kb-ink-muted);
}

.ai-task-progress__item.is-cancelled .ai-task-progress__title {
    text-decoration: line-through;
}

.ai-task-progress__item.is-in_progress .ai-task-progress__title {
    font-weight: 600;
}

.ai-task-progress__item > i.is-spinning {
    animation: kb-loading-spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .ai-task-progress__item > i.is-spinning {
        animation: none;
    }

    .ai-task-progress__meter > span,
    .ai-task-progress__chevron {
        transition: none;
    }
}

@media (max-width: 1023px) {
    .ai-task-progress__meter {
        display: none;
    }
}
