.agent-plan-progress {
    --agent-plan-surface: var(--card-bg);
    --agent-plan-surface-hover: var(--bg-tertiary);
    --agent-plan-text: var(--text-primary);
    --agent-plan-text-secondary: var(--text-secondary);
    --agent-plan-border: var(--border-color);
    --agent-plan-spinner-track: color-mix(in srgb, var(--accent-color) 30%, transparent);
    position: relative;
    z-index: 42;
    flex: 0 0 0;
    width: 100%;
    height: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.agent-plan-progress[hidden] {
    display: none;
}

.agent-plan-progress-trigger {
    position: absolute;
    right: 50%;
    bottom: 12px;
    transform: translateX(50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--agent-plan-border);
    border-radius: 8px;
    color: var(--agent-plan-text);
    background: var(--agent-plan-surface);
    box-shadow: var(--shadow-md);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.agent-plan-progress-trigger:hover,
.agent-plan-progress-trigger:focus-visible {
    background: var(--agent-plan-surface-hover);
    border-color: var(--accent-color);
    outline: none;
}

.agent-plan-progress-panel {
    position: absolute;
    right: 50%;
    bottom: 62px;
    width: max-content;
    min-width: 320px;
    max-width: min(520px, calc(100vw - 40px));
    max-height: min(50vh, 400px);
    padding: 12px 16px;
    overflow: auto;
    border: 1px solid var(--agent-plan-border);
    border-radius: 8px;
    color: var(--agent-plan-text);
    background: var(--agent-plan-surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translate(50%, 6px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.agent-plan-progress:focus-within .agent-plan-progress-panel,
.agent-plan-progress.is-open .agent-plan-progress-panel {
    opacity: 1;
    transform: translate(50%, 0);
    visibility: visible;
    pointer-events: auto;
}

.agent-plan-task {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    min-height: 32px;
    padding: 4px 0;
    font-size: 14px;
    line-height: 1.45;
}

.agent-plan-task-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.agent-plan-task--completed,
.agent-plan-task--pending {
    color: var(--agent-plan-text-secondary);
}

.agent-plan-task-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin-top: 2px;
    border: 2px solid var(--agent-plan-text-secondary);
    border-radius: 50%;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.agent-plan-task-check {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.agent-plan-task-status--in_progress {
    border-color: var(--agent-plan-spinner-track);
    border-top-color: var(--accent-color);
    animation: agent-plan-spin 820ms linear infinite;
}

.agent-plan-progress-trigger .agent-plan-task-status {
    margin-top: 0;
}

@keyframes agent-plan-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .agent-plan-progress-panel {
        min-width: min(320px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .agent-plan-progress-trigger,
    .agent-plan-progress-panel {
        transition: none;
    }

    .agent-plan-task-status--in_progress {
        animation-duration: 1.8s;
    }
}
